Posts

Showing posts from August, 2010

ios - Iterate through an NSArray of different classes that implement the same protocol with a for in loop -

i have method in instantiate array of objects derived same protocol. know if can iterate through array , execute common protocol method. pseudocode nsarray *implementations = @[/*impl1, impl2, impl3 instantiated here*/] (__________ * impl in implementations){ [impl protocolmethod] } my issue don't know how define type of object in blank in for-in loop because different classes. closest can think of "id" doesn't seem valid type because "pointer non-const type no explicit ownership." could this: for (nsobject<myprotocol>* impl in implementations) [impl protocolmethod] or even for (id<myprotocol> impl in implementations) [impl protocolmethod] i use first form it's bit more compile-time safe.

regex - How to use regular expressions in java to remove certain characters -

general question is: how parse string , eliminate punctuation , replace of them? i'm trying modify input text. case have normal text file, punctuation , want of them eliminated. if symbol . ! ? ... want replace "" string. i never used regex , tried string comparison, isn't sufficient cases. have trouble if there 2 punctuation marks; in text "the second day (the 4ht).", when have ). togheter. for example, given input expect following: input : [...] @ it!" speech caused excpected output : @ <s> speech caused every word in code added arraylist because need work later. thanks lot! fileinputstream fileinputstream = new fileinputstream("text.txt"); inputstreamreader inputstreamreader = new inputstreamreader( fileinputstream, "utf-8"); bufferedreader bf = new bufferedreader(inputstreamreader); words.add("<s>"); string s; while ((s = bf.readline()) != null) { string[] var = s.split("

php - How to load up a CSS file in a Wordpress child theme that's nested in a different folder and name? -

this easy want make sure i'm doing correctly. i've been making bunch of wordpress sites using child themes , style.css in root folder of theme , i've been using in functions.php file <?php add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' ); function theme_enqueue_styles() { wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' ); } while file exists in parent theme i'm using, it's blank , realized css file being used different file name , nested in \theme-name\framework\css\site\stacks\theme-css.css opposed theme-name\style.css so child theme have recreate folder structure , place same named theme-css.css in same folder or call style.css , put in child themes root folder be? other advice helpful. thanks. to add stylesheet when in child theme, these 2 options/behaviors: // point style.css in child theme wp_enqueue_style( 'my_child_styles', get_stylesheet_direct

Separate angularjs library from bundled browserify -

i've got gulp task browersify files. works bundling including angular.js file quite large. want pull angular.js out , load in index.html before bundled javascript file. i've done adding .external('angular') browserify call bundled resulting file not smaller, , when run app in browser, acts still trying load node angular package (error: uncaught error: cannot find module 'angular') below gulp task problem believe. function identity (input) { return input; } function bundler (watch, mocks) { var b = (watch ? watchify : identity)( browserify(watch && watchify.args) .external('angular') ); b.add(format('./%s', app)).add('babel/polyfill'); if (mocks) b.add(format('./%s/mock', app)); return b; } function bundle (bundler) { return bundler .bundle() .pipe(source('main.js')) .pipe(gulp.dest('dist/app')); } gulp.task('bundle', function () { var bundled = bu

telerik - NativeScript HTTP:getJSON doesn't work -

i have used original helloworld app , change model helloworldmodel mainmodel. then required "http" when run app , klik button "updateaction" writes console , sets message. the http request doesn't anything. code: (main-view-model.js) var __extends = this.__extends || function(d, b) { (var p in b) if (b.hasownproperty(p)) d[p] = b[p]; function __() { this.constructor = d; } __.prototype = b.prototype; d.prototype = new __(); }; var observable = require("data/observable"); var http = require("http"); var mainmodel = (function(_super) { __extends(mainmodel, _super); function mainmodel() { _super.call(this); console.log("mainmodel called"); this.set("message", "last updated" + " 2015-07-22 00:00:00"); this.set("message2", "last updated" + " 2015-07-22 00:00:00"); } mainmodel.prototype.updateaction = function() { console.log("up

Google Sheet Custom Function Not Recaculating -

hi have read caching issues custom functions in google sheets, i'm trying understand why following update if cell changed: function doob(input){ return input * 2; } but not update: function doob(input){ var sheet = spreadsheetapp.getactivespreadsheet(); var range = sheet.getrange(input); var values = range.getvalues(); return values[0][0] * 2 ; } i need range in order use .getbackgroundcolor() of each cell. probably because in first function pass cellreference directly, =doob(a1) and in script value of cell used. in second, have pass range string (since want backgroundcolors, not after values of range, right ?) =doob("a1:b8") as know, custom functions suffer memoization. work around pass in range second time, without quotation marks. =doob("a1:b8", a1:b8) that second paramater 'dummy' paramater script nothing it. but: change in values in range should make custom function re-evaluate. don't know if gonna lot if f

c - assert macro that prints the values which are passed in -

in our c codebase have assertion macros such as: assert3(x, ==, y) // x=0, y=1 results in "main.c:45: 'x == y' (0 == 1) untrue" assert(x == y) // x=0, y=1 results in "main.c:45: 'x == y' untrue" clearly, assert3 form more helpful when you're trying debug after failure because tells values of variables were. however, whenever need more complex assertion (especially including || since can split ones && multiple assertions), assert(x == y || y != 0 || x == 2) , can no longer take advantage of awesome assert3 format. clearly, could build macro assert11(x, ==, y, ||, y, !=, 0, ||, x, ==, 2) , ideally i'd create single macro can handle variable number of arguments , figure out print on own. this, think i'd need macro filter out arguments logical operators doesn't try print values -- there way that? i've had feeling , thought along lines, turns out asserts things should never happen, doesn'

c# - Writing CSV files into Sql database using LinqToCsv - .NET MVC 4 - Entity Framework -

i trying create application in user can upload .csv files sql database have created. have become little confused when comes getting file path view , writing database. first off, here model i'm working off: public class outstandingcreditcsv { [csvcolumn(fieldindex = 1, canbenull = false)] public string ponumber { get; set; } [csvcolumn(fieldindex = 2, outputformat = "dd mmm hh:mm:ss")] public datetime creditinvoicedate { get; set; } [csvcolumn(fieldindex = 3)] public string creditinvoicenumber { get; set; } [csvcolumn(fieldindex = 4, canbenull = false, outputformat = "c")] public decimal creditinvoiceamount { get; set; } } and here controller code far: public actionresult index() { csvfiledescription inputfiledescription = new csvfiledescription { separatorchar = ',', firstlinehascolumnnames = true }; var context = new csvcontext();

Testbench For Entitiy with package - VHDL -

i have problems in creating testbench test module used package. package contains block of array accessed in different process. -------------------- package --------------------- library ieee; use ieee.std_logic_1164.all; package my_array_pkg type my_array array ( 0 9) of std_logic_vector(3 downto 0); end my_array_pkg; and top entity. ----------------- top entity ------------------------- library ieee; use ieee.std_logic_1164.all; use work.my_array_pkg.all; use ieee.numeric_std.all; entity pkt_top port ( sys_clk : in std_logic; reset : in std_logic; an_en : out std_logic_vector(3 downto 0); seg_cathodes : out std_logic_vector(6 downto 0) ); end pkt_top; architecture behavioral of pkt_top signal clk1hz, clk256hz : std_logic; signal my_digit : my_array; component clock_1hz port ( sys_clk : in std_logic; reset : in std_logic; c_256hz : out std_logic; c_1hz :

java - Traps are not listened by Manager in snmp4j -

traps coming agent manager not listening traps.i write agent code , send traps on localhost.i tried mibbrowser traps received agent manager not listening. i'm doing in scala, on java same code working. agent code case class snmpdevice(host: string, port: int, readcommunity: string, writecommunity: string) class netrapsender { def createcommunitytarget(snmpdevice: snmpdevice): communitytarget = { try { var comtarget: communitytarget = null if (snmpdevice != null && snmpdevice.host != null && snmpdevice.port > 0 && snmpdevice.readcommunity != null) { comtarget = new communitytarget() comtarget.setcommunity(new octetstring(snmpdevice.readcommunity)) comtarget.setversion(snmpconstants.version2c) comtarget.setaddress(new udpaddress(snmpdevice.host + "/" + snmpdevice.port)) comtarget.setretries(2) comtarget.settimeout(5000) comtarget } comtarget } catch { case e: exception =>

python - Is it possible to get the Standard deviation of a field in pymongo? -

i have query: cursor = collection.aggregate( [ {"$match": {"name":{"$in":namelist}}}, { "$group": { "_id":"$name", "average": {"$avg":"$price"}, "max": {"$max":"$price"}, "min": {"$min":"$price"}, "count": {"$sum": 1}, } } ] ) is possible standard deviation in similar fashion?

html - Calling a javascript function -

i need call javascript function run progress bar, here code: <form name="calculation" method="post"> <progress id="progressbar" value="0" max="100" style="width:300px;"> </progress> <span id="status"></span> <h1 id="finalmessage"></h1> <input type="button" id="btn2" value="press me!" onclick="function progressbarsim(al)"/> </form> <script> function progressbarsim(al) { var bar = document.calculation.getelementbyid('progressbar'); var status = document.calculation.getelementbyid('status'); status.innerhtml = al + "%"; bar.value = al; al++; var sim = settimeout("progressbarsim(" + al + ")", 1); if (al == 100) { status.innerhtml = "100%"; bar.value = 100; cleartimeout(sim); var finalmessage =

c# - Entity Framework taking minutes to save 7500 entries -

i've got pair of entity classes called signal , data: public class data { public data() { } public int dataid { get; set; } public double elapsedtime { get; set; } public double x { get; set; } public double y { get; set; } public double value { get; set; } } public class signal { public signal() { data = new list<data>(); } public int signalid { get; set; } public string name { get; set; } public string units { get; set; } public virtual list<data> data { get; set; } } during normal operation, initialize database context , create necessary signals (12 of them), dispose context. later, data being acquired hardware , initialize context again, create data objects, , add them appropriate signal. acquisition starts , stops on course of whole thing end 625 data points per signal (total of 7500 data points) in several short bursts on 10 seconds in total. have separate thread responsible saving

android - Custom Adapters With GridView -

can set images in gridview without making customadapter . mean can directly set predefined arrayadapter gridview .? following code gridview gridview_object; arrayadapter<string> adapter=new arrayadapter<string>(context,into,int[]); gridview_object.setadapter(adapter); something that... work? i don't think so, it's simple implement imageadapter , this page docs gridview contains implementation of imageadapter , check out.

python - Tkinter Splits Menu and Main Window Upon Attempted Close -

i using tkinter build basic text editor. have small file menu 4 buttons: open, save, new file, , exit. main part of window devoted editor , buttons pop (saving, opening, etc.) however, have couple of problems: 1) when attempt close main window exit button on window border, splits main window in 1 window , menu in smaller window. remains functional, have close 2 windows terminate program. when use exit button in menu not happen. 2) second problem unrelated question title, code here so: have 4 items coded menu section, 3 showing up. fourth appears when above phenomenon occurs. why doing that? , how can fix it? thanks much! description of phenomena insufficient, here link picture of describing: https://goo.gl/vjwi5x can see in top right hand corner window black (this main text editor) no menu--right next menu, in smaller window, along buttons happen open @ time. here code: from tkinter import * import sys import menu_config import tkmessagebox import error_mes #variables glob

rust - Encompassing Trait Objects within a Base Trait Object -

sorry if seems trivial, i'm trying simple operation having tough time doing so. want have 2 trait objects whereby 1 has vector contains bunch of other object. trait metaclass { fn new() -> self; fn add(&self, subtrait: box<subclass>); } struct metastruct { elems: vec<box<subclass>>, } impl metaclass metastruct{ fn new() -> metastruct { metastruct{ elems: vec::new(), } } fn add(&self, subtrait: box<subclass>){ // if reformulate above 'fn add(&self, subtrait: subclass){' // , use below trait `core::marker::sized` not implemented type `subclass` //self.elems.push(box::new(subtrait)); self.elems.push(subtrait); } } trait subclass{ fn new() -> self; } struct mysubclass { data: i32, } impl subclass mysubclass { fn new() -> mysubclass{ mysubclass{ data: 10, } } } fn main(){ let mut met

python - Problems parsing an XML file with xml.etree.ElementTree -

i have parse xml files contain entries like <error code="unknowndevice"> <description /> </error> which defined elsewhere as <group name="error definitions"> <errordef id="0x11" name="unknowndevice"> <description>indicated device unknown</description> </errordef> ... </group> given import xml.etree.elementtree et parser = et.xmlparser() parser.parser.useforeigndtd(true) tree = et.parse(inputfilename, parser=parser) root = tree.getroot() how can values errordef ? mean value of id , of description ? how can search & extract values, using unknowndevice ? [update] error groups have differing names, of format "xxx error definitions", "yyy error definitions", etc further, seem nested @ different depths in different documents. given error's title, e.g "unknowndevice", how can search under root corresponding

javascript - how to get a link in js another site -

welcome. i on side taken value other side , on other side of value in script ( javascript ), , here question arises , whether can done , how so, how ? on page wants pull link this: l='http://vrbx017.cda.pl/lq43d6dc861cbecaef46edec5d9b93449e.mp4?st=babazs9_p-fxt44wmqa_hg&e=1437673793'; jwplayer("mediaplayer140174").setup( { width: 620, height: 387, stretching:'uniform', 'logo.file':"http://static1.cda.pl/v001/img/player/logo-player-creme.png", 'logo.position':"top-left", 'logo.link' : '', 'logo.hide' : false, 'logo.over' : 0.7, 'logo.out' : 0.4, autostart: false, "dock": "true", "controlbar.position": "bottom", "controlbar.idlehide": "false", i must link: l=' http://v

IIS 8.5 website receiving a 404 error when trying to load images and css files -

Image
i have new website created using mvc 5. when test in visual studio works great, images loaded , css files applied. after publishing website , deploying it, website can not find of images or css files. seems different other posts i'm receiving 404 file not found , not 401 access denied. have verified files there, added iis_iusrs , application pool full access on folders make sure wasn't issue. the server windows server 2012 , version of iis 8.5. there 10 other websites, of none of them having same problem shouldn't issue static content handler. here code display image... <div style="background-color: #495050"> <br /> <br /> <br /> <br /> <img height="150" style="margin:0px auto;display:block" src="~/images/guru-dental-slogan-white.png"> <hr width="800" style="color: white" /> <br /> <br />

indexing - Elasticsearch: add a synonym filter on my english analyser -

i've got index field description analysed that: "description":{ "analyzer" : "english", "type" : "string" } i have defined synonyms dictionnary in file synonyms.txt contain: ipod, i-pod, pod => i-pod i add synonym dictionnary analyzer, don't know how it. should define custom analyzer? if diverge current indexation due customisation.index yes, should define custom analyzer. can start standard english analyzer , , add synonymfilter that: { "settings": { "analysis": { "filter": { "english_stop": { "type": "stop", "stopwords": "_english_" }, "english_keywords": { "type": "keyword_marker", "keywords": [] }, "english_stemmer": { "type":

From excel find rows with same substring in a column -

i need find rows common substring in column. say, if have 1 row has data (i used : distinguish column) row1 : ab : abc, bcd, acd row2 : bc : acd, def row3 : cd : abc, dbc row4 : de : bcd, def so want query / script can show me: abc in: row1 row3 bcd in: row1 row4 acd in: row1 row2 with layout shown, put =iferror(find(d$1,$c2)>0,"") in d2 , copy across , down.

convert hash in c# to php sockets -

i have function in c#. public static implicit operator guid(tcppacketreader p) { byte[] tmp = new byte[16]; array.copy(p.data.toarray(), p.position, tmp, 0, tmp.length); p.position += 16; using (md5 md5 = md5.create()) tmp = md5.computehash(tmp); //wtf? return new guid(tmp); } i'm trying replicate functionality in php. problem when tmp variable in array. return like: array[5, 49, 42, 5, 254, 160, 191, 64, 79, 37, 216, 169, 201, 181, 13, 0, 59, 187] and don't know how computehash(tmp) in php. i've tried md5() php's function return null object. i'm googled lot nothing successful. know how that? first: md5.create().computehash(tmp); makes bit more readable (in case) what c# take array of bytes. php does, take string. if want input php array of bytes, first have convert string $tmp = md5(implode(array_map("chr", $tmp))); // implode , array_map turn tmp string, array containing byte's ascii codes (1-25

excel - Multiple Criteria -

is possible use if statement multiple criteria? or best using... have tried amend question i'm looking code isnt correct in may highlight more im looking achieve. if(a3="dog","dog green","dog blue"),matches,doesn’t match) for reason wont let me upload picture.... any help/advice appreciated there many ways test multiple criteria in excel. easiest either to: use , / or boolean operaters. and(test1,test2...) checks see whether each of test1 & test2 true (can hold many arguments need). ie: =if(and(a1="dog",b1="cat"),"there cat , dog", "there not both cat , dog") or(test1,test2) checks see whether either test1 true, or test2 true, or if both true. ie: =if(or(a1="dog",b1="cat"),"there either cat, or there dog, or both","there neither cat nor dog") another broad option 'nest' 1 if statement inside of another. ie: =if(a1="dog",&

sql - raiserror shows one message, but not another -

i have code: declare @timestamp varchar(20), @latestfeed int, @largestkeyprocessed int, @nextbatchmax int, @rc int; set @timestamp = cast(current_timestamp varchar(20)); set @latestfeed = (select max([feed_id]) [dbo].[caqh_resp_all_test_mirror]); set @largestkeyprocessed = (select min([record_id]) - 1 [dbo].[caqh_resp_all_test_mirror] [feed_id] = @latestfeed); set @nextbatchmax = 1; set @rc = (select max([record_id]) [dbo].[caqh_resp_all_test_mirror]); raiserror(@timestamp, 0, 1) nowait raiserror(@largestkeyprocessed, 0, 2) nowait while (@nextbatchmax < @rc) begin begin try --do stuff commit transaction flaghandling raiserror('transaction committed', 0, 3) nowait raiserror(@timestamp, 0, 4) nowait raiserror(@largestkeyprocessed, 0, 5) nowait end try begin catch --catch stuff end catch end it seems run fine, has couple of things seem odd me. @ outset, prints date i'd

asp.net - How to filter only first row of dataview -

i have dataview object in asp.net 3.5, , need put filter on in such way keep first row on dataview. i've searched ways this, far no luck. .rowfilter property seems work criteria, , not looking for. need eliminate rows except first one. in comments can see have statement dv.table = sourcetable; just first row dv.table = (new datarow[] { sourcetable.asenumerable().elementat(0) }).copytodatatable();

ruby on rails - how to show latitude, longitude information in Gmaps Heatmap -

i integrating gmaps heatmap ruby on rails able plot data on unable show latitude, longitude , place information in pop-up box. following method in controller , have defined in route.rb def plot_map @records = place.where("keyword_id = ?",params[:place_keyword_id]).order("created_at desc") @places = gmaps4rails.build_markers(@records) |user, marker| marker.lat user.latitude marker.lng user.longitude end i have view plot_map.html.erb <script> $(document).ready(function() { var mylatlng = new google.maps.latlng(25.6586, -80.3568); // map options, var myoptions = { zoom: 3, center: mylatlng }; // standard map map = new google.maps.map(document.getelementbyid("map-canvas"), myoptions); // heatmap layer heatmap = new heatmapoverlay(map, { // radius should small if scaleradius true (or small radius intended) "radius": 2, "maxopacity": 1, // scales radius based

java - Not able to display very large calculation value in editext -

private textview info; private edittext input; private button getinfo; long answer; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); getinfo = (button) findviewbyid(r.id.button1); getinfo.setonclicklistener(new onclicklistener() { public void onclick(view v) { input = (edittext) findviewbyid(r.id.edittext1); string s2 = input.gettext().tostring(); long inputnumber = integer.parseint(s2); (int = 0; <= inputnumber; i++) { answer = fibonacci(i); } input.settext(answer + ""); } }); } public static long fibonacci(long n) { if (n == 0) { return 0; } else if (n == 1) { return 1; } else { return fibonacci(n - 1) + fibonacci(n - 2); } } i made program generates fibonacci series number give input through edit text , display

Is there an easy way to count different matches with one SQLite query? -

i have sqlite table, , 3 different queries, pseudosql... select count(*) mytable day=today , cola = "xxx"; select count(*) mytable day=today , colb = "yyy"; select count(*) mytable day=today , colc = "zzz"; i want know if there matches (and if so, column) today. there better way this? select sum(o.a) a, sum(o.b) b, sum(o.c) c ( select case when t.cola = 'xxx' 1 else 0 end a, case when t.colb = 'yyy' 1 else 0 end b, case when t.colc = 'zzz' 1 else 0 end c mytable t t.day = today ) o ;

node.js - Mongoose Exclude a field if it doesn't match but not the doc -

i've got invitation system , want know if user has been invited or not. every time user invited, notification array updated targeted offer's id. model ... notification:[ { offer: {type:schema.types.objectid, ref:'offer'}, invitor:{type:schema.types.objectid, ref:'user'}, createat: {type:date, default:date.now()} } ] .... so goal when query user display notification field if offer's id in notification's array , not if doesn't contain it.

excel - How to create Vlookup formula to replace old data with new one -

my company receives weekly updates different providers.they give same type of data in different order ( ex: 1 company give column a= name / column b= quantity / column c= cargo. when other give column a= cargo / column b= name / column c = quantity ) . think need create vlookup formula automatically find new data, , replace old 1 in right place(if data changed last week). understand formula have different every provider since have different format. me, ll write order of columns in our template, followed order of 1 of providers: our template a:reference number b:imo c:vessel name d:commodity e:product detail f:quantity g:departure country h:departure port i:eta j:etb k:etd l:current status m:destination continent n:destination country o:destination port p:charterer q:receiver providers template: b:vessel name c:eta d:etb e:etd f:departure country g:departure port h:destination continent i:destination country j:destination port k:commodity l:product detail m:quantity n:name of

kairosdb - Kairos DB POST Query in Python -

i trying post query in python data kairosdb: meterreading metric created. import urllib import urllib2 url = 'http://localhost:8080/api/v1/datapoints/query' values = { "start_absolute": "1430454600", "end_relative": { "value": "5", "unit": "days" }, "metrics": [ { "tags": { "phase": [ "769" ], "uom": [ "72" ] }, "name": "materreadings", "aggregators": [ { "name": "sum",

android - Not able to get backup of SVN repository -

Image
i want have svn directory backup in local system , import in androidstudio so using command : svnadmin hotcopy ~/svn_directory ~/desktop/ this giving error : svnadmin: e000002: can't open file '/home/kushalgandhi/svn_directory/format': no such file or directory i checked in svn_directory there no format folder. why command searching format named folder not existing? what reason above error? svn export ~/svn_directory ~/desktop/ this command creates clean copy of svn code in ~/desktop/ directory. clean copy means output not have svn controlling files (like green mark or red mark ) thank you

java - JPA get the previous and next record in select -

i have jpql query retrieves sorted list of entities database. have id of 1 of these entities. how can previous , next record record known id in select? select distinct n news n inner join n.author inner join n.tags t a.id = :authorid , t.id in :tagsid order size(n.comments) desc news has 1 author, many tags , comments. select news given author , tags , order them count of comments them. while using jdbc i've solved such problems using rownum . can position(rownum) of record in result using jpa? if knew record's position define first result position - 1, , max results 3 given query. how previous, current , next news. are there other solutions, except iterating through list of news?

javascript - is localstorage also user specific by default? -

i storing data in local storage using localstorage.setitem("key","value") i understand localstorage browser specific, value remain after login different user (sharepoint) in same browser? as far know localstorage persistent until user clears it and read in this question that duration in dom storage not possible specify expiration period of data. expiration rules left user. in case of mozilla, of rules inherited cookie-related expiration rules. because of can expect of dom storage data last @ least meaningful amount of time. so mean local storage browser specific? ie if login different user in sharepoint, localstorage values still remain if use same browser? (given dont clear in log out/log in actions in sharepoint) i understand localstorage browser specific, value remain after login different user in same browser? yes. definitely. it has nothing php sessions or like. nothing. localstorage attached browser. log i

foreach - C# bool file name -

i have code: bool containsnonallowedcleofiles = directory.enumeratefiles().any(file => !allowedcleofiles.contains(file.name)); if (containsnonallowedcleofiles == true) { //how can print file names foreach? example foreach () { messagebox.show(string.join(", ", unallowedcleofiles))); //print after comma unallowed files, how to? } } it must print "containsnonallowedcleofiles" files name. thanks you not need loop. you have use where() filter files: var nonallowedcleofiles = directory.enumeratefiles() .where(file => !allowedcleofiles.contains(file.name)); and check if record found show file names delimited comma : if(nonallowedcleofiles.any()) messagebox.show(string.join(", ", nonallowedcleofiles.select(x=>x.name)));

oracle12c - getParameterMetaData() throws java.sql.SQLSyntaxErrorException: ORA-00904: "F": invalid identifier -

i have written simple program in java, creates connection oracle database , executes update query. the query gets executed successfully, if update query contains column starting "f" preparestatement.getparametermetadata() throws exception "java.sql.sqlsyntaxerrorexception: ora-00904: "f": invalid identifier". if remove column starting "f" preparestatement.getparametermetadata() executes correctly. my configruation is, oracle: 12.1.0.2 jdk: 1.8 ojdbc driver: ojdbc7.jar (included in 12.1.0.2) i found same issue ojdbc6.jar well. is there issue driver? code: public class testdriver { public static void main(string args[]) { string sql = "update test set test1 = ?, fun=? test2 = ?"; preparedstatement ppt = null; connection connection = null; try { class.forname("oracle.jdbc.driver.oracledriver"); connection = drivermanager.getconnection( "jdbc:orac

arrays - how to use arraylist to display questions using jsp -

i creating website using jsp, servlet, dbao(jdbc) , database in eclispe j2ee, , feature survey questions. not sure how create arraylist in jsp page store questions in database, when there new question not need hardcode question. result want able display questions using arraylist in jsp page. how should that? if understand correctly, have, or want create database questions survey. want dynamically populate web page these questions. there several ways so. i'll talk 2 of them, question broad, not full implementation, conceptual explanation. have learn more seperate libraries , elements mention. in both cases, data formed on server side, sent client, , parsed , displayed on client side. 1. javabeans , jstl if survey questions defined string only, no other attributes needed (like type of question, possible set of valid multiple choice answers, etc) can define arraylist<string> , , send through httprequest/response of java servlet. if questions objects of multiple

php - Query missing months in which we haven't sold anything? -

my query is: $sql="select count(`variant`) tsold, monthname(`sold_date`) mname `vehicle_sold` group month(`sold_date`) "; $result = mysqli_query($conn,$sql); while($row = mysqli_fetch_array($result)) { echo $row["mname"],"---", $row["tsold"],"<br />"; } which gives me below result: january---1 february---2 march---7 april---11 may---6 july---1 there no sales in june want query return "june---0" example. if shows next months december it's ok. i'd following output: january---1 february---2 march---7 april---11 may---6 june---0 july---1 aug---0 sept---0 oct---0 nov---0 dec---0 i assume have no data in database if did not sell anything. hence bit hard generate month without info. you want array months, corresponding amount of sales. suggest make this: prepare array months values on 0 default (you can make array list 'nicer', example). $data['march'] = 0; $

objective c - Insert row in UiTableView does not update rest cell’s indexPath? -

say i’m loading uitableview each uitextview inside each cell subview.and i’ve assigned indexpath.row tags each textview. -(uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { static nsstring *cellidentifier = @"userdetails"; uitableviewcell *cell = [[uitableviewcell alloc] initwithstyle:uitableviewcellstyledefault reuseidentifier:cellidentifier]; uitextview *textview=[[uitextview alloc]initwithframe:cgrectmake(0, 0, self.frame.size.width, 60)]; nsstring * mystring = [contentarray1 objectatindex:indexpath.row]; textview.text= mystring; uitapgesturerecognizer *taprecognizer = [[uitapgesturerecognizer alloc] [taprecognizer setnumberoftouchesrequired:1]; [taprecognizer setdelegate:self]; textview.userinteractionenabled = yes; textview.tag = indexpath.row;//assign tags textview [textview addgesturerecognizer:taprecognizer]; [cell addsubview:textview]; return cell; } bel

Joomla! Contact form inside an article, can't get action php file working -

i'm trying create contact form on own. noticed can achieved placing form inside article, instead of custom html module. in client side, seems work. added captcha manually (the re-captcha plugin doesn't seem work me). problem is, set form's action property "mail.php", , added "mail.php" file the template root. "mail.php" supossedly retrieves data send post, , composes , sends email, showing "message send" notification. anyway, when click on submit, form page reloaded. guess joomla! can't find "mail.php". guess issue related joomla structure , inability place "mail.php". wellcome. this how article looks (wysiwyg editor mode disabled): <form action="mail.php" method="post" target="_blank"> <p><label for="nombre">nombre:</label></p> <p><input maxlength="50" name="nombre" size="30" type="text

java - How make a regurlary task in a android thread? -

this question has answer here: how execute async task repeatedly after fixed time intervals 4 answers i try make asynctask can regularly code of web page. can 1 time doinbackground method can not execute several times :/ can me please ? thanks as mentioned here: repeat task time delay? should use handler class :-)

ios - How to show viewcontroller from the view? -

i searched answers get uiviewcontroller uiview? , couple of other answers not successful. my issue have button in uiview lets class1 , when click on button want load view class2 uiviewcontroller , , don't navigationcontroller in class1 unable load class2 view. please me this. thanks, in advance. in general uiviews should not contain logic triggers flow of app. job of uiviewcontrollers . it's way of making design of code better , more organized. one way use use delegate pattern in custom uiviews. here s simple setup: in mycustomview .h file: @class mycustomview; @protocol mycustomviewdelegate <nsobject> @optional - (void)myviewdidtaponbutton:(mycustomview)mycustomview; @end @interface mycustomview : uiview @property (weak, nonatomic) id <mycustomviewdelegate> delegate; @end in mycustomview .m file: - (ibaction)didtapmybutton:(id)sender { if ([self.delegate respondstoselector:@selector(myviewdidtaponbutton:)]) {

android - onDestroy gets called whenever screen turns off -

i aware of fact problem has been reported earlier , have used recommended solutions none has helped far. as mentioned in title, ondestroy() called every time screen turns off. doesn't happen if service on. application has fixed orientation , hence android:screenorientation="portrait" as per earlier suggestions, added android:configchanges="orientation|keyboardhidden" etc. implemented onconfigurationchanged() never gets called. two important points: we facing problem on 1 device in our test setup, samsung duo running 4.0.4. on other devices, not issue. this issue not happening other apps running on same device. will appreciate help. thanks update : seems setting these flag causing issue. removing them solves used reason other insight appreciated. intent.flag_activity_single_top | intent.flag_activity_no_history

javascript - Asp Radiobuttonlist causing postback even after returning false from js -

html: <asp:radiobuttonlist id="rdstatus" runat="server" height="48px" repeatdirection="horizontal" autopostback="true" onselectedindexchanged="rdstatus_selectedindexchanged" cssclass="rad"> <asp:listitem text="active" value="1"></asp:listitem> <asp:listitem text="deactive" value="0"></asp:listitem> </asp:radiobuttonlist> jquery: $(".rad").click(function () { return confirm("do want change status?"); }); it causes postback irrespective of whether click ok or cancel in confirmation box. <script type="text/javascript"> $(document).ready(function () { $(".rad").click(function () {

php - Failed to connect to MYSQL, What did i do wrong? -

i need assistance setup website. cant connect mysql, , ask did wrong? <?php $sitename = "csgoprofit.dk"; $link = mysqli_connect("host", "name", "pass", "database") or die("error " . mysqli_error($link)); $dbname = "u587432735_db"; $db_selected = mysqli_select_db($link, $dbname); mysqli_set_charset("set names utf8"); if (mysqli_connect_errno()); { echo "failed connect mysql: " . mysqli_connect_error(); exit(); } function fetchinfo($rowname,$tablename,$finder,$findervalue) { if($finder == "1") $result = mysqli_query($link, "select $rowname $tablename"); else $result = mysqli_query($link, "select $rowname $tablename `$finder`='$findervalue'"); $row = mysqli_fetch_assoc($result); return $row[$rowname]; } ?> mysqli_query() expects parameter 1 mysqli, null given in <b>/home/u587432735/public_html/set.php</b> on line <b>

Redis-cli && bash find keys with empty values -

how can find elements in redis empty have keys this: setting:1 setting:2 setting:442 etc how can search redis-cli bash script command if key contains empty value redis-cli keys \* | xargs -l 1 redis-cli get grep , check if value empty found solution redis-cli keys "settings:*" | xargs -l 1 redis-cli the notion of empty key in redis non-existent - there no empty keys in redis. if key "becomes" empty (e.g. list popped final element), key not exist in redis anymore. here's example: foo@bar:~$ redis-cli 127.0.0.1:6379> exists foo (integer) 0 127.0.0.1:6379> rpush foo bar (integer) 1 127.0.0.1:6379> exists foo (integer) 1 127.0.0.1:6379> lpop foo "bar" 127.0.0.1:6379> exists foo (integer) 0 127.0.0.1:6379>

how to store json object in a variable and use globally in other functions in swift -

var drivers : nsarray? func loaddriversrest() { restapimanager.sharedinstance.getdriverlist{ json in var drivers = json println(drivers.description) } func getdriverfromid(id: int?) -> string { if id == nil { return "no driver assigned" } else{ drivers.["name"] as! string } return "test" } i don't know want do, there lot of options. can use nsuserdefaults(). did in case user's domains: private let domain_prefix = "domains_" private let domain_delimiter = "|" private let defaults: nsuserdefaults init() { defaults = nsuserdefaults.standarduserdefaults() } func getdomains(user: string) -> [string] { if let domains = defaults.valueforkey("\(domain_prefix)\(user)") as? string { return domains.componentsseparatedbystring(domain_delimiter) } return [string]() } func savedomains(domains : [string

c# - Determine datatype parameter for generic used in interface -

i struggling find elegant solution in determining data type in interface used generic parameter in abstract class. abstract class: public abstract class entity<t> { /// <summary> /// object identifier /// </summary> public t id { get; set; } } concrete class: public class department: entity<int> { // additional properties } public class employee: entity<long> { // additional properties } interface implementation: public interface iservice<t1, t2> t1 : entity<?> t2 : entity<?> { task transferemployeetodepartment(? departmentid, ? employeeid); } a solution problem send data type additional parameter personal , ocd reasons prefer not so. there way solve this? agree dennis comment. according method name transfer concrete class employee concrete class department . there nothing generic here. if want transfer these 2 entities code should this public class department: entity<int> {

c++ - Qt QCompleter can't have its size set? -

i have qcompleter attached qlineedit , works fine, except suggestion popups width of line edit, while need them wider. there aren't methods in completer seem allow me change this. can do? you can subclass qabstractitemview in can set width , set customized class qcompleter::setpopup(qabstractitemview * popup)

cordova - fading popup using jquery mobile on a phonegap app -

i've got popup invoked following: $( "#popupid" ).popup("open"); which like: <div data-role="popup" id="popupid" class="ui-content"> </div> is possible make fade in , fade out automatically? i'm using jquery mobile on phonegap app. just simple: add in html data-transition="fade" like <div data-role="popup" data-transition="fade" id="popupid" class="ui-content"> </div> then logic automatic popup('open') , popup('close') it works 100%

javascript - How to take the inner text of id and assign it to a specific variable only for a specific inner text -

i have different pages populate div tag specific id based on id inner text: here different example of pages div: <div id="id_name">text page1</div> <div id="id_name">text page2</div> <div id="id_name">text page3</div> i want take inner text of second , fill variable. i try use this: if($("#id_name").length > 0 && $("#id_name").text() === "text page2") { site.text = $("#id_name").text(); } do not use same id multiple elements. see why bad thing have multiple html elements same id attribute? use classes instead you can use :contains() if ($(".class_name:contains(text page2)").length > 0) { $('body').text("text page2"); } <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script> <div class="class_name">text page1</div> <d

object - variables declaration with same name C++ -

is allowed? class a{ ... ... }; a; //global object int main() { a; // local object . . . . return 0; } here global object has been declared after class definition, local variable has been declared. ok? why? it's legal "hide" declaration of object, declaration in tighter scope. within main function, a refer local variable. outside main function, a refer global variable. as whether it's "ok" - "no". it's bad idea, in it's make code confusing, , more prone accidentally introducing bugs. wouldn't advise doing it.

sql - GROUP BY not working in left join query -

i m trying use group clause in left join sql query , not working. please me out, in advance. select cust_mst_det.cust_hd_code, cust_mst_det.first_name, sl_head20152016.vouch_date invoice_2, sl_head20142015.vouch_date invoice_1, cust_mst_hd.email cust_mst_det left join sl_head20142015 on cust_mst_det.cust_hd_code=sl_head20142015.member_code left join sl_head20152016 on cust_mst_det.cust_hd_code=sl_head20152016.member_code left join cust_mst_hd on cust_mst_det.cust_hd_code=cust_mst_hd.cust_hd_code cust_mst_det.first_name!='nil' group cust_mst_det.cust_hd_code order sl_head20152016.vouch_date desc, sl_head20142015.vouch_date i'm not sure dbms using, on oracle query not work @ all. first issue: group statement used in conjunction aggregate functions group result-set 1 or more columns. not have aggregating function in select statement (count, max, etc.) second issue: must specify columns select statement in group statement

javascript - Highcharts column tooltip - always on top + fit the container -

Image
i have highchart graph tooltips. how want render tooltips every time. when tootlip doesn't fit svg container, highcharts swaps position of tooltip this. i know how fix when this. positioner: function(boxwidth, boxheight, point) { return { x: point.plotx, y: point.ploty - boxheight }; }, tooltip correctly on top, overflows right(image_1). have tooltip on top + fit container sides. (image_2) is there easy way achieve this? thanks ( http://jsfiddle.net/4xomw3aj/ ) ok found out how 'not swap'. in tooltip.getposition() firstdimension = function (dim, outersize, innersize, point) { ret[dim] = point - distance - innersize; },

actionscript 3 - AS3 MouseMove laggy issue with transparency on FireFox -

i'm using custom cursor when hovering movieclip using mouse_move spectrum.addeventlistener(mouseevent.mouse_move,function(e:mouseevent):void{ mouse.hide(); mousecursor.visible = true; mousecursor.startdrag(true); mousecursor.mouseenabled = false; mousecursor.mousechildren = false; e.updateafterevent(); }); when set wmode='transparent' mouse_move still works smoothly on chrome , ie, on firefox cursor becomes super laggy when hovering movieclip..any ideas why? i tried enterframe custom cursor, it's laggy.. if set wmode ='window' mouse_move works again, , not laggy anymore.. why mousemove become laggy when setting wmode='transparent' on firefox ? can me ? i'm not sure problem wmode = transparent! rather starting drag, should rather either start once , stop when dont need anymore or just set cursors position rather using drag. spectrum.addeve