Posts

Showing posts from May, 2015

javascript - Mapping a JSON response to component model in TypeScript. -

i have angular 2 app returns json string. want take json string , map values model. from understanding, typescript model file supposed in mapping http response object - in case class classed 'customobject'. here's typescript model file created typescript recognize: export class customobject { public name: string; } here's json string looks (slightly modified chrome dev tools eliminate unnecessary variables): "{ "eventtype": 3, "description": "test description", "locationname": "defaultlocation", "name": "testname" }" i want take json string , map 'name' value ("testname" existing customobject's variable have declared in home.ts file null default: public activecustomobject: customobject = null; however, after executing http method retrieve json response (i expect variable 'activecustomobject' 'name' field set 'testnam

java - JSP error at line 31 -

when running jsp page drops me error , suggestion in order fix , (i know jsp java not good)... type exception report message exception occurred processing jsp page /assets/jsp/create-dest-code.jsp @ line 31 description server encountered internal error prevented fulfilling request. exception org.apache.jasper.jasperexception: exception occurred processing jsp page /assets/jsp/create-dest-code.jsp @ line 31 28: if(id > -1) 29: { 30: int insert_ch; 31: for(int i=0;i insert_ch=mystatement.executeupdate("insert dest_has_categories (dest_iddest,categories_idcategories) values ('"+id+"','"+cat[i]+"')"); 34: } stacktrace: org.apache.jasper.servlet.jspservletwrapper.handlejspexception(jspservletwrapper.java:574) org.apache.jasper.servlet.jspservletwrapper.service(jspservletwrapper.java:476) org.apache.jasper.servlet.jspservlet.servicejspfile(jspservlet.java:396) or

solr - SolrCloud with SSL and Basic Authentication -

is possible configure solrcloud ssl , basic authentication? i have configured 3 nodes of solr in solrcloud ssl using this: https://cwiki.apache.org/confluence/display/solr/enabling+ssl and have added authentication , authorization following this: https://cwiki.apache.org/confluence/display/solr/basic+authentication+plugin , https://cwiki.apache.org/confluence/display/solr/rule-based+authorization+plugin when ssl enabled works. when authentication + authorization enabled works when both enabled following stacktrace during startup: 2016-06-01 17:19:41.933 info (overseerstateupdate-168013962670440512-172.30.92.66:8983_solr-n_0000000079) [ ] o.a.s.c.o.zkstatewriter going update_collection /collections/testowa/state.json version: 1350 2016-06-01 17:19:41.935 info (zkcallback-4-thread-1-processing-n:172.30.92.66:8983_solr) [ ] o.a.s.c.c.zkstatereader cluster state change: [watchedevent state:syncconnected type:nodedatachanged path:/collections/testowa/state.json] collec

c1 cms - Composite C1 - Adding secondary navigation -

i enjoying composite c1 cms - though having problems finding many tutorials. i need pages have secondary navigation. i using composite.community.blog - working. shows preview of blog posts & click details. instead subnavigation on left. when users click blog post they're taken item. what code need blog navigation - , general secondary navigation on other pages? also, tutorials or comprehensive sample sites (using blog bonus) can recommend download anywhere helpful (ones on composite site basic). thanks. niico, 1) have secondary navigation please use composite.navigation.distributed package (you need level parameter). please read documentation package here 2) demo sites automatically install during composite c1 4.0 install. can check demo site blog online here http://demo.c1.composite.net have custom blog navigation here can create own version of blog renderer function. find full blog source there.

c# - Group by date-part (dd.mm.yyyy) -

i've got list of objects datetime-property. struggle in getting json-string in following form of it: [{"date":17.08.2013,"count":8},{"day":18.08.2013,"count":10}] this var results = in db.stalkings group new { d = a.begin.day } g select new { day = g.key.d, count = g.count() }; return json( results, jsonrequestbehavior.allowget); results in [{"day":17,"count":8},{"day":18,"count":10}]. , this var results1 = in db.stalkings group entityfunctions.truncatetime(a.begin) g select new { day = g.key, count = g.count() }; return json( results, jsonrequestbehavior.allowget); results in [{"day":"/date(1376690400000)/","count":8},{"day":"/date(1376776800000)/","count"

javascript - IcCube - accessing a chart at runtime -

we write piece of (javascript-)code, automatically runs in every report , manipulates of our charts. doing add tooltips descriptions of our measures , dimensions , rename of measures. easiest way probably, have our code manipulate mdx-queries before first load. is - or similar - possible iccube?

ios - Storyboard assistant editor for a ViewController opens <projectName>-Swift.h instead of <viewController>.swift -

Image
i have programmatic swift project i'm converting storyboards. particular interaction grinding gears. when click on view controller myviewcontroller in storyboard, assistant editor opens myprojectname-swift.h instead myviewcontroller.swift i know can click on nav bar of assistant editor , select vc automatic drop down list adding more actions every time switch vcs in storyboard. when set class match view controller, usually assistant editor open right file. this how select class: select view controller in storyboard open identity inspector select class list

c# - Move tables from one project to another in google big query -

in our project, have move tables 1 pro as our company grows, @ point realized need copy tables 1 one through api , delete old ones. when comes on hundreds of tables, it's consumes lot of time copying api executed job , takes time. i wonder there way in sql or c# achieve this? suggestions appreciated. copying table (and optionally deleting original) best way move data 1 project another. can run many copy jobs in parallel speed things up. you mentioned sql , c# alternatives: sql : run select * query, you'd pay scan data, , wouldn't faster. (a query job has higher parallelism copy job, way more work, because reads , writes data instead of copying @ file system layer, it's hard predict 1 faster.) c# : doesn't matter language you're using--you're welcome write code against our api language using appropriate client library . not have access functionality--you still have run query jobs or copy jobs move data.

xml - Android: How to make textview visible with padding -

Image
i want create , have used drawable along textview in it: but not getting textview in center nor whole text visible due padding. how make changes existing code this. don't want image , text , buttons. rounded_edge.xml <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" > <solid android:color="#ffffff"/> <stroke android:width="5dp" android:color="#000000"/> <!--<padding android:left="30dp" android:top="350dp" android:right="250dp" android:bottom="10dp"/>--> <gradient android:startcolor="#d2e0e2" android:endcolor="#d2e0e2"/> <corners android:bottomrightradius="5dp" android:bottomleftradius="5dp"

php - Not getting an AJAX response -

i'm new ajax found tutorial , hacked fit php code. it's "like" button tutorial , inside of code works okay adding "like" count total database. the problem once click "like", number of likes doesn't update (on page). the original tutorial code works fine, did stupid. here's code index.php function cwrating(id,type,target){ $.ajax({ type:'post', url:'rating.php', data:'bt_id='+id+'&type='+type, success:function(msg){ if(msg == 'err'){ alert('some problem occured, please try again.'); }else{ $('#'+target).html(msg); } } }); } and spot shows , count: <span class="like" onclick="cwrating(<?php echo $row_bt['bt_id']; ?>,1,'like_count<?php echo $row_bt['bt_id']; ?>')"></span> <span class="counter" id="like_count<?php

matlab - Lag in time series regression using LibSVM -

Image
i use libsvm in matlab examine utility of svm regression time series prediction. use following code sample: t = -10:0.1:10; x = 2*sin(10*t)+0.5*t.^2+4; x = (x - min(x)) / (max(x) - min(x)); x = x'; data = x(1:end-1); datalabels = x(2:end); traindatalength = round(length(data)*70/100); trainingset = data(1:traindatalength); trainingsetlabels = datalabels(1:traindatalength); testset = data(traindatalength+1:end); testsetlabels = datalabels(traindatalength+1:end); options = ' -s 3 -t 2 -c 100 -p 0.001 -h 0'; model = svmtrain(trainingsetlabels, trainingset, options); [predicted_label, accuracy, decision_values] = svmpredict(testsetlabels, testset, model); figure(2); plot(1:length(testsetlabels), testsetlabels, '-b'); hold on; plot(1:length(testsetlabels), predicted_label, '-r'); hold off; and figure is: from figure can seen there lag in predicted values vs. actual values. don't know if lag because

html - Tie into javascript load event for img tags -

i following tutorial ( https://codelabs.developers.google.com/codelabs/performance-analytics ). the gist of happening on img load timing mark logged, don't want add onload img tags our entire website. ruled out jquery because measuring performance , not want wait jquery library load because interfere timing measurements. therefore prefer use javascript. pretty after functionality of jquery script. $('img').load(alert('performance marking event, img loaded')); this allow me leave img tags alone , insert script should relatively not affect timing on when img tags loaded. devin just record, method went following example in: javascript callback knowing when image loaded devin var imgs = document.getelementsbytagname('img'); for(i = 0; i< imgs.length; i++) { attachmyloadevent(imgs[i]); } function attachmyloadevent(img) { img.onload = function(){console.log('img loaded: ' + img.src);}; }

firefox - How to recover deleted project from firebase console -

i imported project using import google project in firebase console. deleted permanently thinking again import it. when click import, project not coming in list. kindly me set it. in advance! there period of 30 days, during deleted projects can recovered. to recover project click here . go bottom left , click on pending deletion link recover deleted project. click on checkbox select project click on restore.

Why is MarkLogic Admin Page showing an EvtSocketConnected Message? -

my localhost marklogic admin page ( http://localhost:8001 ) not rendering. the web page shows following xml instead. <evtsocketconnected xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:xsd="http://www.w3.org/2001/xmlschema"> <returncode>0</returncode> </evtsocketconnected> i assume message happening because server busy merging/balancing forests i'm not sure. is else getting message? could marklogic engineering team provide more info on this? i'm running marklogic version 8.0-5.2 i have seen similar response on port when cisco jabber im client running.

jquery - DOM elements and the order in which javascript reads them -

this question has answer here: window.onload vs $(document).ready() 13 answers overview: i'm creating dom elements via javascript , trying access them. problem don't exist in dom (or that's way read it.) function init(){ pagination(); } window.onload = init; in pagination make create dom element called "more" var more='<div id="more" class="box move"> > </div>'; this, along other elements displayed in "elements" section of console log. sweet. it's in dom isn't (no). i tried call div jquery unable to. checked see existed. not. console.log($("#more").length); i made dummy div in html see if jquery working. checked it's length , yup there. $(document).ready(function(){ console.log($("#aaa").length); // returns 1 console.log($("#mo

javascript - How to include js files in header of wordpress pages that are activated on-click -

i attempting use wordpress build website integrates google maps. doing overlays maps , use google developers api , python make appropriate javascript. have written js files , python necessary accomplish this. my website built in worpress , add page (not home page) has n links , each 1 populate box corresponding map. can take care of layout , design issues @ loss on how to: a) include javascript file b) gets called upon clicking link , populates map without calling new page that is, javascript huge because may include thousands of lat/lon points. therefore including n of these written header unreasonable. want call filename.js when link clicked. there plugin allows me include whatever want in header. so, if can find out put *.js files (or txt file) in directory tree , how have corresponding file activated upon click should good. thanks! this display different maps onclick event - google maps v3. kind of helps doing on-click display everyone's solution make 1 map.

java - private static throughout code -

i on new project, , legacy java code filled classes using mix of private static methods, , public static methods. it's hard follow. for example: public car { private static checkgas(){ .. } public static startcar(){ checkgas(); } } is there design pattern never heard of make applicable? i've used public static methods on "helper" classes not need util.caculate(..) , , in above "car" example wouldn't have use private static or public static methods... private , public methods. you want limit access tightly possible, if have utility class public static methods , static helper methods call, helper methods should private. this not fundamentally different writing non-static private helper methods support non-static public methods. i wouldn't call design pattern, general practice. don't make things public unless have to. once method public, can't modify signature without breaking uses it

ms word - VBA: Range.Find nested in another Range.Find -

in code, i'm splitting word document many using range.find select body of text (startoftext*endoftext) , saving it. within selected body of text, i'm trying use nested 'range.find' call search selected body of text bolded header , use saveas[filename]. with current code, works except nested range.text returns text within initial set range. sub docsplitter() dim r range dim inr range set r = activedocument.range.duplicate dim name string application.screenupdating = false r.find .text = "^m*^l^t^l" ' <- copies text ^m "^l^t^l" .matchwildcards = true while .execute set inr = r.duplicate '<- setting range equal selected text range inr.find .format = true .font.bold = true .text = "^13([0-9]).([0-9])*^13^13" '<- selecting header within .matchwildcards = true .execute end copyandsave r, inr wend end r.coll

css - How to understand the following quote? -

according [w3][1], an element in normal flow establishes new block formatting context (such element 'overflow' other 'visible') must not overlap margin box of floats in same block formatting context element itself. you edited out critical bit quote. quote should the border box of table, block-level replaced element, or element in normal flow establishes new block formatting context (such element 'overflow' other 'visible') must not overlap margin box of floats in same block formatting context element itself. it's border box of bfc must not overlap. margin box of bfc not restricted.

jquery - kendo grid can't show number record -

""" kendo ui grid """ my grid can't show number record , total page , next page grid footer show "no items display" prev , next symbol << < 0 > >> i put pageable or pagesize why don't show t_t please me !!! var datasourceuser = new kendo.data.datasource({ transport: { read: "adminuser.php?action=view", destroy: { url: function (options) { $.ajax( { type: 'post', url: 'adminuser.php?action=delete', data: { userid: options.userid },

angular - Separating data from the component -

so trying learn angular 2 , reading documentation , saw found here : we defining our data directly inside our component. that's fine demo isn't best practice. it's not practice. although won't in chapter, we'll make mental note fix down road. my question best practice place data? read farther documentation , wasn't clear. guess in service of component? dynamic data should loaded via services. if have static data can place in mock file. here example tour of heroes (you reach point later).

c# - MVC 5: ViewModel / Passing lists for the create -

Image
so studying , analyzing use of viewmodels. in application (a called "restaurant") want ability "users" create menu. when want create menu: can choose name + amount of persons can join menu. also, can add amount of dishes in restaurant. in style of checkboxes , 'create'-button @ end. this means had use viewmodel. trying give possibility add list of dishes menu creation. i'm stuck @ loop, used loop through dishes. or better, i'm stuck @ whole concept: what best way display created dishes createmenu view? still possible loop through viewbag if add them in viewbag? lets tried wanted do. how create new menu based (or extracted?) viewmodel? in code, please note menu - model cannot changed because use list of dishes (in view, display menu's , dishes). also ignore possibility of wrong names or spelling mistakes in data, since translated flemish models public class menu { [key] public int id { get; set; } [required]

create table - SQL Interview: Prevent overlapping date range -

say there appointment_booking table list of managers (or hrs) startdatetime , enddatetime, how 1 design table such doesn't accept next entry overlaps same manager if he/she has appointment other person. if manager: has appointment 2016-01-01 11:00 2016-01-01 14:00 employee-1 if employee-2 (or someother employee) tries book appointment 20-16-01-01 13:00 16:00 shouldn't allow. note: designing table, triggers/procedures isn't encouraged. instead of inserting ranges, insert slices of time. make slices wide want, pretend can book manager 30 minutes @ time. book 11:30 12:00, you'd insert row time value @ 11:30. book 11:30 12:30, you'd insert 2 rows, 1 @ 11:30, other @ 12:00. can use primary key constraint or unique constraint prevent on booking. create table appointment_booking ( manager char not null, startslice datetime, visiting_employee varchar2(255), primary key (manager, startslice) ) i know doesn't fit premise of t

javascript - svg to canvas image in jspdf - I Get a black content -

i've used jspdf convert svg image canvas , pdf the plugins i've used are <script type="text/javascript" src="assets/js/jquery.js"></script> <script type="text/javascript" src="assets/js/jspdf.js"></script> <script type="text/javascript" src="assets/js/html2canvas.js"></script> <script type="text/javascript" src="assets/js/html2canvas.svg.js"></script> <script type="text/javascript" src="assets/js/canvg.js"></script> my html code svg <a href="javascript:genpdf();">genpdf</a> <svg class="bullet" width="416" height="50"> <g transform="translate(75,5)"> <rect class="range s0" width="301" height="25" x="0"/> <rect class="range s1"

c# - Cannot find firefox binary in PATH - Setting environment Path doesn't work -

i had problem saying cannot find firefox binary in path has solutions many times on site. found adding specific in code (different ways) 1 path. adding firefox path in code works fine, need execute on many machines have differents paths... setting in path system environment variable doesn't seem work. how had in way specific every machine? note: switched beween firefox 42 , firefox 46... , happen. there reason why did happen when doing same thing dozens of time worked fine? firefox executable in linux calls firefox.sh file. 1 workaround following: locate firefox.sh|sh

runtime - Cannot run program "pandoc": error=2, No such file or directory -

i trying use pandoc create pdf .md file in processing sketch using method below: string[] command = {"pandoc", "-s", "-o", pdfname, "newfilename"}; runtime rt = runtime.getruntime(); process p = rt.exec(command); (where pdfname string), getting following error: java.io.ioexception: cannot run program "pandoc": error=2, no such file or directory when run pandoc terminal have not problems, not sure going wrong here.

Apache Camel: Response is get lost when reached explicitly on route -

i getting strange situation @ code below routes request google , returns response. it works when activate line commented out "//activating line causes empty response on browser" print out returned response http endpoint (google), response disappear, nothing displayed on browser. thought might related input stream of http response can consumed once , activated stream caching on context nothing changed. apache camel version 2.11.0 any suggestions appreciated, in advance. public class googlecaller { public static void main(string[] args) throws exception { camelcontext context = new defaultcamelcontext(); context.addroutes(new routebuilder() { public void configure() { from("jetty:http://0.0.0.0:8081/myapp/") .to("jetty://http://www.google.com?bridgeendpoint=true&throwexceptiononfailure=false") .process(new processor() {

mercurial - Hg Repo with Git and Hg Remotes -

i taking class has read-only git repository. want clone hg repo. however, since can't push repo, want push repo in bitbucket local changes, still pull down changes git repo. know can clone git repo hg-git, want hg except read-only git remote class. thanks! just have 2 paths defined in project's .hgrc git's path appear automatically, when you'll clone repo. hg's url have add hand with up-to-date mercurial can have 2 different configs (and resulting commands) default = git+url/of/git hg = url/of/hg means using hg pull + hg push hg default = git+url/of/git default:pushurl = url/of/hg means using plain hg pull + hg push , push happen anyway mercurial-repo

c# - How do I use reflection to call a generic method? -

what's best way call generic method when type parameter isn't known @ compile time, instead obtained dynamically @ runtime? consider following sample code - inside example() method, what's concise way invoke genericmethod<t>() using type stored in mytype variable? public class sample { public void example(string typename) { type mytype = findtype(typename); // goes here call genericmethod<t>()? genericmethod<mytype>(); // doesn't work // changes call staticmethod<t>()? sample.staticmethod<mytype>(); // doesn't work } public void genericmethod<t>() { // ... } public static void staticmethod<t>() { //... } } you need use reflection method start with, "construct" supplying type arguments makegenericmethod : methodinfo method = typeof(sample).getmethod("genericmethod"); methodinfo generic = m

Why my infoWindow on Google Maps Javascript API doesn't work? -

i want learn embeded maps in web app. want basic feature add multiple marker, costum marker, costum infowindow,etc. have done untill add costum marker. when want set infowindow each marker, it's still not work, can me solution? thanks... here code : <!doctype html> <html> <head> <title>styling base map</title> <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no"> <meta charset="utf-8"> <style> html, body, #map { margin: 0; padding: 0; height: 100%; } #legend { font-family: arial, sans-serif; background: #fff; padding: 10px; margin: 10px; border: 3px solid #000; } #legend h3 { margin-top: 0; } #legend img { vertical-align: middle; } </style> <script> var map; function initialize() { map = new google.maps.map(document.getelementbyid('map'), { zoom: 18, center: new google