Posts

Showing posts from May, 2011

gruntjs - Pass in param to 'Grunt watch' for directory -

i use grunt less>css, minification, , concatenation of css , js. wondering if it's possible pass in param when type in "grunt watch" directory watch. way can have multiple versions of site running off same gruntfile. http://pastebin.com/b2fj74sc you can use node's process.argv command line arguments. the code below can called with: grunt watch --dir myfolder grunt.registertask('watch', function() { var args = process.argv; var folder = args[args.indexof('--dir') + 1]; console.log('watch folder: ', folder); // "watch folder: myfolder" });

java - MySQL JDBC Inactive Connection Timeout -

i have java (swing) desktop connected godaddy mysql database (online database). till time database offline, not @ problem, exception when try access menu involves database access. also, create static connection object when application start, , never close when application running. this description of exception, please if can. thanks :) com.mysql.jdbc.exceptions.jdbc4.communicationsexception: communications link fai lure last packet sent server 47 ms ago. some more stack trace , chained cause caused by: java.io.eofexception: can not read response server. expected read 4 bytes, read 0 bytes before connection unexpectedly lost. i assuming on shared hosting. connecting such hosting publicly not advisable. dealing problem seems problem remote sql. there few things can 1. go cpanel or equivalent , navigate remote sql add address 0.0.0.0 allow connections public ip may want connect it. if using vpn aws have manually edit my.cnf or my.ini depending on weather hosted on...

How can I change the font size of a label in vaadin in a layout-engine-friendly fashion? -

say have label: label mylabel = new label(_("i smaller normal text")); mylabel.setsizeundefined(); (where _ favorite localization function). i'd smaller usual. since there no ad-hoc label method accomplishing must resort adding "raw" css rules, example so: cssinject csssmall = new cssinject(".small { font-size: small; }"); mypage.addcomponent(csssmall); mylabel.addstylename("small"); mypage.addcomponent(mylabel); that sort of works. yes, text is smaller, when page first built, vaadin sizes label if font regular sized. when causes page repainted/relaid out, vaadin realizes what's going on , gives correct size label. this causes page "jump" noticeably label becomes both shorter , not tall. how can work around this? since situation seems desperate , themes no option wrap content label in html (make class, if need more once). it (this groovy, it's easy translate java or whatever using: new label...

mongoose - MongoDb Duplicate Entry Error -

hi why i'm getting duplicate entry errors. check in advance if document in database. model requires uniqueness idname . load data json array, prooven false, there no entries true. async.map recipe.zutaten, (ingredient, cb) -> #save ingredients ingredient.idname = ingredient.name.replace(/[^a-za-z0-9]+/gi, "").tolowercase() ingredientmodel.find({ idname: ingredient.idname }, (err, ingredientfound) -> return next err if err ingredientsjson = {"idname":ingredient.idname, "name":ingredient.name, "amount":ingredient.amount} #if found pass recipes if ingredientfound? && ingredientfound.length > 0 ingredientsjson.prooven = true return cb null, ingredientsjson #if not found evaluate if save else #if not prooven add json recipes if(ingredient.prooven? && ingredient.prooven == false) ingredientsjson.prooven = false retur...

python - Creating database with SQLAlchemy in Flask -

i'd know, need create sqlalchemy database in flask. according documentation should create model in flask app , go python shell , create using db.create_all() . doesn't work. my flask app: import os import flask import settings flask_sqlalchemy import sqlalchemy app = flask.flask(__name__) app.config['session_type'] = 'filesystem' app.secret_key = os.urandom(24) app.config['sqlalchemy_database_uri'] = 'sqlite:////database.db' db = sqlalchemy(app) (...) model: from app import db class user(db.model): id = db.column(db.integer, primary_key = true) username = db.column(db.string(15), unique = true) password = db.column(db.string(15), unique = true) tasks = db.relationship('task', backref='author', lazy='dynamic') def __init__(self, username, password): self.username = username self.password = password class task(db.model): id = db.column(db.integer, primary_key = true) ...

resources - Changing the URL/IP of angularjs ngresource in ionic -

i use user selected ip address change rest url more 1 time, may have serval server ip addresses, after factory file loaded after app start, ip addresses ($rootscope.baseurl) cannot changed. is there anyway can change path again? p.s. console.log("$rootscope.baseurl") can output value, after return part, not working. controller: $scope.authenticateuser = function(){ $rootscope.$broadcast('ipchanged', $scope.user.ip); } factory: .factory( 'models', function ($rootscope, $resource, constants) { $rootscope.$on('ipchanged', function(event, data) { $rootscope.baseurl = "http://" + data + "/rest" console.log("$rootscope.baseurl") }); return{ appmaster_user_session: $resource($rootscope.baseurl + '/user/session', { app_name: constants.api.appname }, { '...

windows - MySQL driver build -

i have big project qt 4.7.1 , mingw 4.4.0 . problem: project builds , running in release mode, if run in debug mode fails on mysql connection , says have no mysql driver installed(qmysql4 d .dll). elder version of mingw wont build dll error "unrecognized command line option '-wl'". follows this article. also, can't use newest qt , mingw versions reason. question: possible make mysql driver old g++ version?

get TYPO3 Extbase Repository items in other languages -

how can items extbase respository in different language? what tested: findbyuid($childuid) $query->getquerysettings()->setrespectsyslanguage(false); $query->getquerysettings()->setsyslanguageuid(3); but result parent (lang) object. i tried "matching" , "statement" result query uses active language or searches sys_language_id in (0,-1) = (default/all). it seems bug in extbase not removed until typo3 7.1: https://forge.typo3.org/issues/45873 for me solves problem: https://forge.typo3.org/issues/45873#note-27 after modification possible translated objects repository (e.g byuid or in own query) (copied linked page, 07.04.2015) 1.hack extbase in extension (in ext_localconf.php) register "customqueryresult" class: // code below no public api! /** @var $extbaseobjectcontainer \typo3\cms\extbase\object\container\container */ $extbaseobjectcontainer = \typo3\cms\core\utility\generalutility::makeinstance('typo3\\c...

c - How to pass N bytes of parameters to a function called by pointer -

my software drive embedded device run c code on ti dsp tms320f2812. the communication done via usb serial port emulation. at point, device side, need parse message means "call function @ given address given parameters". message contains: 4 bytes function address. 1 byte parameter(s) size (in byte). n bytes parameter(s) data. here code use: typedef void (*void_fct_void) (void); typedef void (*void_fct_int16) (int16); typedef void (*void_fct_int32) (int32); typedef void (*void_fct_2int32) (int32, int32); ... uint32 address; uint16 sizein; address = hw_usb_read_4bytes(); sizein = hw_usb_read_1byte(); switch(sizein) { case 0: ((void_fct_void) address)(); break; case 2: ((void_fct_int16) address)(hw_usb_read_2bytes()); break; case 4: ((void_fct_int32) address)(hw_usb_read_4bytes()); break; case 8: ((void_fct_2int32) address)(hw_usb_read_4bytes(), hw_us...

wcf - Running several update stored procedures in C# code -

i have rest wcf service depend on pass update method going update column. example can update addresses, phone numbers, emails,... each of these updates run own stored procedure update. not sure if code ok problem happened when 2 users try update email address @ exact same time, updates second user email address 1st user. public model.returnresponse updatecustomerprofile(model.customer customerdata) { model.customer customer = getcustomerinfo.instance.returncustomerinfo(); model.returnresponse rs = new model.returnresponse(); dal.datamanager dal = new dal.datamanager(); foreach (var pr in customerdata.gettype().getproperties()) { string name = pr.name; object temp = pr.getvalue(customerdata, null); if (temp int) { int value = (int)temp; if (value != 0) { ...

android - Application working on most of the devices but not on some -

my application works users functionality isn't working. how after this, when application working fine me , of users , not some. how debug it? you use bug tracking tool. using one, it's easy use: splunk mink there others instabug, appsee or others. the deal such tracking tools live data app usage, errors, crashes , other useful information can use improve app.

c# - Linking two lists efficiently -

i have 2 lists: products a list of product , warehouse combination containing prices/quantities etc. two seperate results of sql queries. the second list has 'productid'. what i'm doing is: foreach(var product in products) var productwarehouses = warehouses.where(x=> x.productid == productid).tolist(); product.warehouses = productwarehouses; thing is, takes very, long. note: i've tried splitting products chunks of lists , using parallel.foreach() , tasks take time down - still takes long. use join rather doing linear search through entirety of 1 collection each item in other collection: var query = product in products join warehouse in warehouses on product.productid equals warehouse.productid warehouses select new { product, warehouses, };

python - Using Fibonacci Program to Sum Even Elements -

i trying solve following using python: each new term in fibonacci sequence generated adding previous 2 terms. starting 1 , 2, first 10 terms be: 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ... by considering terms in fibonacci sequence values not exceed 4 million, find sum of even-valued terms. so far, have been able generate fibonacci elements in trying sum elements, code seems stall. here code below: def fib(n): if n==0: return 0 elif n==1: return 1 if n>1: return fib(n-1)+fib(n-2) n=0 total=0 while fib(n)<=4000000: if fib(n)%2==0: total+=fib(n) print(total) any suggestions welcome. you have infinite loop n isn't ever incremented 0 in while loop. additionally, why not sum fibonacci total as as find next fibonacci value in same while loop, this: x= 1 y=1 total = 0 while x <= 4000000: if x % 2 == 0: total += x x, y = y, x + y print (total) outputs: 4613732

java - PreparedStatement executeUpdate on an OracleDataSource connection does not auto commit -

call preparedstatement.executeupdate() returns (with count of rows updated). db not reflect update. seeing issue ojdbc7.jar (tried both java 7 , java 8 ses). final string update_sql = "update myportfolio set stock = ? key = ?"; final string stock = 'so';// pre ipo :) final long key = 12345l; try (connection conn = pds.getconnection(); preparedstatement proc = conn.preparestatement(update_sql)) { //conn.setautocommit(false); --> works conn.setautocommit(true); // default...but making sure proc.setstring(1, stock); proc.setlong(2, key); int rowcount = proc.executeupdate(); //conn.commit(); --> works logger.info("updated {} rows. sql = {}. stock = {}, key = {}, inboundkey = {}", rowcount, update_sql, stock, key); // logs 1 row updated. db still shows stale data (old stock) key 12345l. } catch (sqlexception e) { throw new persistenceexception(e); } // p...

sql - How do I remove redundant namespace in nested query when using FOR XML PATH -

update : i've discovered there microsoft connect item raised issue here when using for xml path , with xmlnamespaces declare default namespace, namespace decleration duplicated in top level nodes nested queries use xml, i've stumbled across few solutions on-line, i'm not totally convinced... here's complete example /* drop table t1 drop table t2 */ create table t1 ( c1 int, c2 varchar(50)) create table t2 ( c1 int, c2 int, c3 varchar(50)) insert t1 values (1, 'mouse'), (2, 'chicken'), (3, 'snake'); insert t2 values (1, 1, 'front right'), (2, 1, 'front left'), (3, 1, 'back right'), (4, 1, 'back left'), (5, 2, 'right'), (6, 2, 'left') ;with xmlnamespaces( default 'uri:animal') select a.c2 "@species" , (select l.c3 "text()" t2 l l.c2 = a.c1 xml path('leg'), type) "legs" t1 xml path('animal'), root('zo...

php - How to fix sub-query in LEFT JOIN in Codeigniter? -

i tried add in join sub-query: $this->db->join('stocks stn', 'stn.stocksidmf = (select medicalfacilities.medicalfacilitiesiduser medicalfacilities medicalfacilities.medicalfacilitiesiduser = stn.stocksidmf , stn.stocksenddate >= unix_timestamp() order stn.stocksid desc limit 1)', 'left', false);' but codeigniter spoils query. wrong in query? may somehow replace query?

c# - how customize filtering Client Template kendo grid column asp.net mvc 5 -

i have kendo grid contain column client template containing 3 type of icone, able filter column 3 icon didn't find solution question ? please me code: columns.bound(p => p.x).clienttemplate( " # if (x == -1) { # <img src='***** /> # } #" + " # if (x == 0) { # <img src='***# } #" + " # if (x == 1) { # <img src='**** /> # } #" ).filterable("???????").title("").width(20); columns.bound(c => c.code) .groupable(false); any please

shell - How I can Copy file by command line in android? -

i want copy file data/data/mypackage /mnt/sdcard when apply command line nothing happened. mobile rooted , have permeation make command.i have array list , put command inside array after command " getcommandstoexecute() " method , apply command: public final boolean execute() { boolean retval = false; try { arraylist<string> commands = getcommandstoexecute(); if (null != commands && commands.size() > 0) { process suprocess = runtime.getruntime().exec("su"); dataoutputstream os = new dataoutputstream( suprocess.getoutputstream()); // execute commands require root access (string currcommand : commands) { os.writebytes(currcommand + "\n"); os.flush(); } os.writebytes("exit\n"); os.flush(); ...

visual studio 2012 - TFS Process flow for fixing bug in older version -

scenario: i have bug fix in changeset 100. have 125 changesets. in middle of large changes. have production bug fix. requirement to put current changes on hold pull code changeset 100 (the current production code base) fix bug. recompile. deploy. resume work point 1. , ensure includes bug fix. presumed process flow shelve pending changes server (not locally...just make sure changes safe. source control > specific version , change set 100 fix bug....now i'm not sure of next steps.. check in; unshelve? or check in; latest (which bring me last change set 125) , unshelve? and how fixed bug code merged in?

arrays - How to implement a map or sorted-set in javascript -

javascript has arrays use numeric indexes ["john", "bob", "joe"] , objects can used associative arrays or "maps" allow string keys object values {"john" : 28, "bob": 34, "joe" : 4} . in php easy both a) sort values (while maintaining key) , b) test existence of value in associative array. $array = ["john" => 28, "bob" => 34, "joe" => 4]; asort($array); // ["joe" => 4, "john" => 28, "bob" => 34]; if(isset($array["will"])) { } how acheive functionality in javascript? this common need things weighted lists or sorted sets need keep single copy of value in data structure (like tag name) , keep weighted value. this best i've come far: function getsortedkeys(obj) { var keys = object.keys(obj); keys = keys.sort(function(a,b){return obj[a]-obj[b]}); var map = {}; (var = keys.length - 1; >= 0; i-...

postgresql - Rails and jsonb type "jsonb" does not exist -

psql --version psql (postgresql) 9.4.1 rails -v rails 4.2.0 i added jsonb column through migration class addpreferencestousers < activerecord::migration def change add_column :users, :preferences, :jsonb, null: false, default: '{}' add_index :users, :preferences, using: :gin end end i error : pg::undefinedobject: error: type "jsonb" not exist line 1: select 'jsonb'::regtype::oid any ? after looking around discovered postgresql version not 9.4 running right command postgres=# show server_version; server_version ---------------- 9.1 so had upgrade postgresql 9.4. by way followed this article upgrading found handy. now : postgres=# show server_version; server_version ---------------- 9.4.1 hope in same situation.

web scraping - Unordered .csv fields in scrapy -

i developing spider several fields scrapy framework. when export scrapped fields .csv file, fields (or columns) unordered, not defined them in items.py file. does know how solve issue? thanks in advance. class myspider(basespider): filehandle1 = open('file.xls','w') --------------- def parse(self, response): ----------- self.filehandle2.write("%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n"%(item['a'],item['h'],item['g'],item['f'],item['e'],item['d'],item['c'],item['b']))

android - FragmentPagerAdapter showing fragments wrongly in ViewPager -

i have actionbaractivity inside have viewpager . expect see 4 (first, second, third, four) fragments in 4 (first, second, third, fourth) pages. problem: i see second fragment on first page. i move second page. saw nothing. i move first page. saw second fragment. in oncreate() of actionbaractvity , have: mviewpager = (viewpager) findviewbyid(r.id.pager); mpageradapter = new mypageradapter(getsupportfragmentmanager(), mgoodarraylistofwords); mviewpager.setadapter(mpageradapter); this how mypageradapter looks: public class mypageradapter extends fragmentpageradapter { private arraylist<string> mwords; public mypageradapter(fragmentmanager fm, arraylist<string> words) { super(fm); mwords = words; } @override public fragment getitem(int position) { string specificword = mwords.get(position); return myfragment.newinstance(specificword); } @override public int getcount() { return ...

How make file system listing in Java Swing -

i need index whole file system, , convert xml. created code, produce out of memory error (heap). question how avoid error. due creating file1 object or vector match have set virtual memory again produce error @ 973. ` import java.util.vector; import java.io.bytearrayinputstream; import java.io.objectinputstream; public class filewalk { vector<file1> vs= new vector<file1>(); public void walk( string path ) { file root = new file( path ); file[] list = root.listfiles(); if (list == null) return; ( file f : list ) { if ( f.isdirectory() ) { walk( f.getabsolutepath() ); } else { file1 fv=new file1(f.getabsolutefile().tostring(),f.length()); --we change next string-- //mainrootelement.appendchild(getfile (doc, num++, f.getname(), f.length(), f.getabsolutefile());// } } } public static void main(string[] args) throws exception { filewalk fw = new filewalk(); file [] disks = file.listroots(); ( file d : disks ) fw.walk(d.tostring()); //bytearrayinputstream baos = new bytea...

How to add an arbitrary number of rows to a database in ASP.net MVC 4? -

i'm trying add unspecified number of rows database. these rows created dynamically user's request: $(document).ready(function () { $(document).on('click', '#datatable .add', function () { var row = $(this).closest('tr'); if ($('#datatable .add').length <= 100) { var clone = row.clone(); // clear values. var tr = clone.closest('tr'); tr.find('input[type=text]').val(''); $(this).closest('tr').after(clone); } }); // delete row if there exists more one. $(document).on('click', '#datatable .removerow', function () { if ($('#datatable .add').length > 1) { $(this).closest('tr').remove(); } }); }); so far using try , achieve list maximum value of 100 elements (which i'd prefer different method this, perhaps 1 no upper limit in meantime), ...

internet explorer - How to prevent SVG elements from gaining focus with tabs in IE11? -

there inline svg element among html form elements. when navigate through elements tab key, svg focused, in ie11 only, if svg element has tabindex="-1" attribute set every elements inside it: <svg width="20px" height="20px" tabindex="-1"> <g tabindex="-1"> <circle cx="8.5" cy="8.5" r="7.75" stroke="#999" stroke-width="1" tabindex="-1" /> […] </g> </svg> to sure it's focusing on element, call document.activeelement in console, , yes, prints out svg thing. internet explorer 11 should honor negative value, other dom elements, or not? can possibly prevent this? in case missed it, answer commented: tabindex part of upcoming svg2 , not yet supported ie11. have @ this question work-around. thanks @altocumulus

facebook - Reading user's posts to pages -

for given facebook user, there possibility read posts he's made pages? on fb web, these can found in activity log, far couldn't find method them via api. both /user/posts , /user/feeds contain status , profile updates, not posts pages. know can read /page/feed , use paging find user's posts page user likes, how doesn't? no, outside of fql, there nothing in api accomplishes this. i'd imagine pretty data intensive call minimal use cases however, don't think introduced anytime soon.

PHP email script not sending emails -

this question has answer here: php mail function doesn't complete sending of e-mail 24 answers this php email script want use website. creating website father's company, , decided make bootstrap. html , css knowledge required still do, beyond knowledge. somewhere on internet dug script , doesn't work me. sure there logical reason this, have no knowledge whatsoever of php-scripting... hoping newbie out. willing learn, study php simple script(i not planning more web "development") seems bit overexaggerating. anyway, rambling on much. here script found(i've called it: sendemail.php): <?php 'success', 'message'=>'thank contacting us. possible shall in touch ' ); $name = @trim(stripslashes($_post['name'])); $email = @trim(stripslashes($_post['email'])); $subject = @trim(stripslashes($_p...

c++ - how to read command output line by line in gcc in windows just as with the standard input? -

this tried: #include <iostream> #include <string> int main(int argc, char const *argv[]) { using namespace std; (string cin_line; getline(cin, cin_line);) { cout << cin_line << endl; } file* pipe = popen("app.exe", "r"); (string result_line; getline(pipe, result_line);) { cout << result_line << endl; } pclose(pipe); return 0; } it doesn't compile, result is: no matching function call 'getline(file*&, std::__cxx11::string&)' second example i've found here: https://stackoverflow.com/a/10702464/393087 seems mingw doesn't have pstream included: fatal error: pstream.h: no such file or directory - edit: ok know, missed not gcc library, named separate download: http://pstreams.sourceforge.net/ i know how using buffer , whole output on single line (like here: https://stackoverflow.com/a/478960/393087 ) explode line \n , array, point here must provide output input comes...

antlr4 - Why is this left-recursive and how do I fix it? -

i'm learning antlr4 , i'm confused @ 1 point. java-like language, i'm trying add rules constructs member chaining, that: expr1.methodcall(expr2).methodcall(expr3); i'm getting error, saying 2 of rules mutually left-recursive: expression : literal | variablereference | lparen expression rparen | statementexpression | memberaccess ; memberaccess: expression dot (methodcall | fieldreference); i thought understood why above rule combination considered left-recursive: because memberaccess candidate of expression , memberaccess starts expression . however, understanding broke down when saw (by looking @ the java example ) if move contents of memberaccess expression , got no errors antlr4 (even though still doesn't parse want, seems fall loop): expression : literal | variablereference | lparen expression rparen | statementexpression | expression dot (methodcall | fieldreference) ; why first example lef...

apache - Hadoop client not able to connect to server -

i set 2-node hadoop cluster, , running start-df.sh , start-yarn.sh works nicely (i.e. expected services running, no errors in logs). however, when try run application, several tasks fail: 15/04/01 15:27:53 info mapreduce.job: task id : attempt_1427894767376_0001_m_000008_2, status : failed i checked yarn , datanode logs, nothing reported there. in userlogs, syslogs files on slave node contain following error message: 2015-04-01 15:27:21,077 info [main] org.apache.hadoop.ipc.client: retrying connect server: slave.domain.be./127.0.1.1:53834. tried 9 time(s); retry policy retryuptomaximumcountwithfixedsleep(maxretries=10, sleeptime=1000 milliseconds) 2015-04-01 15:27:21,078 warn [main] org.apache.hadoop.mapred.yarnchild: exception running child : java.net.connectexception: call slave.domain.be./127.0.1.1 slave.domain.be.:53834 failed on connection exception: java.net.connectexception: connection refused; more details see: http://wiki.apache...

ios - In a UICollectionView, how can I get my cells to autolayout BEFORE they appear on screen? -

i have uicollectionview self sizing cells. when scroll through collection can see cells resizing @ bottom of screen. is there way can cells resize before appear? i using flow layout , cells contain 3 labels. using estimateditemsize.

asp.net mvc - Update Razor variable in foreach using button click -

okay, after lot of searching around haven't found answer problem. working on page who's main purpose display articles on main page. i got code down display articles, want display 6 first articles in foreach , user can chose increase display count 6 each time he/she clicks "show more articles" button. i using @foreach (var item in model.take(displayedarticles)) , var displayedarticles = 6; is there way user increase counter clicking "show more" button? having issues. my current code: <div class="container-fluid"> <h2 class="page-header">index</h2> @{ var displayedarticles = 6; } @foreach (var item in model.take(displayedarticles)) { <div class="col-lg-4"> <h2>@html.displayfor(modelitem => item.title) </h2> <div id="textcontent"> @html.displayfor(modelitem => item.content) </div> </div> } <div cl...

lotus notes - Adding days to @Today -

might silly question i'm trying add (for example) 2 days todays date via using @today. there way how without using @adjust in formula language? i don't believe there way in formula language other using @adjust. wonder reason avoid @adjust? in lotusscript there function cdat converts number date/time value. imagine cdbl function convert date/time number. assuming true, convert today's date number (of days since jan 1 1900) , add 2 it, , convert date.

xaml - How to change TextBox's Background color for the "Not selected state"? -

Image
i can change background color textbox , passwordbox in xaml in windows phone 8.1 project. noticed when textbox , passwordbox in "not selected state" (when i'm not typing in it) has light gray color. is there way change light gray color white? in app resources, override following properties: <x:double x:key="textcontrolbackgroundthemeopacity">1.0</x:double> <x:double x:key="textcontrolborderthemeopacity">1.0</x:double>

sql - select * from (select a,b,c ...) guaranteed order of result columns? -

i had comment in code review: it's better enumerate fields explicitly. "select *" doesn't guarantee order is true in case query select * (select a,b,c ...) ? can't imagine database engine re-order columns in result, imagination more logical database engines. the advice against select * when you're querying tables directly. in databases it's possible insert new column partway through table, such table t (a, b) becomes table t (a, c, b) . postgresql not (yet) support this, can still append columns, , can drop columns anywhere, can still t (a, c) if add c , drop b . this why it's considered bad practice use * in production queries, if application relies on ordinal column position read results. really, applies situations not specify fields elsewhere in query. in case in subquery. * safe , imo quite acceptable in usage. this: select * (select a,b,c ... t) is fine. this: select * t or select * (select * t) a...

javascript - Sorting icon issue with Jquery Datatable fixd header -

Image
i have follwoing script. it enables fixed header jquery datatable.. var alertion = 0; $(document).ready(function() { $(window).on('scroll', function() { var scrolltop = $(this).scrolltop(); var topdistance = $("#campaigns_list").offset().top; if(topdistance < scrolltop) { if($(".fixedheader").length == 0) { new $.fn.datatable.fixedheader(campaign_overview_table, {"offsettop": 82},{ "top": true }); } else { $(".fixedheader").not(':last-child').remove(); } } else { $(".fixedheader").remove(); } }); }); the datatable initialized way campaign_overview_table = $("#campaigns_list").datatable(); now every thing runs fine, ...

osx - change the color and the font of NStextView -

Image
i trying change color , font size of nstextview doesn't seem work.this code.i have checked other posts dont seem working.this code. var area:nsrange = nsmakerange(0, textview.textstorage!.length) self.textview.settextcolor(nscolor.graycolor(), range: area) self.textview.textstorage?.font = nsfont(name: "calibri", size: 16) you should use attributed strings: let textview = nstextview(frame: nsmakerect(0, 0, 100, 100)) let attributes = [nsforegroundcolorattributename: nscolor.redcolor(), nsbackgroundcolorattributename: nscolor.blackcolor()] let attrstr = nsmutableattributedstring(string: "my string", attributes: attributes) let area = nsmakerange(0, attrstr.length) if let font = nsfont(name: "helvetica neue light", size: 16) { attrstr.addattribute(nsfontattributename, value: font, range: area) textview.textstorage?.appendattributedstring(attrstr) }

how to create a regex for non-english letters with vba's regex 5.5 -

i'm working vba, , started using regex library, finding numerals and/or english text had no problem far, need use on text fields contain mix of numbers , hebrew letters (addresses has several possible formats). i have managed use in "dumb" way, can find literals , short patterns (such as, finding combination means postal box - 2 letter combined non-letter non number between them), can't use \w english - , make life whole lot better. is there anyway create "custom" regular expressions , save them variables? example make (a regex single hebrew word): regex.pattern = "(א|ב|ג|ד|ה|ו|ז|ח|ט|י|כ|ל|מ|נ|ס|ע|פ|צ|ק|ר|ש|ת|ם|ן|ף|ץ)+" and save \מ instance or \hw (short hebrew word), need make several types of patterns , several possible formats recognize, , save me lot of frustration (as ide don't have best interactions hebrew letters). you can create own character class, , use in code: dim hw string hw = "[אבגדהוזחטיכלמנסעפצקרש...

java - error in attribute extended from trait in scala -

i using scala , have trait attribute "name" extended trait in userclass accessing attribute when tried declare name in trait this val name : string it gave error in child class child class ha unimplemented member when tried val name : string = "" it worked fine please tell me difference , reason why not working before , why worked after modification i'm assuming code looks this: trait hasname { val name : string } class person extends hasname a trait is, nature, abstract , means allowed have unimplemented methods. in effect, trait declaring this: all classes extending hasname guaranteed have val name : string instance variable. in variable dependent on actual child class in case above, code expanded to: trait hasname { val name : string = ??? } where ??? means particular 'function' unimplemented. after modification: trait hasname { val name : string } class person extends hasname {val name :...

ios - I am trying to play audio from server using AVAudioPlayer, but file not Playing -

i trying make online audio player. can't paly audio using avaudioplayer object. please me. in advance. here audio player code. ================>> nsurl *url =[[nsurl alloc] initwithstring:@"my url"]; xplayer = [[avaudioplayer alloc] initwithcontentsofurl:url error:nil]; xplayer.numberofloops = 0; xplayer.volume = 1.0f; [xplayer preparetoplay]; [xplayer play]; q: avaudioplayer provide support streaming audio content? a: avaudioplayer class not provide support streaming audio based on http url's. url used initwithcontentsofurl: must file url (file://). is, local path. source: https://developer.apple.com/library/ios/qa/qa1634/_index.html

javascript - Play audio file on the server side using ElFinder -

i trying play .mp3 file on server side using elfinder. have created 2 instances of elfinder. how should play file 1 of instances on server side? here code handlers : { select : function(event, elfinderinstance) { var selected = event.data.selected; if (selected.length>0) { var filenamex=elfinderinstance.file(selected[0]).name; console.log(filenamex); var path=elfinderinstance.path(selected[0]); console.log(path); if(filenamex.indexof(".mp3") == filenamex.length - 4) { console.log("mp3 file"); } } } }, lang : 'en', customdata : {answer : 42}, rememberlastdir :false, debug:true })...

java - Tomcat caters to multiple user with same memory - JSP -

i have jsp web application, when try deploy tomcat server, , try run application different machines, dont new pages every user. my application takes input html input , keep in memory press of button, ao push values in memory , keeps untill reset pressed. problem comes when goto machine , run application, same modified page previous user. i have used session management keep username in session. if application not creating new session every new user request. eg: main.jsp has input fields , when click 'add' values html input stored in memory objects, , showed in html inputs till memory not cleared. now machine, access application , go main.jsp, there prefilled html input boxes. why not getting new page everytime go different machine. tomcat server serves users same memory space? sample code main.jsp <%@ page import="test.databaseaccessconnectionmanager" %> <%@ page import="test.functionkeywordmanager" %> <%@ page impo...

java - How to insert drm into html file programatically? -

here describing question in detail:- is there way insert drm html programmatically? secondly after inserting drm file shouldn't be allowed print , content shouldn't copied or pasted. and lastly don't want html user having permission remove code(drm). there way restrict user editing file? thanks in advance no way in sensible way. html text when transferred on network, can retrieve text , avoid "drm" contains. why think need protect html?

database - how to pass Empty string string into a xml file using Datastage? -

this xsd being used in job create xml output file fetching records tables: <?xml version="1.0" encoding="utf-8"? <xsd:schema xmlns:xsd="http://www.w3.org/2001/xmlschema" elementformdefault="qualified" attributeformdefault="unqualified" version="1.0"> <xsd:element name="manifest"> <xsd:complextype> <xsd:sequence> <xsd:element name="header"> <xsd:complextype> <xsd:sequence> <xsd:element name="submissiondate" type="xsd:date"/> <xsd:element name="submissiontime" type="xsd:time"/> <xsd:element name="requestingapplication" type="xsd:string"/> <xsd:element name="contenttype" type=...

ios - React cannot find entry file in any of the roots -

i using react native pod in ios project. when try load view created react native error screen referring me terminal window npm running. in terminal error seeing is: error: cannot find entry file in of roots: i tried few things, moving file different location, no luck. did run "npm start" , looking file in " http://localhost:8081/ ". current location of file in same location ran "npm start" from. i stuck here. did configure wrong. how can troubleshoot here? check node server running in 1 of bash terminal, kicked previous reactnative xcode project launched earlier. stop process , run xcode project again, should fix problem.

ruby on rails - Testing User Model (Devise Authentication) with MiniTest -

i'm trying test user model, i've devise authentication. the problem i'm facing is, 1. having 'password'/'password_confirmation' fields in fixtures giving me invalid column 'password'/'password_confirmation' error. if remove these columns fixture , add in user_test.rb require 'test_helper' class usertest < activesupport::testcase def setup @user = user.new(name: "example user", email: "example@example.com", password: "test123", work_number: '1234567890', cell_number: '1234567890') end test "should valid" assert @user.valid? end test "name should present" @user.name = "example name " assert @user.valid? end end the error i'm getting is: test_0001_should valid ...

node.js - cylon.js & arduino uno: execute program without cable connection to PC -

i new field, might odd question. can write code(say blinking lights) in aduino ide , upload arduino , can disconnect pc , program run. (blinking happen). when using cylon.js , write program , execute say $ node blinking.js then long arduino connected pc(or laptop) blinking happens , when kill node js or disconnect arduino pc blinking stops. (this how suppose happen, right?) so question is, if have arduino temperature sensor outdoor , have cylon.js program use sensor data , things (say print them), how can achieve ? have have 2 arduinos connected via wireless or gsm shields (one outdor , 1 connected pc cylon.js running)? or there simple way of doing this? insight on appreciated. thank you then long arduino connected pc(or laptop) blinking happens , when kill node js or disconnect arduino pc blinking stops. (this how suppose happen, right?) correct. true node.js program controlling arduino, whether cylon.js or johnny-five. if have arduino temperature...

javascript - TouchSwipe all events -

i trying handle events in function. in gamelogic function each type of event. although, tap doesn't recognized ... what should ? should separate each event ? $(function() { $(".main-wrapper-inner").swipe( { //generic swipe handler directions tap:function(event, target) { gamelogic("tap"); }, swipeleft:function(event, distance, duration, fingercount, fingerdata) { gamelogic("swipeleft"); }, swiperight:function(event, distance, duration, fingercount, fingerdata) { gamelogic("swiperight"); }, swipeup:function(event, distance, duration, fingercount, fingerdata) { gamelogic("swipeup"); }, swipedown:function(event, distance, duration, fingercount, fingerdata) { gamelogic("swipedown"); }, pinchin:function(event, direction, distance, duration, fingercount, pinchzoom,...

javascript - How do I save a sensitive access code safely on localstorage (or other DB)? -

i building ionic/ng cordova app want provide access views when user has entered access code correctly. upon first launch of app, user asked set access code. how use access code provide access views topic, investigate separately. for now, concerned how save access code secure on device, such users plug device usb computer cant read code or source code of app. i thinking write custom function transforms access code encrypted string, example: function encryptaccesscode(accesscode) { return accesscode.split("").reverse().join(""); } i worried however, can read source code of app , find function, able decrypt encrypted access code string. yes, jcubic says, if md5 original access code on first launch , store in localstorage, can compare md5 of code entered each time wish verify access - cryptojs nicely. if you're worried reading source code, obfuscate it. either use uglifyjs if build process automated or manually using online obfuscato...

twitter bootstrap - How to fire a keyboard shortcut function in JavaScript? -

i have record functionality in website. if user hits ctrl + alt + r recording begin. button named record in html page, when user hits button recording start. <button type="submit" class="btn btn-primary" data-toggle="tooltip" data-placement="top" onclick="record_session()" title="start recording">record</button> in function below function record_session(){ //how can trigger or initiate ctrl+alt+r here?? } if use jquery can add keypress event: $(document).keypress(function(e) { if (e.which === 114 && e.ctrlkey && e.altkey) { record_session(); } }); update : var enable_keypress = false; function record_session(){ enable_keypress = true; } $(document).keypress(function(e) { if (enable_keypress) { if (e.which === 114 && e.ctrlkey && e.altkey) { // ctrl+alt+r } } });