Posts

Showing posts from September, 2013

java - TomEE pluME with JSF 2.2 ConfigurationException -

when start tomee deploy project. errors. i using jsf 2.2, apache-tomee-7.0.0-m3-plume, , primefaces latest version. i searched didn't find solution. tomee errors com.sun.faces.config.configurationexception: **factory 'javax.faces.lifecycle.clientwindowfactory' not configured properly.** @ com.sun.faces.config.processor.factoryconfigprocessor.verifyfactoriesexist(factoryconfigprocessor.java:330) @ com.sun.faces.config.processor.factoryconfigprocessor.process(factoryconfigprocessor.java:236) @ com.sun.faces.config.configmanager.initialize(configmanager.java:439) @ com.sun.faces.config.configurelistener.contextinitialized(configurelistener.java:227) @ org.apache.catalina.core.standardcontext.listenerstart(standardcontext.java:4812) @ org.apache.catalina.core.standardcontext.startinternal(standardcontext.java:5255) @ org.apache.catalina.util.lifecyclebase.start(lifecyclebase.java:147) @ org.apache.catalina.core.containerbase$startchil

javascript - How to execute if conditional just once -

i wondering me how that, because time variable returns default value. it's ibeacon application, don't know if need show more details app. want call function once, can me? function uint8arrtohexstringnospace(arr) { return array.prototype.map.call(arr, function(n) { var s = n.tostring(16); if(s.length == 1) { s = '0'+s; } return s; }).join(''); } var quit; function something() { if(quit) { window.open("info.html"); } quit = true; } function appendtd(root, value, id) { var text = document.createtextnode(value); var td = document.createelement("p"); if(id) { td.id = id; } td.appendchild(text); root.appendchild(td); } function hex16(i) { var s = i.tostring(16); while(s.length < 4) { s = '0'+s; } return s; } var beacons = {}; var app = { initialize: function() { // important stop scanning when page reloads/closes! window

How to add new custom font icons in ionic2 -

im beginner in using ionic2 , im having hard time in adding new custom font icons. can me? or send link of tutorial follow? of in researching can see tutorials ionic 1 using gulp. there other easy way ionic2? have generated font icons icomoon. thanks! appreciate it you can add icomoon icons following below steps copy icomoon style.css file www/build/css folder. copy icomoon fonts files (.eot, .svg, .ttf, .woff) www/build/fonts folder. open style.css file , edit url path correct font path. (may have include ../fonts match fonts directory). use double-quotes instead of single-quotes in url , format. open index.html file , include <link href="build/css/style.css" rel="stylesheet"> open html file , include icon @ required place as <span class="icon-quill"></span>

How can I fix this error in asp.net mvc -

inside index.cshtml , have dropdownlist populated data. on selection of dropdownlist item, loading partial views using ajax . these partial views forms, when filled, data inserted database. after insertion, want go index.cshtml has populated dropdownlist initially, doesn't work , gives error: an exception of type 'system.invalidoperationexception' occurred in system.web.mvc.dll not handled in user code additional information: there no viewdata item of type 'ienumerable' has key 'templatescategory'. here controller ---- public class templatecontroller : controller { pulsecontext db = new pulsecontext(); public actionresult index() { viewbag.templatescategory = new selectlist(db.templates, "id", "templatename"); return view(); } [httpget] public partialviewresult clothing() { return partialview("_clothingtemplate&q

I want to develop a android sdk for our clients to use,how to ensure that only the client who apply for an APP_KEY can use my sdk? -

developers or clients want use skd should go website apply app_key.to apply app_key,they should offer app's package name ,something "com.edward.myapp".also sha-1 of developers's certificate(generated keytool) . can send app_key server verify app_key,the thing know app_key valid or invalid.but don't know if clients' app,it can else's app,and can package name.i don't want happen. how can verify ensure right app use sdk? your sdk @ runtime can obtain sha1 of certificate used sign apk. string getsignaturesha1(context context) { packagemanager pm = context.getpackagemanager(); packageinfo info = null; try { info = pm.getpackageinfo(context.getpackagename(), packagemanager.get_signatures); } catch (namenotfoundexception e) { log.e(tag, "could not find info " + context.getpackagename()); return null; } byte[] signaturebytes = info.signatures[0].tobytearray(); messagedigest md = mess

Why doesn't opencv give this rectangle a colour using python's cv2 -

Image
the following code draws white rectangle. not supposed that. considering opencv uses bgr colorspace, should http://www.colorpicker.com/?colorcode=9f635f import cv2 import numpy np drawing = np.zeros([500, 500, 3]) cv2.rectangle(drawing, (0, 0), (250, 250), (95, 99, 159), -1) cv2.imshow("drawing", drawing) cv2.waitkey() it draw fine if change drawing = np.zeros([500, 500, 3]) to drawing = np.zeros([500, 500, 3], np.uint8) otherwise, image of 32f type.

sql server - SQL pivot - trying to convert first row to columns -

i have data imported csv file looks this: name field year01 year02 ... year10 ----------------------------------------------- name fieldname 2006 2007 ... 2015 xyz field_a 123 999 222 xyz field_b 111.1 123.4 456.7 abc field_a 444 555 890 abc field_b 999.9 888.8 789.0 which need this: name year field_a field_b ----------------------------------------------- xyz 2006 123 111.1 xyz 2007 999 123.4 xyz 2015 222 456.7 ... abc 2006 444 999.9 abc 2007 555 888.8 abc 2015 890 789.0 i'm sure there's way using pivot instruction can't seem make work. how can achieve this? pivot unpivot table. steps: rename table columns unpivot year pivot field complete query: t1 ( select * (values ('name', 'fieldname', 2006, 2007, 2015), (&

c# - Firebase Android: Child JSON array not being serialized properly on Android 4.2.2 -

i serializing party object looks this: public class party { public long lastping; public string id; public int ownerid; public list<partyplayer> players; public int status; public long created; public long lastserverupdate; public int balance; public int size; public partycharacter character; public string mmcid; } normally, formatted json object (look @ players object, regular object array): {"id":"key_test","players":[{"character":{"level":9,"visibleitems":[4,0,0],"id":970,"experience":54000,"type":1,"visibleskills":[1,2,3]},"name":"wizard428","lastping":1461555298086,"id":428}]} however, when run same code on android 4.2.2, players object not valid json array, instead, array serialized giant string: {"id":"key_test","players":"[{id=467, lastping=14

sql - Mysql: How to optimize this query. for faster results -

how optimize query, faster result tooks 80+ seconds on 10 million rows. su_id , admin_id both btree indexed select su_id members_ext admin_id = 5962789 both int data types, btree index cardinality of su_id 8496470 , admin_id 10437 explain result id ,select_type,table ,type,rows, 1, simple ,members_ext , ,8496471 ,using make combined key on admin_id, su_id, data can fetched index only.

android - Video gallery with expandablelistview parent horizontal scrollview child -

trying implement video gallery horizontal scrollview children inside expandablelistview. problem facing - instead of showing n number of children of group in horizontal list view, duplicate of first child created n times horizontally. here code this activity fetches videos saved in particular folder (photography) in sd-card. checks videos inside subfolders(here crane,helicam,montage,multi) , put in different categories in expandablelistview groups public class expandablelistactivity extends activity { list<string> grouplist; list<string> childlist; map<string, list<string>> collection; expandablelistview explistview; expandablelistadapters explistadapter; public static final string doc_folder_name = "/photography/"; //folder public static final string doc_folder_name_one = "/crane/"; public static final string doc_folder_name_two = "/helicam/"; public static final string doc_folder_name_three = "/montage/"; pu

problems to transmit beacon from android device -

has used samsung's bluetooth le apis make samsung android device advertise ibeacon? using samsung galaxy s4 ( gt- i9500)device transmitting advertisement using altbeacon library . code not working there problems please check. beacon beacon = new beacon.builder() .setid1("2f234454-cf6d-4a0f-adf2-f4911ba9ffa6") // uuid beacon .setid2("1") // major beacon .setid3("5") // minor beacon .setmanufacturer(0x004c) // radius networks.0x0118 change other beacon layouts//0x004c iphone .settxpower(-56) // power in db .setdatafields(arrays.aslist(new long[] {0l})) // remove beacon layouts without d: fields .build(); beaconparser beaconparser = new beaconparser() .setbeaconlayout("m:2-3=0215,i:4-19,i:20-21,i:22-23,p:24-24"); beacontransmitter beacontransmitter = new beacontransmitter(getapplicationcontext(), beaconparser); beacontransmitt

user - How to have multiple values in phpmyadmin column? -

i know how have multiple values in column row. in case, multiple access numbers users can retrieve numbers page access. what have now: --------------------------------------------------------------------------------- id | first_name | last_name | email | password | date | access | --------------------------------------------------------------------------------- 1 | test | user | test@website.com | md5pass | -date- | 2 --------------------------------------------------------------------------------- i give user multiple access codes/variables/integers. like this: --------------------------------------------------------------------------------- id | first_name | last_name | email | password | date | access | --------------------------------------------------------------------------------- 1 | test | user | test@website.com | md5pass | -date- | 2, 201, 3908 -------------------------------

Compiler calls to no-arg super() in argumented constructors of child classes in java -

here goes: public class parent { public parent(string name) { this.name = name; } public string name = null; } public class child extends parent { public child(string name) { super(name); // if comment : implicit super constructor parent() undefined. must explicitly invoke constructor } } it said "if don't invoke super constructor self, compiler insert no-arg call super() you, first statement in constructor." is true argument-ed constructors well? mustn't compiler call argument-ed super constructor same signature of child constructor? why has been designed this? is true argument-ed constructors well? yes. mustn't compiler call argument-ed super constructor same signature of child constructor? no. if want different base-class constructor invoked, must call yourself, passing arguments necessary. why has been designed this? because alternative you're proposing (automatically f

c++ - SSE vector wrapper type performance compared to bare __m128 -

i found interesting gamasutra article simd pitfalls, states not possible reach performance of "pure" __m128 type wrapper types. skeptical, downloaded project files , fabricated comparable test case. it turned out (for surprise) wrapper version slower. since don't want talk thin air, test cases following: in 1st case vec4 simple alias of __m128 type operators: #include <xmmintrin.h> #include <emmintrin.h> using vec4 = __m128; inline __m128 vload(float f) { return _mm_set_ps(f, f, f, f); }; inline vec4& operator+=(vec4 &va, vec4 vb) { return (va = _mm_add_ps(va, vb)); }; inline vec4& operator*=(vec4 &va, vec4 vb) { return (va = _mm_mul_ps(va, vb)); }; inline vec4 operator+(vec4 va, vec4 vb) { return _mm_add_ps(va, vb); }; inline vec4 operator-(vec4 va, vec4 vb) { return _mm_sub_ps(va, vb); }; inline vec4 operator*(vec4 va, vec4 vb) { return _mm_mul_ps(va, vb); }; in 2nd case vec4 lightweight wrapp

javascript - Bootstrap Formwizard - Prevent to scroll to next step if each page form submitting ajax response gets error -

i using twitter bootstrap form wizard submit data on each page validation. want prevent, scroll next step if ajax response gets error while submitting data. below code, 'onnext': function(tab,navigation,index){ //scrollto('#wizard',-100); if(index == 1){ var $valid = $('#register_form').valid(); if(!$valid){ $validator.focusinvalid(); return false; } else { var options = $('form[name=register_form]').find('input, textarea, select').filter('.fw1').serialize(); var data = options + '&step=1'; $.ajax({ type: 'post', url: 'employeeentryprocess.php', data: data, success: function(data){ this.show(2); }, error: function(){ return false; } });

java - Interface value is always null -

i using custom recycler view , in adapter class have implemented interface null on button click. here adapter class. public class feedlistadapter extends recyclerview.adapter<addtocartholder> { private onfeeditemclicklistener onfeeditemclicklistener; public feedlistadapter(activity activity, arraylist<cartitem> feeditems) { this.activity = activity; this.feeditems = feeditems; this.filteredfeeditems = feeditems; inflater = layoutinflater.from(activity); } public void setonfeeditemclicklistener(onfeeditemclicklistener onfeeditemclicklistener) { this.onfeeditemclicklistener = onfeeditemclicklistener; } @override public addtocartholder oncreateviewholder(viewgroup parent, int viewtype) { view v = layoutinflater.from(parent.getcontext()).inflate( r.layout.feed_item, parent, false); addtocartholder viewholder = new addtocartholder(v); setupclickableviews(v, viewholder); return viewholder; } @override publ

PDF render in Android -

i want display pdf files downloading server page page (page1, page2, page3... url's) in list view / recycler view zoom property recycler / list view. i don't want convert pdf image , display them in list because 'll loose clarity when apply zoom property list. i tried web view , intent display pdf content per requirement want load more new pdf files , display them in list zoom in zoom out functionality entire list i tried pdf renderer class , able display pdf file image in list when zoom in clarity missing please suggest if 1 gone through approach thanks , waiting valuable reply. you can try library 'android pdfview' https://github.com/joanzapata/android-pdfview

c# - Having empty output for selected node in XML -

i have xml file includes nodes , children same name , attributes. <?xml version="1.0"?> <purchaseorder purchaseordernumber="99503" orderdate="1999-10-20"> <address type="shipping"> <name>ellen adams</name> <street>123 maple street</street> <city>mill valley</city> <state>ca</state> <zip>10999</zip> <country>usa</country> </address> <address type="billing"> <name>tai yee</name> <street>8 oak avenue</street> <city>old town</city> <state>pa</state> <zip>95819</zip> <country>usa</country> <address type="buying"> <name>ellen adams</name> </address> <address type="transporting"> <name>tai yee</name> <street>8 o

c# - How to Escape special characters in Microsoft SQL CE -

nb: using microsoft sql compact edition 3.5 i have table of users.i have display name user input , need query user display name matches input. select top (1) * users display_name 'abby parker' here 'abby parker' input it working fine in normal cases .but problem display name can contain special characters for eg display name can "abby park#er" or "%&^%&^%#%" .the above query fails in such cases .i have tried solution specified here escaping special characters in sql statement using sql parameters this how building query here var command = ceconnection.createcommand(); command.commandtext = string.format("select top (1) * {0} {1} '[{2}]' ", tablename,fieldname, key); } {0}=>users {1}=>display_name {2}=>pattern thanks in advance as posted here , please try following: var command = ceconnection.createcommand(); command.commandtext = string.format("select t

php - Missing Css and Js files while specifying an action in the url in cakephp -

am working cakephp. , installed , configured everything. , using virtual host also. when call base url, css , js files loaded. when included method name in url, shows not found. think due url rewriting problem. project directory /var/www/html/betting/ .htaccess (/var/www/html/betting/.htaccess) <ifmodule mod_rewrite.c> rewriteengine on rewriterule ^$ app/webroot/ [l] rewriterule (.*) app/webroot/$1 [l] </ifmodule> and (/var/www/html/betting/app/.htaccess) is <ifmodule mod_rewrite.c> rewriteengine on rewriterule ^$ webroot/ [l] rewriterule (.*) webroot/$1 [l] </ifmodule> and (/var/www/html/betting/app/webroot/.htaccess) is <ifmodule mod_rewrite.c> rewriteengine on rewriterule ^$ webroot/ [l] rewriterule (.*) webroot/$1 [l] </ifmodule> if call url http://betting.spark.com/site fine. call http://betting.spark.com/site/index not loading css , js files. appreciated. :)

geolocation - All Lat Lng of a sql table within 15 Km to each Lat lng of a different table-sql 2008 -

sql 2008 i have 2 tables. 1 table (a) have around 4000 locations lat lng. table (b) having 800 locations lat lng. i need each lat lng of table b corresponding lat lngs within 15 km of radius. i using sql 2008 , new geographical queries. /* assuming tables */ if object_id('#xlocation1') not null drop table #xlocation1 create table #xlocation1 ( id int identity(1,1) constraint pk_location_1 primary key--reqire geog spatial index ,locationid int ,latitude float null ,longitude float null ,radius int null ,geogpoint geography null ) if object_id('#xlocation2') not null drop table #xlocation2 create table #xlocation2 ( id int identity(1,1) constraint pk_location_2 primary key--reqire geog spatial index ,locationid int ,lat

asciimath - Displaying ascimath using javascript -

created html with <div id="math-display"> </div> next, on main.js, retrieve database using ajax , pass data in asciimath using json.mathanswer. aim display return data in asccimath mathematical expression. example: data retrieved database *dy/dx = 3*x^3* . passed json.mathanswer. have tried using following code: $('#math-display').append(json.mathanswer); or document.queryselector('#math-display').textcontent =json.mathanswer; the display still in asciimath, i.e. *dy/dx = 3*x^3* . also tried using delimiters: $('#math-display').append(`json.mathanswer`); or document.queryselector('#math-display').textcontent =`json.mathanswer`; the result json.mathanswer displayed in space allocated. how display asciimath retrieved data in mathematical expression html using javascript? the problem lies in facts many have come across , posted on stackoverflow. thank clues. for instance: javascript m