Posts

Showing posts from August, 2014

language translation - Symfony 2.6 - Use MySQL for translate strings -

i'm new in symfony 2 , i'm trying translate multiple strings menus , static content , symfony suggest use xliff. want web admin can add or delete languages in backend instead of edit code. know how can that, i'm looking bundle allows manage language want. there bundle allows manage language backend , add translations elements use on frontend dynamically? thank in advance! take @ lexiktranslationbundle .

c# - Anchor style of controls in dynamic panel is not working -

i have dynamic panel autosize prperty true , want resize control contains if form maximized/minimized. intially when panel added runtime has 3 controls. button on left (action_button) , text box (newproject_box) in middle , again button (expand_button) on right. when button(expand_button) on right clicked ,the new controls added -label 'note' , 'tag', datetimepicker 'start_calender , 'due_calender' , labels 'start_label' , 'du_label'. when 'note' , 'tag' clicked, text boxes appeared in there places these properties setting. action_button.anchor = (anchorstyles.left | anchorstyles.top); newproject_box.anchor=(anchorstyles.left | anchorstyles.right); expand_button.anchor = (anchorstyles.right | anchorstyles.top); collapse_button.anchor = anchorstyles.right; note_label.anchor = anchorstyles.left; note_box.anchor=(anchorstyles.left| anchorstyles.right); start_calender.an

vbscript - Download file from website with Batch -

i having problems downloading files internet using batch script. found following pieces of code - though none of them seem work xcopy /e /y "https://website.com/file.bat" wget.exe --no-check-certificate https://website.com/file.bat i trying make batch automatically fetch file, pretty clueless on how to. i open (explained simple) vbscripts too. in advance! this example download game.swf try , inspired : @echo off mode con:cols=70 lines=8 & color 9b title -==*==- batch downloader file hackoo -==*==- ( echo option explicit echo. echo dim message, result echo dim title, text1, text2 echo. echo message = "type url of file download." echo title = "download file url hackoo" echo text1 = "you canceled" echo. echo result = inputbox^(message, title, "http://www.gametop.com/online-free-games/anti-terror-force-online/game.swf", 900, 900^) echo. echo. echo if result = "" echo wscript.echo text1 echo el

VeraCode Scan: How can I "unpropose" 100+ flaws? -

i've submitted several proposals flaws wasn't aware veracode web ui keeps them in "memory" until commit them. happened have 100+ flaws contain 7 proposals (the first 1 one flaw itself, 6 others created selecting next flaw , proposing it). how can mass "unpropose" or clean flaw proposals (i.e. start over)? it's possible remove proposed mitigations 1 @ time, remove whole bunch of them @ once i'd suggest contact veracode support.

javascript - TinyMCE - how to add custom insert template button for each template -

Image
for keeping site responsiveness , applying standard grid system (i'm using zurb foundation) on custom user data entered on web application have defined templates in tinymce insert custom user data , pages on web application. includes 1 button in toolbar showing dialog selecting template , pressing ok after selected. default button provided templates plugin: this dialog shown: but need define custom toolbar buttons add custom templates when user press them without showing dialog . there right way on simple way in tinymce without writing of javascript codes? referring comment without writing of javascript codes you have write javascript create in tinymce, doesn't have complicated. simple , straightforward approach write plugin each toolbar button create. for instance plugin named "insert template x" be: tinymce.pluginmanager.add('test', function(editor, url) { editor.addbutton('test', { text: 'test',

c# - Export to Excel as a response in web API -

i using web api 4.5.1. generating api in c# code , passing api front end, front end built on html , angularjs javascript. requirement create api export excel front end. kind of stuck here. receiving request front end people fromdate , todate. based on query database data , if successful, html format out of it. unable go further new this. below code trying achieve with: [httppost] public httpresponsemessage exporttoexcel(string fromtimestamp, string totimestamp) { datetime fromdate = new datetime(1970, 1, 1, 0, 0, 0, 0, system.datetimekind.utc); fromdate = fromdate.addmilliseconds(convert.todouble(fromtimestamp)).tolocaltime(); fromdate.adddays(1); datetime todate = new datetime(1970, 1, 1, 0, 0, 0, 0, system.datetimekind.utc); todate = todate.addmilliseconds(convert.todouble(totimestamp)).tolocaltime(); todate.adddays(1); var fromdate1 = fromdate.adddays(1).tostring("yyyy-mm-dd"); var todate1 = todate.adddays(1).tostring("yyyy-mm-d

jpa - Need help converting Neo4j Cypher request to JPQL -

i have neo4j cypher request need convert jpql: match (p:person)-[:worksfororganisation]-> (:organisation)-[*0..2]->(:organisation) -[:possessesresource|:accessesresource|:supportsresource]->(:software) <-[:categorycontains]-(c:resourcecategory) id(p)=({personid}) return c this request starts unique person identifier personid . we know person works 1 (in rare cases, many) organisation s. we know each organisation can possess, access or support resource of type software . we want return resourcecategories "contain" software s person can use, given fact there may associations between different organisations, grant him/her right use software organisation. the difficulties convert jpql come : (:organisation)-[*0..2]->(:organisation) (:organisation)-[:possessesresource|:accessesresource|:supportsresource]->(:software) point 1 : (:organisation)-[*0..2]->(:organisation) means optional relationship between @ 3 "organisat

Hibernate Max value for each group -

i new hibernate. mapping between table , class given this. <?xml version='1.0' encoding='utf-8'?> <!doctype hibernate-mapping public "-//hibernate/hibernate mapping dtd 3.0//en" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> <hibernate-mapping> <class name="com.pathfinder.beans.location" table="vehicle_locations"> <id name="rowid" column="position_id"> <generator class="native"></generator> </id> <property name="vehicleid" column="vehicle_id"></property> <property name="latitude" column="latitude"></property> <property name="longitude" column="longitude"></property> <property name="time" column="time"></property> <property name=&q

jquery - Can't send value to my controller home.php using Ajax -

view page this ajax code block.i have pass value income_date controller function incomedate(income_date) { // alert(income_date); $.ajax({ type: "post", url: "<?php echo base_url();?>home/submit_income", data: {income_date:income_date}, success: function(res1) { } }); } i got income_date script var income_date=document.getelementbyid("dateval").value; function call here incomedate(income_date); controller home.php function submit_income() { $income_date=$this->input->post('income_date'); } instead of using this: url: "<?php echo base_url();?>home/submit_income", use this: url: "<?php echo site_url();?>home/submit_income", there high chances must have missed "index.php".(i m

multithreading - Threads not running in parallel -

consider following code, wish spin x threads, fire x requests specified server within code, @ current, application waiting each thread , x requests finish before spinning next one. how can go doing async? extern crate hyper; extern crate time; use hyper::client; use hyper::header::connection; use time::*; use std::thread; use std::sync::{arc, mutex}; struct request { elapsed_time: f64 } impl request{ fn new(elapsed_time: f64) -> request{ request { elapsed_time: elapsed_time, } } } fn main() { let requests = arc::new(mutex::new(vec::new())); _x in 0..100 { println!("spinning thread..."); let mut client = client::new(); let thread_items = requests.clone(); let handle = thread::spawn(move || { _x in 0..100 { println!("firing request"); let start = time::precise_time_s(); let _res = client.get("http://jacob.u

gulp concat js files into two min.js, lost library definition -

Image
i'm using gulp concat js library lib.js, , concat self-writing js files app.js, use gulp-inject inject index.html, chrome console shows error jquery not defined

javascript - Webdriverjs - By is not defined -

i using webdriverjs, open website , select element id. code is, var webdriverjs = require('webdriverjs'), client = webdriverjs.remote({desiredcapabilities:{browsername:'phantomjs'}}).init(); client.url('www.google.com', function(err){ client.findelement(webdriverjs.by.id('lst-ib')).sendkeys('duck duck go\n') }) it throws error as, webdriverjs.by undefined how use by function in webdriverjs ? i think can still use webdriverjs, example code has mistake https://code.google.com/p/selenium/wiki/webdriverjs the code in example driver.findelement(by.name("q")).sendkeys("webdriver"); driver.findelement(by.name("btng")).click(); should driver.findelement(webdriver.by.name("q")).sendkeys("webdriver"); driver.findelement(webdriver.by.name("btng")).click(); i not sure why incorrect on website.

Elasticsearch query speed degrade -

i have elasticsearch(1.5.2) cluster (2 node data) 218m docs (22.3gi). elastic setting default (5 shard , 1 replica), except memory: -xmx5g -xms5g my problem query request slow - 2sec. when index small ~10k doc requery time 100-200 ms. i'm running load of 50 concurrent users , time increase 10-20 sec. cluster machines: 2 dedicated vm nodes architecture: x86_64 cpu(s): 16 core(s) per socket: 8 vendor id: genuineintel model name: intel(r) xeon(r) cpu e5-2670 0 @ 2.60ghz memory: 16gb mapping: { "all": { "properties": { "schemarev": { "type": "long" }, "schema": { "index": "not_analyzed", "type": "string" }, "id": { "index": "not_analyzed", "type": "string"

Android How can I load every images from the drawable folder using file to set into the imageItems? -

how can load image drawable folder when don't know image file name. i want show drawable folder image in gridview. i know how load image file name, below: // imageitem method :public imageitem(bitmap imagebitmap, string title){...} private arraylist<imageitem> getdata() { final arraylist<imageitem> imageitems = new arraylist<>(); typedarray imgs = mcontext.getresources().obtaintypedarray(r.array.image_ids); for( int = 0 ; i< imgs.length(); i++ ) { bitmap bitmap = bitmapfactory.decoderesource(mcontext.getresources(), imgs.getresourceid(i, -1)); imageitems.add(new imageitem(bitmap, "image#" + i)); } return imageitems; } but if don't know file name(r.drawable.filename), how can load every images drawable folder using file set imageitems? thank much. field[] drawables = android.r.drawable.class.getfields(); (field f : drawables

java - How to create .jar library from class in Intellij IDEA -

i trying learn java , have implemented single, , simple, class in intellij idea 14.1.3. want able use class in other projects without copy , pasting class source each project src directory. essentially, want create package, or module (i'm not sure which, part of problem) can import projects's src working on--kind of own, one-class, library. while trying figure out how this, came across 2 following blog posts-- http://blog.jetbrains.com/idea/2011/10/new-in-11-create-library-from-project-view/ http://blog.jetbrains.com/idea/2010/08/quickly-create-jar-artifact/ --but when tried instructed (creating artifacts in project structure, etc.) wasn't able because class doesn't have main() method, not meant to. wondering if going right--is there way this, or stuck copying , pasting? you need main method if want package able run standalone application. so, answer question: no. you don't need main method create package, nor import or use package/library in s

Is there any difference in using up/down vs change/reversible methods in Rails migrations? -

in rails migration, make difference, if this: def foo end def down bar end or this: def change reversible |direction| direction.up { foo } direction.down { bar } end end ? i think it's better use change method if part of migration includes reversible methods, such create_table , add_column etc.. other that, there difference? as show it, there no advantage. main advantage lot of time don't need write down method / block @ all, eg class somemigration < activerecord::migration def change create_table :articles |t| ... end end end the reversible method used when there small part of migration activerecord doesn't know how reverse (eg raw sql statement)

vsts - log access to code repo in visual studio online -

when using visual studio online, want ensure contractors or developer working on project check-in , check-out using our given laptops. has found way restrict access code machines in visual studio online? can somehow log checked code out , machine @ time? there no way restrict access vso ip address. considering. can enable two-factor authentication in azure active directory tenant. there's no way log has checked out code. closest periodically query workspaces in account if using tfvc. there's no way track clones of git repos.

internet explorer - How much data can be stored to the IE11 in-browser database within the windows 8 tablet -

backgroud: i building offline application stores data ie11 in-browser db (indexdb) using pouchdb adapter. my questions: how data can store inbrowser-db within ie 11. application intended work in windows 8 tablet environment. there 2 versions of ie available tabet (usual ie11 , ie metro). in terms of amount of data can stored inbrowser db there difference between 2 versions of ie. from the pouchdb faqs : internet exporer 10+ has hard 250mb limit, , prompt user non-modal dialog @ 10mb. there this real-world research done raymond camden. might find "working quota on mobile browsers" useful. i don't know if there's difference between ie11 , ie metro. if research, please update pouchdb faqs , let know. :)

Any concise way to define a constant function (mapping) in scala -

i newbie in scala. have following code define constant function returns true 1,2,3 , false other integers .( function defines a set {1,2,3} of integers): val a= node1 _ def node1(x:int):boolean={ if (x==1 || x ==2 || x==3){true} else{false} } is there way define function more concisely? val a: int => boolean = set(1, 2, 3).contains(_) which same as val a: int => boolean = set(1, 2, 3) this because set's apply method same contains method.

How to take input in ArrayList in java when number of values is not a constant? -

Image
i want take input example: 550 234234 874982634 3487239482349 the length of input not fixed , want take input in array list of java. arraylist<integer> basicpg = new arraylist<integer>(); bufferedreader br = new bufferedreader(new inputstreamreader(system.in)); arraylist<integer> basicpg = new arraylist<integer>(); string input; while((input = br.readline()) != null && input.length() != 0) { basicpg.add(integer.parseint(input)); } if space seperated, use .split() bufferedreader br = new bufferedreader(new inputstreamreader(system.in)); string input = br.readline(); string[] tokens = input.split(" "); list<string> wordlist = arrays.aslist(tokens);

Azure Graph API -

even though i've added apps gallery azure ad, cannot see when try pull data. can see custom apps added. if i've added 7 apps; 2 gallery(google docs, 1 drive) & 5 custom(native/web apps); able see 5 apps! going wrong where? graph api using is: https://graph.windows.net/mycustomad.onmicrosoft.com/applications?api-version=beta i tried different api versions no luck. can suggest me on this? in graph api, "applications" represent application configuration developers register in tenant. gallery apps no different (and happen registered in special tenant). when acquire application (like gallery app, or consent custom application else has developed), application instance gets created in tenant can attach policy , permissions it. application instance called "service principal". you can query using: https://graph.windows.net/mycustomad.onmicrosoft.com/serviceprincipals?api-version=1.5 this return acquired apps, , default microsoft apps. h

JavaScript callBack Gets Ran Twice - Should Only Run Once? -

i clarify first have searched solution answer on 2 hours , cannot seem locate solution. i have function addproductcheck(); this function called on item click , seems working no difficulty. problem arises when next function callback ran. cartproductexists(objectvars, function(cartitem) { } this designed run asynchronous call database, check item inside cart table, , return callback results further manipulation. cartproductexists(objectvars, function(cartitem) { if (cartitem != null) { //ran after callback returns cartitem no longer null }else{ //gets ran first time cartproductsexists called, when shouldn't. } } i not sure going wrong this, knowledge rest of code inside callback shouldn't getting ran until callback triggers response. can me problem? if (cartitem == null || cartitem == "") { //ran after callback returns cartitem no longer null } else { //gets ran first time cartproductsexists called, when shouldn&

javascript - I am trying to change the background image source to a url entered into a form box -

i trying change background image source url entered form box. have tried few things, , mashed code , yeah, no go. know enough code myself in trouble, not myself out of trouble. please help. <html> <head> <script> function changebackground() {var z = new image(); z.src = "<?=$varimage;?>"; document.body.background= z.src; } </script> <?php if($errormessage != "") { echo("<p>there error:</p>\n"); echo("<ul>" . $errormessage . "</ul>\n"); } else { $fs = fopen("mydata.csv","w+"); fwrite($fs,$varimage . ", \n"); fclose($fs); header("location: thankyou.html"); exit; } ?> <?php if($_post['formsubmit'] == "submit") { $varimage = $_post['formimage']; } ?> </h

html - DOM element id , is changed after rendering -

i use kendo view , html code : <div id="permission" data-role="tabstrip" data-animation="false"> <ul class="bd-doc-navigation-tabstrip tabstip-header" data-freezable="false"> <li class="k-state-active"> <p>rigs</p> </li> <li> <p>actors</p> </li> </ul> <div id="permission-tabstrip-1"></div> </div> but after rendering page instead of "permission-tabstrip-1" see "permission-1". dont know whats going happen . havent used "permission-tabstrip-1" anywhere else . i changed : <div id="permission" data-role="tabstrip" data-animation="false"> to : <div id="permission-tabstrip" data-role="tabstrip" data-animation="false">

python - Implement recursion using one recursive call -

given function follow : f(n) = f(n-1) + f(n-3) + f(n-4) f(0) = 1 f(1) = 2 f(2) = 3 f(3) = 4 i know implement using recursion 3 recursive calls inside 1 function. want 1 recursion call inside function. how can done ? to implement using 3 recursive calls here code : def recur(n): if n == 0: return 1 elif n == 1: return 2 elif n == 2: return 3 elif n == 3: return 4 else: return recur(n-1) + recur(n-3) + recur(n-4) #this breaks rule because there 3 calls recur your attempt in right direction needs slight change: def main(): while true: n = input("enter number : ") recur(1,2,3,4,1,int(n)) def recur(firstnum,secondnum,thirdnum,fourthnum,counter,n): if counter==n: print (firstnum) return elif counter < n: recur (secondnum,thirdnum,fourthnum,firstnum+secondnum+fourthnum,counter+1,n)

python - Query returns different data when using MySQL versus SQLite -

when query following model sqlalchemy, don't expected result. class user(db.model): __tablename__ = 'users' id = db.column(db.integer, primary_key=true) username = db.column(db.string(64), unique=true) def __repr__(self): return '<user %r>' % self.username i created mysql table directly, committe data: mysql> create table "users" (id integer, username varchar(64)); mysql> select * users; +------+-------------+---------+ | id | username | role_id | +------+-------------+---------+ | null | yzxu | null | | null | after | null | +------+-------------+---------+ when using mysql, sqlalchemy query returns none . >>> user.query.filter_by(username='after').all() [none] when using sqlite, correct username returned. >>> db.create_all() >>> db.session.add(user(username='after')) >>> db.session.commit() >>> user.

iis 7 - Accessing a remote MS Access database from PHP 5.3 / IIS7 -

i trying connect ms access database in our company network.i have installed iis7 , php 5.3 .for have copied database remote computer pc , works fine.but don't want copy database every time.so,i need connect database remotely in php. have not find simple way. for locally access database ,i have configured control panel\all control panel items\administrative tools\system dsn , add database path. $conn=odbc_connect("dbname","" ,""); any appreciated.

HTML Error w/ Document Formatting -

i'm typing document nonprofit i'm involved in, , i'm working on headers @ top of first page. it's supposed 2 headers on same line, 1 left-aligned , other right-aligned, , both 13px bold text. it's supposed directly above title of document, centred in <h1> text style. everything going swimmingly except fact headers both left-aligned, , cannot life of me figure out i'm doing wrong. know it's not browser because both stackedit , wordpress fail recognise it. , asked 2 friends take @ it, , can't figure out what's wrong either. i recognise screwed since i'm still learning html (i haven't learned css yet), has far escaped me. this have: <span style="text-align:left; font-size:13px"><b>project name</b></span> <span style="text-align:right; font-size:13px"><b>branch name, org name</b></span> <div style=text-align:center><h1>document name 1-pubdate<

ios - OCMock test category methods -

i may not understand mocking have burning question basic scenario. how 1 test instance method of class or how 1 test category method class? consider class peermessage defines few properties, etc. create own custom category peermessage called type define method, istextmessage: . istextmessage returns boolean value based on contents of peermessage . (please not sample type.) in test ocmock, configure mock of type peermessage , set it's content valid value follows: id peermessage = [ocmockobject mockforclass:[peermessage class]]; [[[peermessage stub] andreturn:@"<valid>"] content]; and assert peermessage text message: xctassert([peermessage istextmessage]); considering how mocking works, results in: 'unexpected method invoked'. clearly, didn't specify expecting it; neither did stub it. wanted verify api. how 1 test these instance methods (in case, category instance methods). 1 way redesign category follows: instead of - (bool)iste

matrix - Reading multiple data files with a loop on Python -

hi have on 200 data files name similar names abc.20.0000.catalog.out , abc.20.1000.catalog.out, abc.20.2000.catalog.out ...... abc.40.0000.catalog.out each file contains data group catalog redshift 18.1000 1) group id 2) group mass (msun/h) 3- 5) initial position (mpc/h) 6- 8) final position (mpc/h) 9-11) velocity (km/s) 12) number of particles 250103187 0.227591e+08 1.86 1.03 2.51 1.65 1.06 2.53 -47.56 7.50 3.83 328 202456030 0.167918e+08 0.29 4.57 2.02 0.23 4.63 2.14 -13.27 10.67 3.68 242 89479147 0.763262e+06 1.47 4.80 0.89 1.34 4.83 0.99 -28.90 6.20 17.30 11 each such file contains on 10^6 lines. i want following: 1. want read data each file , erase text on top. 2. want store data these files single big list of matrices, each matrix being data each of these files. here python/pandas solution: import pandas pd import glob l = [] f in glob.glob('abc*'): df = pd.read_csv(f,skiprows=1) l.a

Update Json File in a static Angularjs Website -

i'm trying make static blog in website. have json file contains posts displayed. have modal window create new post. can see result , site shows new post, when page reloaded new post gone. i'd update json file without using backend, using angularjs, possible? i tried without success: posts.html: <div class="row" data-ng-repeat="post in posts"> <div class="col-md-1 text-center"> <p>june 17, 2014</p> </div> <div class="col-md-5"> <a ui-sref="/posts/{{ posts.indexof(post) }}"> <img class="img-responsive img-hover" src="http://placehold.it/600x300" alt=""> </a> </div> <div class="col-md-6"> <h3> <a href="#/post/{{ posts.indexof(post) }}">{{ post.title }}</a> </h3> <p>by <a hre

html - Specify a style sheet in Ruby on Rails -

i have bootstrap gem install on app want include special style sheet login page. how include style sheet without making stylesheet global views (this happening me.) 1) in controller method renders login page, add following line @ end of method: render :layout => false that code prevent application.html.erb layout being applied login page, assuming want 100% custom layout , stylesheet. if you're happy global layout being applied (the structure of page, including header or footer partials, etc.), ignore step. 2) in login.html.erb (or whatever file contains view), you'll need following line, point @ specific css file: <%= stylesheet_link_tag 'foo', media: 'print, screen' %> where foo points foo.css file contained in app/assets/stylesheets directory. can skip media bit if don't want differentiate between stylesheet media versions, may run issue unstyled view if user ever tries print page, or if you're using responsive la

swing - Java JFrame Background not working. Only working when I move the actual window -

i having problems setting image background. image show when move entire window. below fragment of code including setting background image. playbutton = new jbutton(pbi); instructionbutton = new jbutton(ibi); quitbutton = new jbutton(qbi); mainframe = new jframe("my major project"); mainframe.setdefaultcloseoperation(jframe.exit_on_close); mainframe.setsize(800, 600); mainframe.setlocationrelativeto(null); mainframe.setlayout(null); mainframe.setlayout(new borderlayout()); mainframe.setcontentpane(new jlabel(new imageicon("background.gif"))); mainframe.setlayout(new flowlayout()); mainframe.setdefaultcloseoperation(jframe.exit_on_close); in order update jframe , need call mainframe.repaint(); .

xslt - XSL:if statement is not identifying required items in xml data -

i'm novice @ xsl, please forgive ignorance. i'm trying construct table pulls out elements resource pool - tagged "teammember". think have problem either xsl:if syntax, or way i'm referencing xml data. the xsl code - <xsl:for-each select="miradi:resource/miradi:resourcerolecodescontainer/.."> <xsl:if test="miradi:resource/miradi:resourcerolecodescontainer/miradi:code = teammember"> <xsl:value-of select="miradi:resourcesurname"/> the xml data - <miradi:resourcepool><miradi:resource id="2530"> <miradi:resourceresourcetype>person</miradi:resourceresourcetype> <miradi:resourceidentifier>da</miradi:resourceidentifier> <miradi:resourcesurname>andrews</miradi:resourcesurname> <miradi:resourceposition>manager</miradi:resourceposition> <miradi:resourcerolecodescontainer><miradi:code>teammember</miradi:code </miradi:resourcero

uitableview - iOS 8 - Uitableviewcell edit items not displaying when swiped -

i have custom uitableviewcell displaying correctly , able swipe each row left. on ipad, works fine. on model of iphone, rather display 2 edit actions defined in code below, nothing displayed. row slides left, leaving nothing edit buttons should be. func tableview(tableview: uitableview, editactionsforrowatindexpath indexpath: nsindexpath) -> [anyobject]? { let thing = things![indexpath.row] var editaction = uitableviewrowaction(style: .default, title: "edit") { (action, indexpath) -> void in tableview.editing = false self.editthing = thing self.performseguewithidentifier("thingedit", sender: self) } editaction.backgroundcolor = uicolor.graycolor() var deleteaction = uitableviewrowaction(style: .normal, title: "delete") { (action, indexpath) -> void in tableview.editing = false self.deletething(indexpath) } deleteaction.backgroundcolor = uicolor.redcolor() return [e

hadoop - How to create Row Sequence Number in ORC tables -

i add row numbering or row sequence id column automatically increment row id value. hive udf udfrowsequence can used runs in single reducer. know there other feature in latest hive 0.14 increment row sequence automatically in orc. you might @ row_number() function in window covering whole set. relies on data being sorted, should therefore allow parallel partition processing.

php - Can't show products in Magento 1.8 -

i can't show products in site added in admin page (even if use product url manually redirects me homepage). example : had product phone in category hightech when open hightech submenu in website didn't find (it working before , don't know causes problem) i tried refresh cache , reindex data same problem you need check information bellow: product inventory : "in stock" or "out of stock". in stock product can show in frontend product status : enabled or disabled? visibilily : "catalog, search", .... did add product websites? (using websites tab in product editing page)

php - Laravel 5 ORM update request, like date_add -

i beg excuse me poor english. so, have laravel 5 orm, , need make request should add date rows, mysql date_add. input single date interval , array of id's , output rows of database, changed adding date interval . ideally, should 1 orm request. know possible use "bad" way , rows, update in code, , insert database, imho it's not good. hope answer link site or code if it's not complicate you. attention! public function update($id) { $user_id = auth::user()->id; $rep_task = reptask::find($id); $cl_task = \request::has('json') ? json_decode(\request::input('json'),true) : \request::all(); $ids = []; $task_id = $rep_task->task_id; $rep_tasks = reptask::where('task_id', '=', $task_id) ->select('id') ->get(); $new_date = date_create_from_format(self::date_fullcalendar_format, $cl_task['new_date']); $selected_task_date = date_create_from_format(self::da

javafx - Clear only the visible data data from Chart -

i have example of javafx linechart. reset data chart. public class mainapp extends application { private static final int max_data_points = 50; private series series; private int xseriesdata = 0; private final concurrentlinkedqueue<number> dataq = new concurrentlinkedqueue<>(); private executorservice executor; private addtoqueue addtoqueue; private timeline timeline2; private numberaxis xaxis; private numberaxis yaxis; private areachart<number, number> sc; private void init(stage primarystage) { xaxis = new numberaxis(0, max_data_points, max_data_points / 10); xaxis.setforcezeroinrange(false); xaxis.setautoranging(false); yaxis = new numberaxis(); yaxis.setautoranging(true); sc = new areachart<number, number>(xaxis, yaxis); sc.setanimated(false); sc.setid("liveareachart"); series = new areachart.series<number, numbe

android - Javascript doOnOrientationChange :can't fix a bug loading the page -

i used .js avoid landscape view mobile device. edited white full-screen image saying "this site not thought viewed in landscape mode, please turn device" shown each time rotate device portrait landscape. works except when load page , i'm in landscape mode. idea on how fix it? thanks <script> (function() { 'use strict'; var ismobile = { android: function() { return navigator.useragent.match(/android/i); }, blackberry: function() { return navigator.useragent.match(/blackberry/i); }, ios: function() { return navigator.useragent.match(/iphone|ipad|ipod/i); }, opera: function() { return navigator.useragent.match(/opera mini/i); }, windows: function() { return navigator.useragent.match(/iemobile/i); }, any: function() { return (ismobile.android() || ismobile.blackberry() || ismobile.ios() ||

c++ - Destroy pointers to objects in array -

say want declare array of pointers specific object like object *objects = new object[size]; and add new objects dynamically allocated array for (int = 0; < size; i++){ object* obj = new obj; objects[i] = *obj; } is enough deallocate memory calling delete[] on array, or have loop through array first , call delete on each object? or stupid in practice? first, have follow deallocation reverse order of allocation. so number of times new many times delete , number of times new [] many times delete [] // assuming objects array of pointers [ object **objects ] (int = 0; < size; i++) { delete objects[i] ; } delete [] objects; and correct allocation should go as: object **objects= new object*[size]; (int = 0; < size; i++) { objects[i] = new object; } also , should use smart pointers std::unique_ptr hassle free memory management std::vector< std::unique_ptr<object> > objects ;

javascript - How to run through a function again once it reaches the end? -

how run through loop again once reaches last value in array? i run function init() again once completed because more dom elements myelement ajaxed in once have been clicked on. i have tried running init function after settimeout doesnt work , tried checking last element on array btn.length -1 still doesnt work. function dosettimeout(index, btn) { settimeout(function() { jquery(btn[index]).click(); }, index * 1500); //init(); } function init() { var btn = [].slice.call(document.queryselectorall('.myelement')); var index; (index = 0; index < btn.length; index++) { dosettimeout(index, btn) } } init(); does work? function init() { var btn = [].slice.call(document.queryselectorall('.myelement')); var index = 0; function click() { settimeout(function() { if(index < btn.length) { jquery(btn[index++]).click(); click(); } e

jenkins - Protractor webdriver-manager takes forever to start Selenium -

i managed protractor tests running through jenkins build task on ci server, i'm having problem when run webdriver-manager start takes forever before selenium server starts. eventually starts , console shows: info - started socketlistener on 0.0.0.0:4444 but takes 5 minutes, whereas when try same on vagrant vm starts immediately. i'm running headless protractor tests use xvfb-run run webdriver-manager start . here's shell script use: #!/bin/sh export display=:1 xvfb $display -ac -screen 0 1280x1024x8 & sleep 1 xvfb-run webdriver-manager start --standalone this starts selenium server on vagrant vm, takes long time on ci server. here's output of script on ci server: jenkins@vps1:~/workspace/cms$ ./runwebdriver initializing built-in extension generic event extension initializing built-in extension shape initializing built-in extension mit-shm initializing built-in extension xinputextension initializing built-in extension xtest initializing buil

scala - Fill immutable map with for loop upon creation -

i have map looks this: val fields: map[(int, int), field] and thought doing like: val fields: map[(int, int), field] = map( for(a <- 0 10) { (0, a) -> new field(this, 0, a) } ) instead of long copy/paste list like: (0, 0) -> new field(this, 0, 0), (1, 0) -> new field(this, 1, 0), (2, 0) -> new field(this, 2, 0), (3, 0) -> new field(this, 3, 0), (4, 0) -> new field(this, 4, 0), (5, 0) -> new field(this, 5, 0), (6, 0) -> new field(this, 6, 0), (7, 0) -> new field(this, 7, 0), (8, 0) -> new field(this, 8, 0), (0, 1) -> new field(this, 0, 1), ... but type mismatch, expected: (notinfereda, notinferedb), actual: unit why , how can overcome this? the problem comprehension doesn't return anything. here 2 different solutions problem. prefer second one. case class field(map: map[(int, int), field], a: int, b: int) val fields: map[(int, int), field] = map( (for(a <- 0 10) yield (

python - Unexplained Infinite Loop in Tkinter -

i learning tkinter python2 came across code.this creates window in tkinter , increments value of label every 1 second while code runs fine..can tell me why infinite loop not observed after every thousand seconds control return count() , control should have never reached last line of code? import tkinter tk counter = 0 def counter_label(label): def count(): global counter counter += 1 label.config(text=str(counter)) label.after(1000, count) count() root = tk.tk() root.title("counting seconds") label = tk.label(root, fg="green") label.pack() counter_label(label) button = tk.button(root, text='stop', width=25, command=root.destroy) button.pack() root.mainloop() also label variable passed function def counter_label copy of original variable changing shouldnot affect original variable.how happening? any appreciated. 1000 measured in milliseconds i.e., 1 second count() reached , infinite loop (if root.mainloop() run

php - cURL takes long time to start download -

i'am trying download file (1gb) on server c via server b, has code: header("content-disposition: attachment; filename=how use git , github videos.zip"); header("content-type: application/octet-stream"); header("content-transfer-encoding: binary"); $url = "http://zips.udacity-data.com/ud775/how%20to%20use%20git%20and%20github%20videos.zip"; $ch = curl_init(); curl_setopt($ch, curlopt_url, $url); curl_setopt($ch, curlopt_header, 0); curl_setopt($ch, curlopt_buffersize, 256); curl_exec ($ch); curl_close($ch); i expecting momentally start dwonlaoding file. instead have wait long time till browser window ask save it. thought curl_setopt($ch, curlopt_buffersize, 256); means transfer file chunk chunk don'thave wait read file first. so why takes long time start download? how can fix it? if method wrong please suggest me else that's because curl_exec() blocks till reads full response (consuming 1gb of memory in proces

symfony - Symfony2 Knp-snappy to generate PDF from a twig view that contain heicharts -

i want generate pdf file twig view contains heighcharts heighcharts not displayed in pdf file. why ? suggestions $html = $this->render('acmequizbundle:resultat:show.html.twig', array( 'entity' => $entity, 'chart'=>$ob )); return new response( $this->get('knp_snappy.pdf')->getoutputfromhtml($html,array('encoding'=>'utf-8','enable-javascript' => true,'images' => true)), 200, array( 'content-type' => 'application/pdf', 'content-disposition' => 'attachment; filename="rapport.pdf"' ) ); highcharts js library, uses client's browser generate charts. should generate charts on server side in image format , include pdf twig template. some info server side charts generation: http://www.highcharts.com/component/content/article/2-articles/news/52-serverside-gene

php - Composer Package: AutoLoad and Extend Another Package -

i creating 1 of first php packages using composer , hit problem. currently i'm working on package main class extends class package, on composer.json i've package i'm extending declared requirement: "require": { "php": ">=5.3.0", "ext-mbstring": "*", "author/basepackage": "dev-master" }, and, if issue composer update nice vendor directory inside project author/basepackage dependency downloaded there. so question is, on main class file src\extended.php need manually require_once __dir__ . "/../vendor/autoload.php"; in order autoload basepackage can class extended extends \basepackage\basepackage . is ok? how supposed load package dependencies? when commit package github or so, i'm ignoring vendor directory , if uses requiring on projects require_once __dir__ . "/../vendor/autoload.php"; fail because won't expected be. how should

android lollipop notification background colour -

Image
is possible change background colour of notifications in android lollipop. i noticed notifications white, light grey , dark grey. http://cdn.gottabemobile.com/wp-content/uploads/android-lollipop-on-the-moto-x-2014-1.jpg you can see music player notification has dark grey background. , in second screenshot light grey. how set colour? , possible change colour e.g. hex code. or can select them template such material dark material light. thanks taking time answer that background set material design itself, supposed white, design matters. take here! or make custom layout.

config - is it possible to get the current spark context settings in pyspark? -

i'm trying path spark.worker.dir current sparkcontext . if explicitly set config param , can read out of sparkconf , there anyway access complete config (including defaults) using pyspark ? yes: sc._conf.getall() which uses method: sparkconf.getall() as accessed by sparkcontext.sc._conf note underscore: makes tricky. had @ spark source code figure out ;) but work: in [4]: sc._conf.getall() out[4]: [(u'spark.master', u'local'), (u'spark.rdd.compress', u'true'), (u'spark.serializer.objectstreamreset', u'100'), (u'spark.app.name', u'pysparkshell')]

c++ - OPENCV training cascade "out of range" -

i'm trying train own detector using opencv 3.0 traincascade. have 82 positive , 188 negative sample , following opencv_traincascade -data data -vec signals.vec -bg negative.txt -numpos 82 -numneg 188 -numstages 20 -w 50 -h 50 -featuretype lbp i'm able reach stage 8. @ stage 9 have following error ===== training 9-stage ===== <begin pos count : consumed 82 : 82 neg cterminate called after throwing instance of 'std::out_of_range' what(): basic_string::substr aborted (core dumped)149 someone knows why? thank in advance. the short answer - don't have enough negative samples selected maxfalsealarm , numstages parameters. have 3 options (starting best): provide more negative samples (imho it's best option - it's not hard , give best results) decrease value of maxfalsealarm parameter (you can find here ) decrease number of stages if remember correct (better check it..) should have @ least (1-maxfalsealarm)^(numstages-1)

mysql - Why is Python not setting up my cron job's time properly?[Solved] -

i created python script adds data entry in mysql database every 1 minute. that, used cron inside python.here's code of script1.py: import mysqldb mdb crontab import crontab con=mdb.connect('localhost','prabakar','****','timedb'); con: cur=con.cursor() cur.execute("drop table if exists timer") cur.execute("create table timer(time time)") cur.execute("insert timer(time) values(current_timestamp)") cron= crontab(user=true) job=cron.new(command='/home/praba1110/delta_sysad_tasks/task 2/script2.py') job.minute.every(1) cron.write() where script2.py is, import mysqldb mdb con=mdb.connect('localhost','prabakar','****','timedb'); con: cur=con.cursor() cur.execute("insert timer(time) values(current_timestamp)") when executed command 'crontab -e' command in terminal, showed entry of * * * * * /home/praba111

wpf - Concatenate string via XAML -

i have label inside progressbar take it's value form progressbar value , want add char % after progressbar value. i have tried 2 options not working: <label content="{binding progress}" contentstringformat="{}{0} %" /> <label content="{binding progress, stringformat={}{0}%}" /> use textblock instead. <progressbar value="50" name="prog" ... /> <textblock text="{binding path=value, elementname=prog, stringformat={}{0}%}"/>

Error when accessing Facebook API posts_insights -

i admin page trying posts insights. developer of app accessing data. authorised read_insights permission using open graph explorer , got access token. trying following call in open graph explorer: page_id/posts_insights?since=1432481806&until=1433085606 and returns me this: { "error": { "message": "an unknown error has occurred.", "type": "oauthexception", "code": 1 } } i know read_insights permission needs reviewed facebook before releasing app public, in past other permissions needed reviewed worked app testers , developers without facebook review.

algorithm - NSGA 2: PseudoCode -

i need use multi objective optimization algorithm accurately nsga 2. , couldn't find in web clear , detailed pseudocode of nsga2 able imlement it. thanks in advance. here deb's original paper on nsga-ii. might not clearest description doable (i implemented according paper once).

php - How to catch any file recursively -

the following code catches files recursively in php extension. $paths = new \recursiveiteratoriterator(new \recursivedirectoryiterator($realpath), \recursiveiteratoriterator::self_first); $files = new \regexiterator($paths, '/\.(?:php)$/', \regexiterator::match); foreach($files $file){ ... i want files extension. want replace it: '/\.(?:php)$/' wouldn't change /\.(?:php)$/ to /.*/

c# - Unable to cast object of type 'Windows.UI.Xaml.Controls.Canvas' to type 'Canvas' -

i have canvas , want name when tapped . so, have xaml : <canvas name="drawline" ... > ... </canvas> and function bind on tapped event: private void changepage(object sender, tappedroutedeventargs e) { string name = ((canvas)sender).name.tostring(); frame.navigate(typeof(params), name); } bug following error: an exception of type 'system.invalidcastexception' occurred in gotqn.exe not handled in user code additional information: unable cast object of type 'windows.ui.xaml.controls.canvas' type 'gotqn.canvas'. why ((canvas)sender).name.tostring(); generating such error? there other way name? it seems have 2 canvas classes in different namespaces. guess windows.ui.xaml.controls namespace not in using code assuming gotqn.canvas . did declare own canvas class? if yes, may have specify full name of canvas class want string name = ((windows.ui.xaml.controls.canvas)sender).name.tostring();

python - Retrieve specific number of tweets using search keyword -

from tweepy import stream tweepy import oauthhandler tweepy.streaming import streamlistener import time s=raw_input('string'); try: file = open('keyword.txt', 'r') keyword=file.read() ckey ='consumer key' csecret ='consumer secret' atoken ='access token' asecret='access secret' class listener(streamlistener): def on_data(self, data): # print data tweet=data.split(',"text":"')[1].split('","source')[0] print (tweet) print ('\n') savethis=tweet savefile =open('projectdatabase.csv','a') savefile.write(savethis ) savefile.write('\n') savefile.close() return true def on_error(self, status): print (status) auth=oauthhandler(ckey, csecret) auth.set_access