Posts

Showing posts from March, 2014

typeahead.js - Cannot read property 'tokenizers' of undefined using Typeahead -

i using twitter's "typeahead.js 0.11.1", got error "cannot read property 'tokenizers' of undefined". put code below, please me check did wrong. paths: { 'jquery' : 'assets/lib/jquery.min', 'underscore' : 'assets/lib/underscore-min', 'backbone' : 'assets/lib/backbone.min', 'marionette' : 'assets/lib/backbone.marionette.min', 'bootstrap' : 'assets/lib/bootstrap.min', 'typeahead' : 'assets/lib/typeahead.bundle.min', }, shim: { typeahead:{ deps: ['jquery'], exports:'bloodhound', init: function ($) { return require.s.contexts._.registry['typeahead.js'].factory( $ ); } } } marionette's view code below: define(['jquery', ...

Recursive call in mySQL -

i have data has 3 columns +------+------+------+ | col1 | col2 | col3 | +------+------+------+ | | 1 | p | | | 3 | q | | 1 | b | r | | 1 | c | s | | 3 | x | t | | b | l | u | | b | x | v | | c | t | w | | c | z | m | +------+------+------+ column 1 entries can have more 1 value. now if user searches 1 in table, returns values corresponding 1, now entries corresponding b in column 1 should repeated , on.. if user searches 1 output should be +------+------+ | col1 | col2 | +------+------+ | 1 | b | | 1 | c | | 3 | x | | b | o | | b | x | | c | t | | c | z | +------+------+ can me select query.?

gruntjs - grunt-text-replace doesn't work -

i installed grunt-text-replace npm install grunt-text-replace --save-dev command , add grunt.loadnpmtasks('grunt-text-replace'); gruntfile.js , add write this: replace: { example: { src: ['css/mystyle.css'], overwrite: true, replacements: [{ from: 'wizard', // string replacement to: 'wizardstep' }] } } then run grunt replace in command line , after show me done, without error replacement doesn't work , applied. unfortunately entered path incorrectly , other hand grunt-text-replace doesn't show me message if source file path incorrect. just correct source path

javascript - How to disable copy paste,spellcheck,autocomplete in Cordova Android application -

how disable copy paste,spellcheck,autocomplete in cordova android application? @ time text typed user gets autocompleted. what @tasos says in comment valid, if want all user selection disabled in app can use answer question: disabling text selection in phonegap i looked on over this. worked me. public class mainactivity extends droidgap { @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); super.loadurl("file:///android_asset/www/index.html"); super.appview.setonlongclicklistener(new view.onlongclicklistener() { public boolean onlongclick(view v) { return true; } }); } } the setonclicklistener magic. make sure put after call super.loadurl.

javascript - How to add java syntax highlighting to devtools in electron? -

i'm trying debug gwt app using java source maps (gwt superdevmode) reason java syntax highlighting not working. when open app in chrome syntax highlighting works ok. is there way turn on java syntax highlighting in electron devtools?

oracle adf - Two Criteria in on jsf page -

i have jsf page 2 query components following view criterias: vc1 , 2 bind variabe a (required) , b , vc2 , 2 bind variable c (required) , d both applied same instance of viewobject , rendered property of both queries change pageflowscope parameter when apply vc2 view criteria , press search button error appears: the attribute a(from vc1) required whats solution? required parameter required set, if not used. so either have set value or remove require restriction. in cases viewcriteria parameters shouldn't have require property set. , default behavior such parameters in 12c. assume using of 11g releases. but may trying solve problem in wrong way? if case, give more details on problem, trying solve.

Where is ICCs handled in the Android stack? -

i assigned project in should write app android intercept communicating intents passing around in framework. in fact, intercept iccs (inter-component communication) going on in device including ipcs. afaik, there 2 general ways icc in android listed below. intent passing (between activities, services , receivers). bound services activities can bind themselves. for getting project done, should manipulate android framework hook specific modules? (although not so). i rather more interested in creating app intercept iccs without manipulating framework. possible @ all? if should touch framework, please tell me @ module(s)/component(s) iccs handled? should manipulate android framework hook specific modules? yes. because of process sand-boxing feature of linux kernel, app cannot access other apps' information or going on there. i rather more interested in creating app intercept iccs without manipulating framework. possible @ all? absolutely no. ...

java - You are exploring an API that is described or served via HTTP instead of HTTPS -

after following steps described here create api : https://cloud.google.com/appengine/docs/java/endpoints/getstarted/backend/helloendpoints i open following url on browser : http://localhost:8080/_ah/api/explorer after running mvn appengine:devserver to test api locally. however, browser redirects https://cloud.google.com/appengine/docs/java/endpoints/getstarted/backend/helloendpoints and following error appears in red : you exploring api described or served via http instead of https. insecure , may blocked browser. fix this, set tls proxy api. alternatively, can tell browser allow active content via http @ site (on chrome, click shield in url bar), not improve security or dismiss message. and api explorer blank what best way around this? the best way around in error message. to fix this, set tls proxy api. alternatively, can tell browser allow active content via http @ site (on chrome, click shield in url bar), not improve security or dismiss m...

c# - linq lambda convert object with list of objects of the same type to another object -

i have list<originalitem> need convert list<newitem> . here classes public class originalitem { public int itemindex {get;set;} public string name {get;set;} private originalitem[] itemslist; public originalitem[] itemslist { { return itemslist; } set { itemslist= value; } } } public class newitem { public int newitemindex {get;set;} public string newname {get;set;} private newitem[] itemslist; public newitem[] itemslist { { return itemslist; } set { itemslist= value; } } } i know using select statement can create new object list i.e. list<newitem> newitems = originalitems.select(x=> new newitem(){ newitemindex = x.itemindex, newitemname = x.name ...

sql server - Split row into several with SQL statement -

i have row in databasetable on following form: id | amount | | 5 | 5439 | 01.01.2014 | 05.01.2014 i want split 1 row pr month using sql/t-sql: amount | 5439 | 01.01.2014 5439 | 02.01.2014 5439 | 03.01.2014 5439 | 04.01.2014 5439 | 05.01.2014 i, sadly, cannot change database source, , want preferrably in sql trying result of query other table in powerpivot. edit: upon requests on code, have tried following: declare @counter int set @counter = 0 while @counter < 6 begin set @counter = @counter +1 select amount, dateadd(month, @counter, [from]) dato [database].[dbo].[table] end this returns several databasesets. you can use tally table generate dates. sql fiddle ;with e1(n) as( select 1 union select 1 union select 1 union select 1 union select 1 union select 1 union select 1 union select 1 union select 1 union select 1 ), e2(n) as(select 1 e1 cross join e1 b), e4(n) as(select 1 e2 cross join e2 b),...

java - GAE Not able to access Public methods of Entity Class in Clientside -

i using objectify in data store operations in endpoint classes. have entity class there public method : public void setregistrationrecord(registrationrecord registrationrecord) { this.registrationrecord = ref.create(key.create(registrationrecord.class, registrationrecord.getid())); } in client side not able access method please let me know wrong doing. thanks in advance objectify server-side framework. creating key requires gae sdk, not available client-side.

ios - custom delete image within UITabelViewCell only show half of itself -

Image
i want custom delete button of uitableviewcell these codes: let deleteaciont = uitableviewrowaction(style: uitableviewrowactionstyle.normal, title: nil, handler: {action, indexpath in thing }); deleteaciont.backgroundcolor = uicolor(patternimage: uiimage(named: "delete")!) the height of uitableviewcell 70 this: override func tableview(tableview: uitableview, heightforrowatindexpath indexpath: nsindexpath) -> cgfloat { return 70 } and images these size: delete.png:70*70\delete@2x.png:140*140\delete@3x.png:210*210 but when swipe left, image show half: i have been confusing long time , help the length of tableviewrowaction title's length let deleteaciont = uitableviewrowaction(style: uitableviewrowactionstyle.normal, title: " type more space here " , handler: {action, indexpath in thing });

vbscript - Not able to execute/run vbs file from java on server -

i have vbs file xxx.vbs i'm able execute on local machine using below code: string cmd = "wscript filepath\\xxx.vbs"; process p = runtime.getruntime().exec(cmd); but when create war file of project , deploy on server, i'm not able execute vbs file. i can execute vbs file manually on server. there nothing wrong vbs file. any idea on may reason above? try adding below snippet determine whats happening in background. string line=""; try { inputstreamreader isr = process.getinputstream(); bufferedreader br = new bufferedreader(isr,4094); while ( (line = br.readline()) != null) system.out.println(line); } catch (ioexception ioe) { ioe.printstacktrace(); } try { isr = process.geterrorstream(); br = new bufferedreader(isr,4094); while ( (line = b...

javascript - Node.js requre not working as expected -

i have used node , node express generator generate node express code. worked fine, until had deploy ti server. by default there couple of files : .bin/www ( there have var app = require('../app'); ) app.js my hosting requires have name of server.js starting point. moved www , and renamed server.js and there structure: server.js app.js now problem in line have require var app = require('../app'); i have tried change to var app = require('app'); var app = require('app.js'); var app = require('./app'); var app = require('app/app'); --> move of app different folder but without success. doing wrong? try this: var app = require('./app'); not prepending ./ in front of filename indicates want require module instead of file. edit: try following: var path = require('path'); var app = require(path.resolve(__dirname, './app.js')); more info on __dirname global can found her...

sql - Encapsulated query within a database object returns too few rows -

a member of team has gotten strange behaviour can recreated both in development environment , system test environment ms sql databases. if runs query directly returns 517 rows , correct , expected result: select p.package_id, la.code_kid package p (nolock), strength s (nolock), productcode la (nolock), code (nolock) p.strength_id = s.strength_id , la.product_id = s.product_id , la.code_kid = a.code_id except select p.package_id, p.code_kid package p however, if puts same query in view wrongly returns 311 rows - 206 rows less if runs query directly. if run query analyser both direct query , view query see 2 query plans quite different, don't understand why. he tried dump query temporary table: insert mydb.code_package select p.package_id, la.code_kid package p (nolock), strength s (nolock), productcode la (nolock), code (nolock) p.strength_id = s.strength_id , la.product_id =...

couchbase - Issue when trying to connect to the cluster after updating the version of Java SDK -

we experiencing issue when trying connect cluster after updating version of java sdk. the setup of system follows: we have web application using java sdk , couchbase cluster. in between have vip (virtual ip address). realise isn’t ideal we’re not able change since vip mandated tech ops. vip there reroute initial request on application startup. way can make modifications on cluster , ensure when application starts can find cluster regardless of actual nodes in cluster , ips. prior issue used java sdk version 1.4.4. our application start , java sdk initiate request on port 8091 vip. please note port 8091 port open on vip. vip reroute request 1 of node cluster in use cluster respond java sdk. @ point java sdk discover nodes in cluster , application run fine. during time if add, remove node cluster java sdk update automatically , run without issue. in last sprint updated java sdk version 2.1.3. our application start , java sdk initiate request on port 11210 vip. since port not ...

Javascript Regex to return only a range of items -

i have requirement regex expression should return immediate children of it's parent. eg. if parent denoted classname "level-0", it's immediate children classname can "level-0-0, level-0-1......,level-0-10" etc. i have regex in javascript intended return immediate child, it's not working. please find regex below. $('tr').filter(function(){ return this.classname.match(/level-0[-\d+]{1,1}/) }) // result below. [<tr class=​"fundrow level-0-0 child" style=​"display:​ table-row;​">​…​</tr>​, <tr class=​"fundrow level-0-0-0 child" style=​"display:​ table-row;​">​…​</tr>​, <tr class=​"fundrow level-0-0-0-0 child" style=​"display:​ table-row;​">​…​</tr>​, <tr class=​"fundrow level-0-0-0-1 child" style=​"display:​ table-row;​">​…​</tr>​, <tr class=​"fundrow level-0-0-1 child" style=​"display:​ table-...

c# - ILMerge and Visual Studio and PostEvent build -

met problem. vs2013 doesnt allow merge files same exe created after build. "$(solutiondir)ilmerge\ilmerge.exe" "$(targetpath)" "$(solutiondir)..\lib\soft.dll" /out:"$(targetpath)" my idea merge built exe 1 dll (uses in references) , have same exe filename. can without problem apart of visualstudio. but prefer merge in post-build event, , not change exe filename. is there workaround ? ps. dont want have dll in resources, because used lot, , easy have usual in references

jquery - Jstree Open specific branch on load -

i'm having trouble finding way open specific js tree branch on load. current tree loaded through ajax , shows top level, other branches loaded via ajax when expanded. want if user loads page @ place in tree want tree load branch open on tree. i'm pretty sure can add json passing children part json specific node. how load tree branch open? i can perform after load function open nodes specify these feels little messy, there way open branch on load? my current function loads tree via json this: $.jstree.defaults.core.data = true; $('.nav-tree').jstree({ 'core' : { 'data' : { 'url' : function (node) { return host+ "treenavigation?format=json"; }, 'data' : function (node) { return node.id === '#' ? { 'rootid' : 0} : {'rootid' : node.id}; } } }, "plugins" : [ ...

c# - Access local DB on user pc from a remote application running on "Azure Server" -

i new ms azure , developing remote apps. have read , viewed learning stuff. i use c# developing language, , have understood, simple develop windows application run on azure server remote app, users anywhere on earth can run pc if installed locally on pc's. in reality, more like, rdp hiding behind app. the problem database running on every users pc instead on azure server. suppose design, don't ask me why. we tend use "ms access" local db, since have ms office. anyway, problem. wondering is, how can make remote application on azure server communicate database installed locally on user(s) pc? i have drawn simple figure explain mean. http://snag.gy/ybyed.jpg back in days when people used modems connect pc's tubes, theoretically possible (although maybe not idea). nowadays, very few pc's connected directly internet. in office, pc connected via company intranet external gateway , pc not visible outside gateway. same true @ home, gateway...

java - VideoView unable to open content from internel storage -

i have following code: try { myvideoview.setmediacontroller(mediacontrols); file mydir = getdir("mydir", context.mode_private); myvideoview.setvideopath(mydir.getpath()+"/filename.3gp"); } catch (exception e) { log.e("error", e.getmessage()); e.printstacktrace(); } myvideoview.requestfocus(); myvideoview.setonpreparedlistener(new onpreparedlistener() { // close progress bar , play video public void onprepared(mediaplayer mp) { progressdialog.dismiss(); myvideoview.seekto(position); if (position == 0) { myvideoview.start(); } else { myvideoview.pause(); } } }); within oncreate() method. problem throws ioexception, , says unable open content . works perfect if use myvideoview.setvideouri(path/to/server) instead of myvideoview.setvideopath(path/to/local/storage) . permissions ...

c# - getting most inner type object in one to many relation in linq -

i'm new linq.i have 3 entities in db type, question,answer every type have many questions every question have many answers, eagerly loaded ilist, have question , answers, need fetch of answers disregard type , question, mean need have result type type of answer have of answers in db. have ilist<type> types=context.types.tolist(); but dont have idea how answers. include "question" , "question.answer" provide list foreign key relationship. ilist<type> types = context.types.include("question").include("question.answer").tolist(); to check var questions = types.selectmany(t => t.question).tolist(); var answers = questionlist.selectmany(t => t.answer).tolist(); but think should directly. ilist<question> questions = context.question.include("type").include("answer").tolist();

image - iOS - How to get thumbnail from video without play? -

i'm trying thumbnail video , show in tableview. here code: - (uiimage *)imagefromvideourl:(nsurl *)contenturl { avasset *asset = [avasset assetwithurl:contenturl]; // thumbnail @ start of video cmtime thumbnailtime = [asset duration]; thumbnailtime.value = 25; // image video @ given time avassetimagegenerator *imagegenerator = [[avassetimagegenerator alloc] initwithasset:asset]; cgimageref imageref = [imagegenerator copycgimageattime:thumbnailtime actualtime:null error:null]; uiimage *thumbnail = [uiimage imagewithcgimage:imageref]; cgimagerelease(imageref); return thumbnail; } but image allways return black. what's wrong? nsurl *videourl = [nsurl fileurlwithpath:filepath];// filepath video file path avurlasset *asset = [[avurlasset alloc] initwithurl:videourl options:nil]; avassetimagegenerator *generateimg = [[avassetimagegenerator alloc] initwithasset:asset]; nserror *error = null; cmtime time = cmtimemake(1,...

html - Using CSS circles in Email -

i'm trying create nice round circle number in middle, have working fine in browser, when go send in mailchimp circles become huge squares. this css .circle{ width:100px; height:100px; border-radius:50px; font-size:20px; color:#ffffff; line-height:100px; text-align:center; background:#ff8080 } then using - <div class="circle">1</div> this in browser - circle in browser in outlook - cirlces in outlook i found fix works - <div align="center"><!--[if mso]> <v:roundrect xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w="urn:schemas-microsoft-com:office:word" href="http://" style="height:100px;v-text-anchor:middle;width:100px;" arcsize="600%" stroke="f" fillcolor="#ff8080"> <w:anchorlock/> <center> <![endif]--> <a href="http://" style="background-color:#ff8080;border-rad...

c# - How to specify a class that may contain another class -

i want create class have class second class may different each time first class called. example: public class serverresponseobject { public string statuscode { get; set; } public string errorcode { get; set; } public string errordescription { get; set; } public object obj { get; set; } public serverresponseobject(object obje) { obj = obje; } } public class tvchannelobject { public string number { get; set; } public string title { get; set; } public string favoritechannel { get; set; } public string description { get; set; } public string packageid { get; set; } public string format { get; set; } } public class channelcategoryobject { public string id { get; set; } public string name { get; set; } } how can call serverresponseobject different objects each time, once tvchannelobject , once channelcategoryobject ? what you're looking generic type parameter : public class serverresponseobject...

sql server - Run SQL Script within a table/string and output results to file -

i need run sql scripts held in report configuration table , output results .csv or .xls files in desired folder file name specified within report config table. an example of table per script below column being desired file name created , column b contains script executed. ideally require script can drop stored proc run down each row in table , export , create each rows results separate file in desired folder. i think needs recursive query i'm not sure start, advice or appreciated. edit: suggested use ssis, can done existing toolbox items or need write script this? there hundreds of sql scripts in table efficiency key! set ansi_nulls on go set quoted_identifier on go create table [dbo].[test_table_ps]( [file_name] [nvarchar](100) null, [script_to_run] [nvarchar](100) null ) on [primary] go insert [dbo].[test_table_ps] ([file_name], [script_to_run]) values (n'report_1', n'select * fred') go insert [dbo].[test_table_ps] ([file_name], [script_to_run...

javascript - How to send var from ajax to submit of modal in bootstrap? -

i have php file contains bootstrap/ajax calendar click action open modal bootstrap. action send var modal , when click submit modal button save var mysql database php file called. problem in modal showed var correctly, isn't sended php file save database. this code: $(document).ready(function() { ... eventclick: function(event, jsevent, view) { $('#createeventmodaledit #start').text(event.start); $('#createeventmodaledit #end').text(event.end); $('#createeventmodaledit #patientname').text(event.title); $('#createeventmodaledit #id').text(event.id); $('#createeventmodaledit').modal('show'); ... $('#submitbuttonedit').on('click', function(e){ // don't want act link cancel link action e.preventdefault(); dosubmitedit(); }); function dosubmitedit(){ $("#createeventmodaledit").modal('hide'); console.log($('#apptsta...

c# - Find values that appear in all lists (or arrays or collections) -

given following: list<list<int>> lists = new list<list<int>>(); lists.add(new list<int>() { 1,2,3,4,5,6,7 }); lists.add(new list<int>() { 1,2 }); lists.add(new list<int>() { 1,2,3,4 }); lists.add(new list<int>() { 1,2,5,6,7 }); what best/fastest way of identifying numbers appear in lists? to 2 lists 1 use x.intersect(y) . to several want like: var intersection = lists.aggregate((x, y) => x.intersect(y)); but won't work because result of lambda isn't list<int> , can't fed in. might tempt try: var intersection = lists.aggregate((x, y) => x.intersect(y).tolist()); but makes n-1 needless calls tolist() relatively expensive. can around with: var intersection = lists.aggregate( (ienumerable<int> x, ienumerable<int> y) => x.intersect(y)); which applies same logic, in using explicit types in lambda, can feed result of intersect() in without wasting time , memory creating ...

batch file - searching a filename having number in it from command prompt -

i want search zip files in directory based on pattern , have list out in .txt file e.g. having abc.zip , abc123.zip(123 can random numbers) code for %%f in [fullpath]\abc*.zip @echo %%~ftf>> test.txt (enclosed in batch file) gives me output [modified date][fullpath]abc.zip [modified date][fullpath]abc123.zip now twist here is, want list out abc123.zip , not abc.zip , cannot give pattern abc123*.zip, 123 can random numbers , not fixed. thanks @echo off setlocal enabledelayedexpansion ( /f "delims=" %%i in ('dir /b /a-d abc*.zip ^|findstr /r [0-9]') ( set file=%%i echo !file! ) )>test.txt type test.txt | more exit /b 0

elixir - Where to put helper module on Phoenix Framework -

i want add helper module request using http://hexdocs.pm/httpoison/httpoison.base.html but when put defmodule in /lib/shopper/callapi.ex and use in /web.ex def controller quote use phoenix.controller alias shopper.repo import ecto.model import ecto.query, only: [from: 1, from: 2] import shopper.router.helpers use shopper.callapi end end the compiler failed == compilation error on file web/controllers/page_controller.ex == ** (undefinedfunctionerror) undefined function: shopper.callapi.__using__/1 shopper.callapi.__using__([]) web/controllers/page_controller.ex:2: (module) so... define callapi.ex , should declare it? when call use shopper.callapi , __using__/1 macro called - specific meta-programming. if want use functions defined in shopper.callapi in module use alias shopper.callapi instead. the differences between alias , require , import documented in alias, require , import , using documented in domain spec...

r - Concatenate Column Strings based on an Integer -

i want create strings shown below date first elected, example. df: name party firstelected bob liberal 1985 joe republican 1985 sarah green 1980 bill libertarian 1980 tom conservative 1987 goal: year peopleelected 1985 "bob (liberal); joe (republican)" 1980 "sarah (green); bill (libertarian)" 1987 "tom (conservative)" i assume combination of paste , apply/aggregate can this...but haven't had luck far. we can use paste/sprintf create format grouped 'firstelected'. convert 'data.frame' 'data.table' ( setdt(df1) ), grouped 'firstelected', wrap 'party' parentheses, concatenate 'name' using sprintf , use paste , collapse='; ' create single string. library(data.table) setdt(df1)[,list(peopleelected=paste(sprintf('%s (%s)', name, party), collapse="; ")) , = fi...

How to record low quality video in mp4 format in android? -

i recording low quality video camera , uploading server. issue video recorded comes in 3gp format. if give extra_output flag mp4 extension path, still records in 3gp. actually, on ios device, 3gp video not playing , don't want convert mp4 using ffmpeg because has overhead , take time convert. this code using :- contentvalues values = new contentvalues(); string filename = system.currenttimemillis() + ".mp4"; values.put(mediastore.video.media.title, filename); values.put(mediastore.video.media.mime_type, "video/mp4"); try { uri videourifromcamera = getcontentresolver().insert( mediastore.video.media.external_content_uri, values); intent intent = new intent(mediastore.action_video_capture); intent.putextra(mediastore.extra_video_quality, 0); intent.putextra(mediastore.extra_output, videourifromcamera); ...

windows 7 - A setup package is either missing or damaged - Visual Studio 2015 on Win 7 -

Image
this problem started happen when trying install/repair visual studio 2015. "a setup package either missing or damaged" , package being along lines of win10_universalcrtsdk\universal crt headers libraries , sources-x86_en-us.msi does know how fix error? edit: current solution skip package, not sure if need later though, , how install later?

ios - unrecognized selector sent to instance at facebook login manager in facebook sdk 4.6 on iOS9 -

hi have upgraded app ios 9 , using facebook's latest sdk (version 4.6) facebook login. i using custom login button hence using loginmanager class same. previous version working fine app gets crashed whenever press login button saying "unrecognized selector sent instance" below code using in gamescene class login. var fblogin = fbsdkloginmanager() func onclickfblogin(){ let vc = self.view?.window?.rootviewcontroller fblogin.loginwithreadpermissions(["public_profile"] [anyobject], fromviewcontroller: vc, handler: {(result:fbsdkloginmanagerloginresult!, error:nserror!) -> void in if(error != nil){ print("facebook login error \(error)") } else if(result.iscancelled){ print("facebook login cancelled") } else{ print("facebook login successful") if(self.issavemebuttonpressed){ print("face...

shopify - Multipage form for silverpop -

i doing research on building multipage form using silverpop couldn't find relevant material online. has tried this? if pointers on how implement appreciated. i built multi page webform outside of ui in php , used api send in values. do have experience api? i guess can build 1 in ui use jquery hide , display sections of fields. haven't tried out method though.

java - how to autowire @bean classes -

i have following @configuration class @configuration public class someclass { @bean public beanclass get() { return new beanclass() } } now want autowire beanclass in other class public class someclass2 { @autowired beanclass beanclass } currently beanclass coming null. , how need tell spring autowiring. according spring documentation by default, bean name of method name get bean name, try configuration: @configurtion public class someclass { @bean public beanclass beanclass() { return new beanclass() } } bean @component public class someclass2 { @autowired beanclass beanclass }

playing demuxed audio/video packet using GStreamer -

i newbie in multimedia. have application getting demuxed audio/video packet. checked gstreamer tutorials of examples based on url muxed stream. gstreamer provides such interface 1 can pass demux audio/video buffer video playback? appsrc capable pushing data application gstreamer pipeline. the pipeline can be: your demuxed data -> appsrc ! some-decoder ! some-sink here example , info appsrc. also can check more examples here

regex - PHP - Filter unwanted elements from database input and update -

i use below method strip away unwanted characters gets inserted or updated in database. to honest want allow following characters other regular letters , numbers: ' , - , ) , : ... , few others. pretty characters allow write regular phrase. am going @ right way? preg_replace strips away spaces strings. how can make stop? how can add wanted characters preg_replace? public function strip($arr = array()) { if (!is_array($arr) || !count($arr)) { return array(); } $returnarray = array(); foreach($arr $key => $val) { $val = $this->db->mysqli->real_escape_string($val); $val = strip_tags($val); //$val = preg_replace("/[^a-za-z0-9]/", '', $val); $returnarray[$key] = $val; } return $returnarray; } [^a-za-z0-9\s] allow characters a-z or a-z or numbers 0-9 , whitespaces. \s stands whitespaces if want add symbols need escape them \ if used in regex $ [^\$] if n...

c++ - Can I make a thread-safe std::atomic<vector<int>>? -

i'm having function needs executed n=1000 times. functions monte carlo style simulation , returns int result. i'd run nthreads=4 in parallel. whenever thread finishes 1 cycle, should put result in std::vector<int> . thus, after 1000 cycles, i've vector of 1000 int s can examined statistics. since std::vector not thread-safe, thought std::mutex (which surely work). but wonder if can declare vector atomic , around mutexes? possible have std::atomic<std::vector<int>> ? , can use push_back etc. on it? you don't need to. totally okay, access ja std::vector multiple threads, if you read objects you write different objects so make sure, create vector of size n=1000 , depending on thread number (1 4) assign elements 0-249, 250-499 etc. threads. so each of thread computes n/nthreads elements.

html - PHP not fetching images from my server folder -

i have code supposed fetch image server , display on html. images encrypted in md5 , when uploading them server there no field in table stores names of images. therefore calling image using primary key in table image. here code: <?php // connection string constants define('dsn', 'mysql:dbname=mydbname;host=localhost'); define('user', 'myuser2015'); define('password', 'mypwd2015'); // pdo instance creation $pdo = new pdo(dsn, user, password); // query preparation $stmt = $pdo->query(" select title, introtext, id, created, created_by, catid mytbl_items limit 4 "); // fetching results $result = $stmt->fetchall(pdo::fetch_assoc); // if returns 0 means no records present echo count($result) . "\n"; // loop should print valid table foreach ($result $index => $row) { if ($index == 0) echo '<div>'; ...

google cloud messaging - Android GCM saying class not found (java.lang.NoClassDefFoundError: GCM) -

android gcm saying class not found (java.lang.noclassdeffounderror: gcm) . have put google play-services in libs folder only. have crossed checked several times. weird thing working in lollipop (api 21) not working in jelly bean (api 17). can 1 please me out. thank you!

Flyway migration using JNDI -

i doing migration using flyway. have used flyway configuration file can changed based on environment (dev/test/prod). application using jndi lookup database connectivity in tomcat's server.xml file. but problem want make common both flyway , application don't make mistakes change configuration @ 1 file , forget in one. also looking solution can applied java or php application irrespective of framework used(e.g. spring) help???

selenium - How to continue test execution after assertion failed? -

i know question duplicate one. searching result yesterday. didn't got solution that.. using selenium webdriver 2.47.1 & testng automation. in automation script have 12 set of tests & using testng assert method compare expected result & actual result. code format given below... @test(priority = 6) public void testingenote1() { cd.switchto().frame("rtop"); cd.manage().timeouts().implicitlywait(20, timeunit.seconds); string testenote1 = cd.findelement(by.xpath("//table/tbody/tr[2]/td[5]")).gettext(); stringbuffer object1 = new stringbuffer(testenote1); string actenote1 = object1.substring(108); string expenote1 = ex.getexcelvalue(scenarioname, 75, 4); try { assert.assertequals(expenote1, actenote1); ex.setexcelvalue(scenarioname, 75, 8, "passed"); } catch(exception e) { ex.setexcelvalue(scenarioname, 75, 8, "failed"); } cd.switchto().defaultcontent(); } execution of test...

java - EDITED: My code does not work the catch block during exception handling -

edited i have changed code bit, have following function in page object. public void kenshosearch(string searchterm) throws exception { driver.findelement(kenshosearchbox).sendkeys(searchterm); try { new webdriverwait(driver, 10).until(expectedconditions.visibilityofelementlocated(kenshosearchverify)); } catch (nosuchelementexception e) { system.out.println("no results found"); } } when run test keyword not have results, should print out "no results found" in actual throws nosuchelementexception on console along stack trace. what doing wrong here? there 2 ways: 1.) can catch nosuchelementexception , throw new assertexception text message. 2.) instead of catching exception should use: list<webelement> elements = getdriver().findelements(by.xpath("your xpath")); assert.asserttrue(elements.size()>0, "no results found \"search term\" "); here try fill list found...

browser - Does Akamai resubmit on timeout -

we have application behind akamai meaning traffic goes first akamai, our web server, our app server. there few urls lengthy updates in our app , can take on 4 minutes depending on user submits (yes know horrible legacy code - did not write have deal it). url uses post request rather if matters. noticed if url takes more 2 minutes see url gets called on our app server every 2 minutes though browser has 1 request in network tab (same thing happens in both ie11 , chrome 45 dont think browser issue). lets url takes 6 minutes see 3 calls in our access logs. we contacted akamai support , deny causing issue. provided logs shows 3 calls being sent server ours (each 1 2 minutes apart). need prove in fact akamai causing issue (because tech support not believe 1+1=2 unless prove them). i've tried debug fiddler (an http packet sniffer). see 1 request coming browser see keep alive call every 1 minute in fiddler. assume not mean browser resubmitting request , http standard keep socketed ...

ios - Apple Push - didReceiveIncomingPushWithPayload not called - instead error: Failed sending message to client -

i have app uses pushkit (voip push). of time pushes through. when there lot of traffic, pushes don't through app. in state can somehow reproduce error. i used extended logging here: https://developer.apple.com/library/ios/technotes/tn2265/_index.html and found examine logging: http://iosdevelopertips.com/core-services/debug-failed-push-messages-by-logging-apsd-process.html still, got 2 different cases, don't further: - in apsd-log get received message enabled topic ... and in app didreceiveincomingpushwithpayload not called. produce log entry right @ start of function , nothing special prevent function finishing. - in apsd-log get stream error occurred ... but not find other error messages, why error occurs. port seems ok after restarting app pushes through again. edit: the relevant error in log file seems be: apsd[82]: failed sending message client: com.apple.telephonyutilities.callservicesdaemon.voip.push.development there seems 2 types of ca...

ios - “type of expression is ambiguous without more context” using struct property as dictionary key -

i getting , exception: type of expression ambiguous without more context with following code: struct parameter { static let email = "email" static let password = "password" static let isfacebookuser = "isfacebookuser" } let parameters : [string : anyobject] = [parameter.email : email, parameter.password : password, parameter.isfacebookuser : false] it's not accepting bool type , don't want change data type. is there issue in code? your email , password optional variables, need provide non-nil values dictionary and, hence, should unwrap them using ! suffix try this let parameters : [string : anyobject] = [parameter.email : email!, parameter.password : password!, parameter.isfacebookuser : false] alternatively, can do email = emailtextfield.text! password = passwordtextfield.text! also, replace struct enum. enum parameter: string { case email: "emailkey" ... } and use paramete...

QT C++ - FTP Upload -

Image
i've got problem programming easy ftp-upload in qt. using qt 5.5 , qftp class no longer available. used code working in visual c++ project. image: code visual c++ image: code in qt image: build error in qt is there way can fix problem? possible qftp working in qt 5.5? (string filetoupload file path) (string filename name of file on remote machine when uploaded) thanks in advance! your compilation error related conversion of const char* const wchar_t* . if satisfied ftpputfilew can convert file name wchar_t* . can done using qt qstring : qstring::towchararray(wchar_t * array) convert string wchar_t array (this function not append null character) or using direct cast: reinterpret_cast<const wchar_t *>(qstring.utf16()) also possible use various approaches conversion of std::string wchar_t* . if need ftp put operation qnetworkmanager has such function. however, qnetworkmanager has limited support low level ftp: https://stackoverflow.com/a...

C struct initialization and pointer -

#include <stdio.h> typedef struct hello{ int id; }hello; void modify(hello *t); int main(int argc, char const *argv[]) { hello t1; modify(&t1); printf("%d\n", t1.id); return 0; } void modify(hello *t) { t = (hello*)malloc(sizeof(hello)); t->id = 100; } why doesn't program output 100 ? problem malloc ? have no idea initialize struct. how can desired output editing modify only? void modify(hello *t) { t = (hello*)malloc(sizeof(hello)); t->id = 100; } should be void modify(hello *t) { t->id = 100; } memory statically allocated h1 again creating memory on heap , writing it. so address passed function overwritten malloc() return address of malloc() memory on heap , not address object h1 stored.

java - When I am running program with the help of appium on eclipse i am getting session not created error -

i have installed appium, android visual studio , have set path in env varibales, when running fist sample program on eclipse giving me below error : [testng] running: c:\users\akash srivastava\appdata\local\temp\testng-eclipse-1729078009\testng-customsuite.xml failed configuration: @beforeclass setup org.openqa.selenium.sessionnotcreatedexception: new session not created. (original error: not find adb. please set android_home environment variable android sdk root directory path.) (warning: server did not provide stacktrace information) command duration or timeout: 433 milliseconds can please me have gone wrong. the above issue got resolved since package name using calculator app can different different devices , testing calculator app on sony that's why wasn't working when tried google mobile got worked , when researched issue found out above answer.

jquery - bootstrap ie8 modal popup -

i have googled this, , have tried few answers have found, can't resolve issue. i have modal popup should appear on button press. works on other browsers / versions ie. 1 customer has use ie 8 (all still on xp, please no arguments should update. that's not going happen in near future.) here bit of html code. (form details omitted brevity) <div class="modal fade" id="collect-email" data-backdrop="static" data-keyboard="false"> <div class="modal-header"> <a class="close" data-dismiss="modal">&times;</a> <h3>collect customer email</h3> </div> <div class="modal-body"> .... i have html5shiv loaded. have js code below, should remove fade operation, , make modal work. var ie = (function(){ var undef, v = 3, div = document.createelement('div'), = div.getelementsbytagname('i...

java - SELECT FOR UPDATE query with Spring's @Transaction management creates deadlock upon subsequent updates -

setup: spring application deployed on weblogic 12c, using jndi lookup datasource oracle database. we have multiple services polling database regularly new jobs. in order prevent 2 services picking same job using native select update query in crudrepository. application takes resulting job , updates processing instead of waiting using crusrepository.save() method. the problem can't seem save() work within for update transaction (at least current working theory of goes wrong), , result entire polling freezes until default 10 minute timeout occurs. have tried putting @transactional (with various propagation flags) everywhere, i'm not able work ( @enabletransactionmanagement activated , working). obviously there must basic knowledge i'm missing. possible setup? unfortunately, using @transactional non-native crudrepository select query not possible, apparently first makes select see if row locked or not, , then makes new select locks it. service pick same ...