Posts

Showing posts from May, 2012

ios - Swift: Required initializer giving me an error message -

i have class named alarm inheriting nsobject, , in it, have property i'm having issue with, alarmlasttriggereddate: class alarm: nsobject { var alarmlasttriggereddate: nsdate override init() { super.init() } func encodewithcoder(acoder: nscoder) { acoder.encodeobject(alarmlasttriggereddate, forkey: "alarmlasttriggereddate") } required init(coder adecoder: nscoder) { if let alarmlasttriggereddatedecoded = adecoder.decodeobjectforkey("alarmlasttriggereddate") as? nsdate { alarmlasttriggereddate = alarmlasttriggereddatedecoded } } } i'm new swift, , not sure why i'm getting following errors: @override init: property 'self.alarmlasttriggereddate' not initialized @ super.init call @required init: property 'self.alarmlasttriggereddate' not initialized @ implicitly generated super.init call it seems way fix problem initialized in both places, that'...

Excel Defined Name List in Index dropdown -

Image
i have cells list following **mylist** 1 green 2 blue 3 red 4 yellow 5 special 6 special and have specials list defined special **special** apple banana grapes i have formula looks match , displays value in drop down if 2 listed in left-most column blue drop down selection. =index($a$15:$b$20,match($e20,$a$15:$a$20,0),2) but drop down cells 5 , 6 'special' not drop down defined list name(special) contents. how can include defined name in formula? set lookup table more closely represent following: base f20 data validation list's source: on following formula, =offset(index($b$15:$b$20, match(e20, $a$15:$a$20, 0)), 0, 0, 1, match("zzz", index($b$15:$d$20, match(e20, $a$15:$a$20, 0), 0))) the dynamic list in f20 should follow table lookup value in e20. if running out of room (c19:d20) may have relocate list altogether.

java - UCanAccess Exception: cannot getMetaData from ResultSet (invalid cursor state) -

i'm trying data access table , show on jtable. i'm using ucanaccess java 8 not support jdbc-odbc. my window class calls charging methods: ctrlgestionventas= new ctrlgestionventas(); ctrlgestionventas.cargarlistaventas(tbllistaventas); then, ctrlgestionventas.cargarlistaventas(tabla) fills jtable resultset: public class ctrlgestionventas { public void cargarlistaventas(jtable tabla) { resultset rs; dataventas dv = new dataventas(); rs = dv.getlistaventas(); try { tabla.setmodel(buildtablemodel(rs)); rowsorter sorter = new tablerowsorter(buildtablemodel(rs)); tabla.setrowsorter(sorter); tabla.gettableheader().setdefaultrenderer(new multisorttablecellheaderrenderer()); } catch (sqlexception e) { // todo auto-generated catch block e.printstacktrace(); } } public static defaulttablemodel buildtablemodel(resultset rs) throws sqlexception { resultsetmetadata metadata =...

haskell - Mapping a strict vs. a lazy function -

(head . map f) xs = (f . head) xs it works every xs list when f strict. can give me example, why non-strict f doesnt work? let's take non-strict function f = const () , , xs = undefined . in case, have map f undefined = undefined but f undefined = () and so (head . map f) undefined = head (map f undefined) = head undefined = undefined but (f . head) undefined = f (head undefined) = f undefined = () q.e.d.

sql server - TFS / SSDT Deployment in Multi Environment Scenario -

this scenario experiencing. in development environment, developers make changes in dev sql server, schema compare in visual studio 2013 / tfs, update tfs check changes in. now, in dev, there many stored procedures in database refer database called a, in sit environment database called b. when want deploy these stored procedures tfs sit environment, there (automated) way replace database database b, stored procs not break in sit? the workaround did generated publish script (via tfs > publish > generate script), copy , paste script ssms, replace reference database database b. however, quite manual (and not foolproof - have careful replace), wondering if there feature/capability exercise in more efficient manner? thanks in advance. cheers there functionality that, might require significant changes in workflow. you can use sql server database projects in ssdt store database code. in case, can declare project-level variable complementary database name, , refer...

arrays - JSON/Javascript object definition -

trying identify type of array, have multidimensional json array pull website, not using keypairs farmiliar with. structure follows. have included 1 array item show it's doing. "o": { "ah": ["id1", "12", "id2", "32", "id4", "4", "id5, "6"] }, my searches on both javascript , json objects , strings use semi-colon : define key , value. in end want loop through multiple items , print them out. to provide more clarification array structure: { "outer": { "item1":[ { "c": { "k": 26862, "n": "thename" }, "o": { "ah": ["id1", "0", "id2", "0", "id3", "0.98", "id4", "0.94", "id5", "5", "id6...

javascript - Website hosted on Google Drive not receiving JSONP from another website -

i developing website needs make jsonp calls external database. when test following code on computer, jsonp calls successful $.getjson("http://api.openchargemap.io/v2/poi/?output=json&distance=" + distbetween + "&latitude=" + x1 + "&longitude=" + y1 + "&distanceunit=miles&maxresults=1&callback=?",function(data){ alert("successful!"); } }); however, when test website through google drive, code doesn't work. google drive has service called editey, html, css, , js editor. can write code , have public see. when test code on google drive host, alert isn't being called. not familiar json, have cross-domain calls? if so, can fix problem? thanks.

java - How to write a function that implements Euclid's Algorithm for computing the greatest common divisor ( m,n)? -

i'm trying add gcd() function numericfunctions class , include code in main compute gcd(m,n) . however, keep getting error: exception in thread "main" java.lang.stackoverflowerror @ numericfunctions.gcd(numericfunctions.java:14) source code: public class numericfunctions { public static long factorial(int n) { long result = 1; (int = 2; <= n; i++) { result *= i; } return result; } public static int gcd (int n, int m) { if ((m % n) == 0) return n; else return gcd(n, m % n); } public static void main(string[] args) { (int n = 1; n <= 10; n++) (int m = 1; m <= 10; m++){ system.out.println(gcd(n,m)); system.out.println(" "); system.out.println(factorial(n)); } } } check out following corrections in gcd() method: public static int gcd (int n, int m) { ...

javascript - PHP Ajax load file with jQuery inside file -

i loading php file using ajax below works great except want able load javascrip/jquery items within file function on main index page. prices(); function prices() { $.ajax({ type: "get", url: "inc/load_prices.php", cache: false, success: function(response){ $("#prices").hide().html(response).fadein(500); } }); } setinterval(prices, 600000); inside load_prices.php have stock ticker type output works fine outside ajax call using below. when loading contact via ajax wont trigger webticker.min.js file , wont render properly. <!-- if loading without ajax ticker works fine --> <script src="js/jquery.webticker.min.js"></script> <script> $("#ticker").webticker({ duplicate:true, hoverpause:false, ...

python - pandas standalone series and from dataframe different behavior -

here code , warning message. if change s standalone series using s = pd.series(np.random.randn(5)) , there no such errors. using python 2.7 on windows. it seems series created standalone , series created column of data frame different behavior? thanks. my purpose change series value itself, other change on copy. source code , import pandas pd sample = pd.read_csv('123.csv', header=none, skiprows=1, dtype={0:str, 1:str, 2:str, 3:float}) sample.columns = pd.index(data=['c_a', 'c_b', 'c_c', 'c_d']) sample['c_d'] = sample['c_d'].astype('int64') s = sample['c_d'] #s = pd.series(np.random.randn(5)) in range(len(s)): if s.iloc[i] > 0: s.iloc[i] = s.iloc[i] + 1 else: s.iloc[i] = s.iloc[i] - 1 warning message , c:\python27\lib\site-packages\pandas\core\indexing.py:132: settingwithcopywarning: value trying set on copy of slice dataframe see caveats in documentation: http...

java - ClassNotFoundException: oracle.jdbc.OracleDriver when running tests using cargo maven2 plugin -

i'm trying run functional tests on cargo maven2 plugin.these tests run fine on local tomcat server when launched without using cargo maven2 plugin. plugin boots when run tests return 500 error code following trace: caused by: org.apache.tomcat.dbcp.dbcp.sqlnestedexception: cannot load jdbc driver class 'oracle.jdbc.oracledriver' @ org.apache.tomcat.dbcp.dbcp.basicdatasource.createconnectionfactory(basicdatasource.java:1429) @ org.apache.tomcat.dbcp.dbcp.basicdatasource.createdatasource(basicdatasource.java:1371) @ org.apache.tomcat.dbcp.dbcp.basicdatasource.getconnection(basicdatasource.java:1044) ... 109 more caused by: java.lang.classnotfoundexception: oracle.jdbc.oracledriver @ java.lang.classloader.findclass(classloader.java:531) @ java.lang.classloader.loadclass(classloader.java:425) @ persistence.spi.hibernate.transformingclassloader.loadclass(transformingclassloader.java:46) @ java.lang.classloader.loadclass(classloader.java:358) @ org.apache.tomcat.db...

java - Error on using weka library on android (Want to Implement Machine Learning in an Android Application) -

for implementing machine learning in android application, using 'weka tool' have included on project 'libs' , compile 'gradle' of project. but while running on phone when functions invoked doing classification (calling 'randomforest classifier'), app goes crashed. i getting 'runtime error'. can me please? unable create weka_home (/wekafiles) unable create packages directory (/wekafiles/packages) unable create repository cache directory (/wekafiles/repcache) d/androidruntime: shutting down vm e/androidruntime: fatal exception: main process: com.example.weirdmyth.testapp, pid: 31474 java.lang.noclassdeffounderror: failed resolution of: ljava/awt/graphicsenvironment; @ weka.core.packagemanagement.packagemanager.setproxyauthentication(packagemanager.java:191) @ weka.core.wekapackagemanager.establishwekahome(wekapackagemanager.java:377) @ weka.core.wekapackageman...

multithreading - Application deployed in weblogic instance is running Slow -

my application deployed in weblogic instance getting slow sometimes. @ time, it's hitting error related stuck thread time in managed server log. initially, when noticed this, did research , increased value of max stuck thread time 800 seconds in place of 600 seconds. but, didn't fix issue. got following error again. watchrule: (severity = 'error') , ((msgid = 'wl-000337') or (msgid = 'bea-000337')) watchdata: message = [stuck] executethread: '58' queue: 'weblogic.kernel.default (self-tuning)' has been busy "812" seconds working on request "http request information: weblogic.servlet.internal.servletrequestimpl@42f38088[post /****/faces/index.jsf] ", more configured time (stuckthreadmaxtime) of "800" seconds in "server-failure-trigger". stack trace: oracle.jbo.pcoll.pcollnode.objectat(pcollnode.java:1753) oracle.jbo.pcoll.pcollnode.objectat(pcollnode.java:1753) oracle.jbo.pcoll.pcollection...

Array index out of range [swift] -

Image
i have set of strings, split out , save array, , try loop api parameter, keep crash error index out of range why it? need pls you should learn array basic ideas. error shows becuse item request not available in array. for in 0...qrcoderarrau.count - 1 { }

c++ - PutItemRequest results in errors -

i use nuget download packages aws dynamodb , aws core. trying dynamodb, header file results in awful errors: #include <afxwin.h> #include<iostream> #include<aws\core\aws.h> #include<aws\dynamodb\dynamodbclient.h> #include<aws\dynamodb\dynamodbrequest.h> #include<aws\dynamodb\model\attributevalue.h> #include<aws\dynamodb\dynamodb_exports.h> #include<aws\dynamodb\dynamodbendpoint.h> #include<aws\dynamodb\dynamodberrormarshaller.h> #include<aws\dynamodb\dynamodberrors.h> #include<aws\core\auth\awscredentialsprovider.h> #include<aws\core\platform\environment.h> #include<aws\core\platform\filesystem.h> using namespace std; class cmyframe : public cframewnd { public: cmyframe() { create(null, _t("mfc application tutorial")); } }; class cexample : public cwinapp { bool initinstance() { aws::sdkoptions options; aws::initapi(options); cmyframe *frame = new cmyframe(); m_pmainwnd =...

wordpress - Permanent Redirect of the domain and subdomain -

i have domain xyz.com has redirected abc.com/123 running on apache2. challenge have page xyz.com/blog. when user hits blog.xyz.com has redirected xyz.com/blog. when user types xyz.com has redirected abc.com/123. how achieve apache2. me out. thanks in advance

css - HTML Email : How to put image to the new line if it overflows td -

<tr> <td style="padding-bottom: 20px;"> <table cellspacing="8" style="margin: 0 auto; "> <tr> <td> <img src="http://www.hubilo.com/eventapp/ws/images/sponsor/logo/thumb/2712_1456734546.jpg" width="70" height="50"> </td> <td style="padding-left: 30px;"> <img src="http://www.hubilo.com/eventapp/ws/images/sponsor/logo/thumb/2712_1455303796.jpg" width="70" height="50"> </td> <td style="padding-left: 30px;"> <img src="http://www.hubilo.com/eventapp/ws/images/sponsor/logo/thumb/2712_1455303882.jpg" width="70" height="50"> </td> <td style="padding-left: 30px;"> <i...

c++ - constexpr c string concatenation, parameters used in a constexpr context -

i exploring how far take constexpr char const* concatenation answer: constexpr concatenate 2 or more char strings i have following user code shows i'm trying do. seems compiler can't see function parameters (a , b) being passed in constexpr. can see way make 2 indicate don't work below, work? extremely convenient able combine character arrays through functions this. template<typename a, typename b> constexpr auto test1(a a, b b) { return concat(a, b); } constexpr auto test2(char const* a, char const* b) { return concat(a, b); } int main() { { // works auto constexpr text = concat("hi", " ", "there!"); std::cout << text.data(); } { // doesn't work auto constexpr text = test1("uh", " oh"); std::cout << text.data(); } { // doesn't work auto constexpr text = test2("uh", " oh"); std::cout << text.data(); } } live ...

ruby on rails - Can't install RMagick 2.16.0 -

* extconf.rb failed * not create makefile due reason, lack of necessary libraries and/or headers. check mkmf.log file more details. may need configuration options. had exact same problem. following fixed me, using ubuntu linux: sudo apt-get update ... sudo apt-get install libmagickcore-dev ... sudo apt-get install libmagickwand-dev ... bundle install you may have run bundle update if have other dependency issues, did. luck!

erlang - phoenix ecto like API when use unicode -

there player_data in table player names chinese. when use where ... #{name} doesn't work in chinese. these sql queries working in phpmyadmin client. don't know reason. iex(1)> ecto.adapters.sql.query(gamerepo, "select name player name '%de%'") [debug] query ok db=0.8ms select name player name '%de%' [] {:ok, %mariaex.result{columns: ["name"], command: :select, connection_id: nil, last_insert_id: nil, num_rows: 1, rows: [["冷面de仙女"]]}} iex(2)> ecto.adapters.sql.query(gamerepo, "select name player name '%冷%'") [debug] query ok db=1.2ms queue=0.1ms select name player name '%冷%' [] {:ok, %mariaex.result{columns: ["name"], command: :select, connection_id: nil, last_insert_id: nil, num_rows: 0, rows: []}}

c# - What does $ mean before a string? -

i going use verbatim string mistakenly typed $ instead of @ . but compiler didn't give me error , compiled successfully. i want know , does. searched couldn't find anything. however not verbatim string because can't write: string str = $"text\"; does know $ before string stand in c#. string str = $"text"; i'm using visual studio 2015 ctp. $ short-hand string.format , used string interpolations, new feature of c# 6. used in case, nothing, string.format() nothing. it comes own when used build strings reference other values. had written as: var anint = 1; var abool = true; var astring = "3"; var formated = string.format("{0},{1},{2}", anint, abool, astring); now becomes: var anint = 1; var abool = true; var astring = "3"; var formated = $"{anint},{abool},{astring}"; there's alternative - less known - form of string interpolation using $@ (the order of 2 symbols impor...

c# - Procedure or function sp_select_companydetails has too many arguments specified -

i depressed error function code correct still giving me error, trying select information sql server database. stored procedure: create procedure sp_select_companydetails @id varchar(5) begin select company_name, company_address companydetails end c# code: 2) on form button click event string id = "1"; cmd.commandtype = commandtype.storedprocedure; cmd.commandtext = "sp_select_companydetails"; cmd.parameters.add("@id", id); filldataset(); in class public dataset filldataset() { try { using (cmd) { dataset ds = new dataset(); cmd.connection = con; sqldataadapter da = new sqldataadapter(cmd); da.fill(ds); cmd.parameters.clear(); return ds; } } catch (exception) { throw; } } when click on form button error: procedure or function sp_select_companydetails has many arguments specified. suggest m...

python type function for dummy type -

this first time see following codes. dataset = type('dummy', (), {})() and print dataset in console tells me <__main__.dummy @ ox7feec5195e90> can me figure these codes mean?

javascript - safari is taking unknown file format while exporting html table to excelsheet -

i have issue. exporting html table data excel sheet .its not working in safari properly.its downloading unknown file format sheet. explaining code below. <div id="sites"> <table> <thead> <tr> <th>site</th> <th>address</th> </tr> </thead> <tbody> <tr> <td>oditek</td> <td>bhubaneswar</td> </tr> <tr> <td>khojakhoji</td> <td>cuttuck</td> </tr> </tbody> </table> </div> <input type="button" class="btn btn-success" id="savedata" value="export" style="margin-right:20px;" onclick="checkbrowser();" /> the javascript code given below. function checkbrowser(){ var url='data:application/vnd.ms-excel,'...

c# - How to avoid code duplication when writing DoStuff() and DoStuffAsync() method variants? -

i find need write lot of code synchronous , asynchronous method implementations when writing library functions. there way avoid without overhead? example implement async version , wrap in such way executes synchronously on current thread. i have an article on subject . my favorite approach - if sync , async both required - boolean argument hack. is, "core" method takes bool sync argument, , if it's true, guarantees returns already-completed task.

c# - Merge the values of multiple dictionaries into one list -

i want merge values of multiple dictionaries (3 exact) list. current solution uses linq first combine dictionaries , converts values list. private list<part> allparts() { return walls.concat(floors) .concat(columns) .todictionary(kvp => kvp.key, kvp => kvp.value) .values .tolist(); } merging lists first seems redundant. how can improve this? you can simplify code concatenating dictionaries , selecting values without converting dictionary: return walls.concat(floors) .concat(columns) .select(kvp => kvp.value) .tolist(); it looks shortest , readable solution. can avoid concatenating collections taking values only: return walls.values .concat(floors.values) .concat(columns.values) .tolist(); however, not see readability, maintainability or performance improvements here. p.s. assumed there no duplicates in dict...

r - "The DESCRIPTION file: This package was not yet installed at build time." -

in manual of created package, find under "details" sentences: the description file: package not yet installed @ build time." index: package not yet installed @ build time. this not sound good. of course, package has build @ first, can installed. don't understand message means , how can rid of it. when type message in google other pdf manuals same message. there cran packages message. message not tragedy? my built workflow (hope understood meant, @thomas) is: system("r cmd check path_to_package/pname") system("r cmd build path_to_package/pname") system("r cmd check --as-cran c:/r-3.2.2/pname_version.tar.gz") with option --as-cran got same messages here . deleted automatically generated commands e.g. \packagedescription{} in .rd files. notes thread these notes not appear more.

How to convert string to YAML in Ruby 2.3.0? -

i using delayed_job in application , showing info jobs. ability show id , priority attributes couldn't show handler details. in view, when try view details of job: <% @jobs.each |item| %> <% obj = yaml.load(item.to_yaml) %> <%= obj.inspect %> <% end %> when use inspect, getting details as: #<delayed::backend::activerecord::job id: 51, priority: 0, attempts: 0, handler: "--- !ruby/object:delayed::performablemailer\nobject...", last_error: nil, run_at: "2016-08-25 19:56:44", locked_at: nil, failed_at: nil, locked_by: nil, created_at: "2016-08-25 19:56:44", updated_at: "2016-08-25 19:56:44", queue: nil> now need method_name handler, this, inorder list details, used <%= obj.handler.inspect %> it gave: "--- !ruby/object:delayed::performablemailer\nobject: !ruby/class 'subscriptionnotifier'\nmethod_name: :welcome\nargs:\n- !ruby/object:user\n raw_attributes:\n del...

php - iReport send generated PDF report via email -

i'm using jasper report ireport 5.6.0 create dynamic reports company. integrated reporting tool php web application, it's working. created export options in html template , preview button in iframe i don't want put iframe in php variable , send email function. can generate report downloadable pdf, xls .. file, can send file automatically attachment email ? i'm using laravel framework, code generating , exporting report: use jasperphp\jasperphp; public function xmltopdf() { $output = public_path() . '/report/'.time().'_cancelack'; $output = public_path() . '/report/'.time().'_cancelack'; $ext = "pdf"; $data_file = public_path() . '/report/cancelack.xml'; $driver = 'xml'; $xml_xpath = '/cancelresponse/cancelresult/id'; \jasperphp::process( public_path() . '/report/cancelack.jrxml', $output, ...

admob - AdView not recognized in Android Studio -

i trying integrate admob in app, android studio can't find libraries: import com.google.android.gms.ads.adrequest; import com.google.android.gms.ads.adview; this top-level gradle: buildscript { repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle:2.1.2' classpath 'com.google.gms:google-services:3.0.0' // note: not place application dependencies here; belong // in individual module build.gradle files } } allprojects { repositories { jcenter() } } and project-level gradle: apply plugin: 'com.android.application' android { compilesdkversion 24 buildtoolsversion "24.0.1" defaultconfig { applicationid "com.tomhogenkamp.personalcalc" minsdkversion 16 targetsdkversion 24 versioncode 4 versionname "1.0" } buildtypes { release { minifyenabled false proguardfiles getdefaultproguardfile('proguard-android.txt'), 'prog...

swift - AVFoundation Framework and Mediaplyer Framework: Which is the best framework to play audio/video in iOS Application? -

i new ios. need implement both video , audio player in app. please advice me player suitable per developer point of view. choice: avplayer (avfoundation ) mpmovieplayercontroller(mediaplayer) you should use avplayer since mpmovieplayercontroller deprecated.

apache jena - Error 404: Not Found Fuseki -

this first time using apache jena fuseki 2.4.0 . i'm trying run friend's ontology website, said he's using apache jena fuseki need install first but, when installed , ran server , typed website on address bar, got error 404: error 404: not found fuseki - version 2.4.0 . here steps friend told me need follow. i downloaded apache jena fuseki 2.4.0 i unpacked directory c:\ i launched fuseki-server.bat i went http://localhost:3030/ i clicked manage datasets menu i clicked add new dataset button i typed "doid" dataset name , chose "persisten" dataset type , clicked create dataset i clicked upload data , selected doid.owl file, , clicked upload now when upload successful, ran friend's website , got error is there wrong or missing step took? please me. i don't know, works! tried follow set site : i downloaded jars , edited fuseki-server.bat i tried comment , uncomment line but, because couldn't launch fusek...

Using Header and BasicHeader with HttpUrlConnection in android -

in android 6.0 org.apache.http.legacy library deprecated, try migrate project use httpurlconnection . in project, used header , basicheader . didn't found how can replace these classes httpurlconnection . want know how can add header in request using httpurlconnection . url url=new url("yoururl"); httpurlconnection connection= (httpurlconnection) url.openconnection();//establishing connection url connection.setdooutput(true); connection.setrequestmethod("post");//method type connection.setrequestproperty("content-type","application/json");// setting headers

jquery - Owl carousel breaks -

i have searched solution, haven't found problem same mine... i have different sections on page, floating outside view, each section floats view if click on menu-link. the owl carousel 1 section...the problem is, when on home-section example , resize window. if let the slider-section float view, owl-carousel broken. if resize window again, carousel reloaded , works fine, if resize. $(".menu-btn").click(function(event) { var target = $(this).attr('href'); event.preventdefault(); $(".sectionid").removeclass("active"); $(target).addclass("active"); }); $("#owl-example").owlcarousel(); $(".slider").owlcarousel({ navigation: true, pagination: true, slidespeed: 1000, paginationspeed: 500, paginationnumbers: true, singleitem: true, autoplay: false, autoheight: false, animatein: 'slidein', animateout: 'slideout', afteraction: syncpositio...

Azure Point-to-site VPN routing -

i've set point-to-site vpn 1 of multiple vnets. when connect machine, can access vnet gateway belongs to. how can set routing, can access other vnets (having vnet-to-vnet gateways working)? you need set peering. set peering on existing real vnets allow peering vpn subnet. make sure allow traffic in nsg.

python 2.7 - Obtaining a pandas dataframe from a dict with tuples as keys -

i new python , have been struggling problem quite while. have dict this: dict1 = {(a,a) : 5, (a,b) :10, (a,c) : 11, (b,a): 4, (b,b) : 8, (b,c) : 3....} what convert pandas dataframe looks this: b c 5 10 11 b 4 8 3 c .. .. .. after create multiple bar plot in jupyter notebook. know can display data pandas series show following: dataset = pd.series(dict1) print dataset 5 b 10 c 11 b 4 b 8 c 3 c .. b .. c .. however, not able create multiple bar plot that. you're there, need unstack : dataset.unstack() i prefer use page reference, rather official documentation.

Javascript Array Random Got Zero -

i'm trying random number between 0 , array.length. have this: getrandom() { const cars = object.keys(this.index); const randomint = math.floor(math.random() * cars.length); return cars[randomint]; } i ran few times , found 0 in 1 of results getrandom() . there not key in this.index object named 0 . is math function wrong? update after reading comments, , know getrandom() not wrong. have reset() function if guys can @ it. reset() { const cars = object.keys(this.index); let = cars.length; while (i--) { this.index[cars[i]] = 0; } } is possible i'm adding new key 0 @ this.index object? i can't see actual problem here. object.keys turn named keys numbers (look here https://developer.mozilla.org/de/docs/web/javascript/reference/global_objects/object/keys ), numbers starts 0. so function, wrote yourselv, return an: random number between 0 , array.length

c# - DateTime Parse from PDT -

i have string contains date shown below string datetime = "18-aug-2016 12:02:44 pdt"; i want converted below format output = 2016-08-18t00:02:44-07:00 i tried below code, still need modify required output string mydate = datetime.replace("pdt", "-0700"); datetime dt = convert.todatetime(mydate); string datetime = "18-aug-2016 12:02:44 pdt"; string mydate = datetime.replace("pdt", "-0700"); datetime dt = convert.todatetime(mydate); console.writeline("the current date , time: {0:o}", dt); gives me following output: the current date , time: 2016-08-18t09:02:44.0000000+02:00

Creating a tagged union using F# Struct with Explicit LayoutKind -

i'm trying create f# equivalent of tagged union. need in hot path of application code, discriminated unions cause of heap allocations. here's example: [<struct; structlayout(layoutkind.explicit)>] type result = [<defaultvalue; fieldoffset 0>] val mutable isasync : bool [<defaultvalue; fieldoffset 1>] val mutable async : async<obj> [<defaultvalue; fieldoffset 1>] val mutable sync : obj however, problems start when want provide kind of creation methods it. example 1 static member async(a:async<obj>) = result(isasync = true; async=a) static member sync(s:obj) = result(isasync = false; sync=s) throws the member or object constructor 'result' takes 0 argument(s) here given 1. required signature 'result()' compilation error. example 2 new(a:async<obj>) = { isasync = true; async = a; } new(s:obj) = { isasync = false; sync=s } throws extraneous fields have been given val...

pandas - Cannot initialize python function -

i have (re)wrote back-test function in python using pandas def backtest(positions,price,initial_capital=10000): #creating protfolio portfolio =positions*price['price'] pos_diff=positions.diff() #creating holidings portfolio['holidings']=(positions*price['price'].sum(axis=1) portfolio['cash']=initial_capital-(pos_diff*price['price']).sum(axis=1).cumsum() #full account equity portfolio['total']=portfolio['cash']+ portfolio['holidings'] portfolio['return']=portfolio['total'].pct_change() return portfolio where positions , price both dataframe of 1 column , 5 column respectively . inorder checking error run function alone in python returning error file "", line 8 portfolio['cash']=initial_capital-(pos_diff*price['price']).sum(axis=1).cumsum() syntaxerror: invalid syntax missing trailing parenthesis on line before...

javascript - React Hot Module Reloader preventing mocha tests from running -

i have react project running react-transform-hmr hot module reloader, , running fine until implemented mocha tests. when run tests following error: throw new error('locals[0] not appear module object hot module ' + 'replacement api enabled. should disable react-transform-hmr in ' + 'production using env section in babel configuration. see ' + 'example in readme: https://github.com/gaearon/react-transform-hmr '); i have googled this, , found information mentioning moving hot module reloading setup out of .babelrc file , webpack config, did, , tests ran fine, hot module reloading wasn't working. after playing around, , not getting both work together, have reverted , thought ask stuck. ideas can do? my babel config follows: { "presets": ["react", "es2015", "stage-1"], "env": { "development": { "plugins": [ ["transform-object-re...

c# - Is there a more efficient way to write this code -

i think title says all, here's code :) private void listboxcomponents_mousedoubleclick(object sender, mouseeventargs e) { object item = listboxcomponents.selecteditem; string name = listboxcomponents.getitemtext(item); if (e.button == mousebuttons.left) { (int = 0; < terrains.count; i++) { if (terrains[i].name == name) terrains[i].enableboundingbox(true); else terrains[i].enableboundingbox(false); } } } i have allot of code throughout quite similar , i'm hoping theirs neater, quicker way acoomplish same thing. maybe linq? thanks :). you have not stated mean "more efficient", take liberty interpret "easier read , type": you can replace loop: for (int = 0; < terrains.count; i++) { if (terrains[i].name == name) terrains[i].enableboundingbox(true); else t...

mime - how could I recognize an email as auto-forward email? -

i have task needs me find out auto-forward email email set. recoginize email sender contains "caf_|auto_" , "+" , "_" auto-forward email,for example "test3128+caf_=test3128=yahoo.com@gmail.com". finallly find above-mentioned feature not right.because email may auto-forward or auto-reply email. give me help?you have thanks.

java - How to Filter/Extract Code from SMS (Android) -

so i'm working on whatsapp verification system user inputs code received via sms , code sent server..yada yada ..all basic stuff. my dilemma have received , read sms correctly. how filter body that passes number (not phone number verification code) edittext automatically. i'm trying avoid users having enter verification code manually. lemme show code below. public void processreceive(context context, intent intent){ bundle bundle = intent.getextras(); if(bundle == null){ return; } object[] objectarray = (object[])bundle.get("pdus"); for(int = 0; < objectarray.length; i++){ smsmessage smsmsg = smsmessage.createfrompdu((byte[])objectarray[i]); string smsbody = smsmsg.getmessagebody(); toast.maketext(context, smsbody, toast.length_short).show(); } } //in code above, broadcastreceiver receives sms , can display body in toast. sms goes this: "your verification code: 12345". how code sms ,...

Enable compression and caching of SVG files in .htaccess file -

when analyze website google pagespeed insight, should fix problems regarding compression of svg files. i've been looking around web trying find solution on problem, no matter doesn't seem work, therefor i'm asking guys. i've checked if gzip enabled through multiple tools on web, , seem true. so far got in .htaccess file. rewriteengine on options followsymlinks rewritebase / rewritecond %{request_filename} !-d rewritecond %{request_filename} !-f rewriterule ^(.*)$ /#/$1 [l] addtype image/svg+xml svg svgz addencoding gzip svgz ## expires caching ## <ifmodule mod_expires.c> expiresactive on expiresbytype image/jpg "access 1 month" expiresbytype image/jpeg "access 1 month" expiresbytype image/gif "access 1 month" expiresbytype image/png "access 1 month" expiresbytype text/css "access 1 week" expiresbytype text/html "access 1 day" expiresbytype application...

java - Can we use sikuli for automation of http pop up? -

i using selenium automation of web application . getting http login (asking username , password) pop ups on web pages during automation. , using sikuli automate pop ups. using following code it: private void loginwithsikuliinfirefox(){ try{ screen screen=new screen(); pattern image1=new pattern("pictures/uname.png"); pattern image2=new pattern("pictures/passwrd.png"); pattern image3=new pattern("pictures/ok1.png"); screen.wait(image1,10); screen.type(image1,username); screen.type(image2,password); screen.click(image3); } catch(exception e){ system.out.println("there no alert"); } } private void loginwithsikuliinchrome(){ try{ screen screen=new screen(); pattern image1=new pattern("pictures/username.png"); pattern image2=new pattern("pictures/password.png"); pattern image3=new pattern(...

java - How to grow Labels within a VBox -

Image
i got following setup: label errorlabel = new label("hello hans"); label warninglabel = new label("heeelllooooooooooooooooooooooooo"); vbox box = new vbox(); box.getchildren().addall(errorlabel, warninglabel); tooltip t = new tooltip(); t.setgraphic(box); t.show(); my problem is, warninglabel , errorlabel have different sizes. should both grow same size horizontally. don't want put specific size. size of both must whichever label needs more display whole text. the problem is, both labels have background , can see warninglabel takes more space. need both backgrounds of label grow equally. you can set maxwidthproperty double.max_value in case of both label s. label errorlabel = new label("hello hans"); errorlabel.setstyle("-fx-background-color: red"); label warninglabel = new label("heeelllooooooooooooooooooooooooo"); warninglabel.setstyle("-fx-background-color: orange"); warninglabel.setmaxwidth(dou...

actionscript 3 - vertical scrollbar issue in list item render in flex3 -

i have hbox in title window, in hbox using list itemrenderer. list of items displaying along scrollbar, problem 2 scrollers displaying in scrollbar. when mouse move on scroll bar 1 hidden , working properly. how resolve issue please me.thanksin advance. my code is abc.mxml <?xml version="1.0" encoding="utf-8"?> <mx:titlewindow xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" width="400" height="300" showclosebutton="false" title="select"> <mx:hbox width="100%" height="100%" > <mx:list id="vehicletypelist" width="50%" height="100%" dataprovider="{typelist}" itemrenderer="{new classfactory(myitemrenderer)}"/> </mx:hbox> <mx:button id="btnok" label="ok"/> <mx:button id="btncancel" label="cancel" c/> ...

c# - Extending a Separator (Deriving from) -

i have implement custom separator , few custom properties (the main 1 header ): public class headeredseparator : separator { //more properties here... headerforeground , separatorheight. public static readonly dependencyproperty headerproperty = dependencyproperty.register("header", typeof(string), typeof(headeredseparator)); [bindable(true), category("common")] public string header { { return (string)getvalue(headerproperty); } set { setvalue(headerproperty, value); } } static headeredseparator() { defaultstylekeyproperty.overridemetadata(typeof(headeredseparator), new frameworkpropertymetadata(typeof(headeredseparator))); } } and style (inside themes\generic.xaml): <style x:key="{x:static menuitem.separatorstylekey}" targettype="{x:type c:headeredseparator}"> <setter property="isenabled" value="false"/> <setter property="heig...

How to get result of select query for parameterized stored procedure into a single file using Jmeter -

i having query. i having stored procedure.i want run using jmeter parameterization. {call ssp_devx_clientinvoicenewtabreport (?,?,?,?,?,?,?,?)} //till here able it. now want fire 1 select query after parameterization. query select top 1 d.object_id, d.database_id,object_name(object_id,database_id) 'proc name', d.cached_time,d.last_execution_time, d.total_elapsed_time, (d.total_elapsed_time/d.execution_count)/1000 as[avg_elapsed_time], d.last_elapsed_time/1000 last_elapsed_time,d.execution_count, *from sys.dm_exec_procedure_stats d object_name(object_id,database_id)='ssp_devx_clientinvoicenewtabreport' order d.last_execution_time desc // added jdbc request. the select query gives me lots of records.i want fetch few records last_elapsed_time , "total_worker_time" each set of parameterized data , entire result want save single file. i have added file listeners , graph listeners each parameterized dataset, giving...

mysql - How can I limit INNER JOIN? -

hi there way limit inner join? so can limit output return last 5 match_ids? select t.id , ff.match_id , ff.time football_teams t join ( select match_id , hometeam_id , time football_fixtures order time desc limit 5 ) ff on ff.hometeam_id = t.id t.id in ( ".$team_id_string." ) order t.id i watch return array something array([football_team.id] = array(match_id[1],match_id[2],match_id[3],match_id[4],match_id[5],)) matt by comments, assume 5 newest records in football_fixtures table doesn't match other criteria in query, therefore - doesn't return anything. i'd suggest put limit in outer query make sure 5 records being selected : select s.* (select football_teams.id, ff.match_id, ff.time football_teams inner join football_fixtures ff on hometeam_id=football_teams.id football_...

erlang - How to run Elixir from a thumb drive and without batch file launchers? -

i have erlang , elixir installed on thumb drive. launcher elixir windows batch file rather standalone executable. one of computers use regularly school blocks command prompt, erlang runs without command prompt, able use erlang on school computer. i wondering if run elixir manually or potentially powershell, code @ school. if @ the bottom of batch file you'll see elixir.bat building argument string use when invoking erlang executable. can build argument string hand, , if launch erlang correctly you'll in elixir-land. alternatively, if can run executable, maybe should try putting copy of powershell on thumb drive.

android studio - Is their a "region-like" folding feature for xml editors -

Image
i'm developing on android studio , others ide, android studio has feature create "regions" in java code can folded. (see below) with kind of code //region initialization private int myvaribale; private string othervariblae; //endregion we can fold/unfold code (see screenshots below). is similar xml editors (specially 1 in android studio) ? something can add example : <!-- region layouts --> <relativelayout> //some layouts </relativelayout> <!-- endregion --> android studio's xml editor supports folding on ide level cmd+alt+"+" or "-" .