Posts

Showing posts from September, 2015

python - sympy: how to sympify logical "NOT" -

the following code work sympify logical expressions: sympify('a&b') # and(a, b) sympify('a|b') # or(a, b) but how result of not(a) ? it turns out symbol looking ~ . see following: >>> sympy import sympify >>> sympify('a&b') and(a, b) >>> sympify('a|b') or(a, b) >>> sympify('~a') not(a)

mysql - stored procedure to display monday or weekday -

i want write stored procedure find out joining date of teachers , if monday should display monday else should display “weekday” the tbl_teacher table ; vchr_teacher_name dat_teacher_doj teena 1982-01-10 lawrence 1979-09-01 mathew 1981-10-13 job 1980-11-12 and need create stored procedure " call check_date(1982-01-10)" results as: day ---------- weekday ---------- i tried : delimiter // create procedure check_date (in dat date,out day varchar(10)) begin select dayname( dat ) day tbl_teachers; end// delimiter ; it's show error as #1172 - result consisted of more 1 row how , find day monday or weekday. i think better served function : drop function if exists `check_date` // create function `check_date` (dat date) returns varchar(10) begin return if(dayname(dat) = 'monday' , 'monday', 'weekday...

Process 'command 'F:\android-sdk\build-tools\21.1.2\aapt.exe'' finished with non-zero exit value 1 -

here content of build.gradle file: // top-level build file can add configuration options common sub-projects/modules. buildscript { repositories { maven { credentials { username artifactoryusername password artifactorypassword } url 'http://test:8081/artifactory/libs-release-local' } mavencentral() } dependencies { classpath 'com.android.tools.build:gradle:1.1.0' } allprojects { repositories { maven { credentials { username artifactoryusername password artifactorypassword } url 'http://test:8081/artifactory/libs-release-local' } mavencentral() maven { url 'http://repo1.maven.org/maven2' } jcenter() } } here content of app\build.gradle : apply plugin: 'com.android.application' android { compilesdkversion 21 buildtoolsversion "21.1.2" lintoptions { abortonerror false ...

java - Updating to mongo 3.0 -

i working on mongo 2.x , have updated mongo 3.x updated java mongodb client 3.0.3, have js on mongo server needs executed , js requires 2 object parameters done in previous version this: db database = mongoclient.getdb(db); commandresult cr = database.doeval(js, query, collection); // js string, query basicdbobject , collection list<string> need in running same in place of db getting mongodatabase (as getdb has been deprecated) , doeval replaced runcommand you can in code of original doeval method figure out how this, looks like: public commandresult doeval(final string code, final object... args) { dbobject commanddocument = new basicdbobject("$eval", code).append("args", arrays.aslist(args)); return executecommand(wrap(commanddocument)); } that means you'll need like: document commanddocument = new document("$eval", code).append("args", arrays.aslist(args)); return runcommand(commanddocument); note r...

Array size in Perl -

i trying run code , getting output as: #!/usr/bin/perl @array = (1,2,3); $array[50] = 4; $size = @array; $max_index = $#array; print "size: $size\n"; print "max index: $max_index\n"; output: size: 51 max index: 50 what explanation this? in perl, array data structure representing list . list has elements . keys list called indexes . first index 0 ( 0 ). you have started array these indexes , valus: index value 0 1 1 2 2 3 if set 50th index value, other indexes in between filled undef , undefined value. you have correctly identified $#array max index, or highest or last index . if force array scalar context , give number of elements, or size . you've got well. , will, Сухой27 said in comment , last index minus one. you can illustrate behaviour if dump out array . use strict; use warnings; use data::printer; @array = (1,2,3); $array[10] = 4; p @array; it output following. again can see index starts @ 0 , , each...

apache - setting document root in antoher partition on ubuntu -

i place apache document root inside partition of ubuntu hard drive, keep getting forbidden message, when place home directory woking find, how be? group or owner affected ? here mysite.conf , apache2.conf when place document root in home folder (working) #site-available/mysite.conf documentroot /home/jono/www #/etc/apache2/apache2.conf <directory /home/jono/www/> options indexes followsymlinks allowoverride none require granted </directory> bu when change document root partition keep getting forbidden messasge #site-available/mysite.conf documentroot /media/jono/website_data/www #/etc/apache2/apache2.conf <directory /media/jono/website_data/www/> options indexes followsymlinks allowoverride none require granted </directory> is owner/group access affected ? or there problem ? at last it's working, have grant access www:data accesing whole directory @mark-b, using chown -r www-data:www-data whole directory is...

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -

i trying add nodes dagre graph through cityscape.js. problem nodes not painted. code have: cy.add({ group: "nodes", data: { id:"n0",name:"n0",weight: 75 }, }); $.ajax(url).done(function(jsontree){ var newnodes=[]; for(var i=1;i<6;i++){ //var child = jsontree.result[i]; newnodes.push( { group: "nodes", data: { id: "n"+i, name:"n"+i}}, { group: "edges", data: { id: "e"+i, source: "n0", target: "n"+i } } ); } cy.add(newnodes); any ideas? have used loaded function reload graph not work. not know if have use specific function reload graph. thank in advance. you need add positions new nodes. cytoscape.js docs : it important note positions of newly added nodes must defined when calling cy.add(). nodes can not placed in graph without valid position — otherwise not displayed. yo...

r - Parse time elapsed / time span / duration with several different formats -

i need parse time spans several different formats, including days, hours, minutes, seconds.ms, separated : : %os , %h:%os , %h:%m:%os or %d:%h:%m:%os . example: x <- c("28.6575", "1:14.0920", "1:5:38.1230", "5:23:59:38.7211") the first idea comes mind using strptime parse given strings date. approach not work strings not contain parts of time span. possible turn parts of format string being optional? strptime("5:23:59:38.7211", "%d:%h:%m:%os") # [1] "2015-08-05 23:59:38" strptime("1:5:38.1230", "%d:%h:%m:%os") # [1] na # wanted: "2015-08-01 01:05:38" a different approach turn formatted values seconds (e.g. 1:14.0920 ~~> 74.0920 secs ). however, unable find convenient way using r. here's expanded version of @konrad rudolph's comment: # split time spans different time elements l <- strsplit(x, ":") # pad vector leading zeros. here 4 max...

node.js - How to run NodeJS unit tests with a different NODE_PATH -

the question can run unit tests within node/gulp have different node_path has been inherited environment? the issue i have project being run within rhino based application, require loads scripts set of defined locations. i want have unit tests components. in order run tests need able call scripts node environment. ends error similar this: error: cannot find module 'lib/foo/foo.js' this because scripts contain require(foo/foo) ... fine if node_path have contained lib . issue here want folder present unit tests, not other gulp tasks. i guess issue facing test runners came across (e.g. karma ) browser based. question might be: is there test runner runs pure nodejs tests? well can along lines of node_path=node_path:/path/to/lib npm test`. node_path environment variable. rely on value persists through login shell profile. can set/unset/change suits you. to set environment variable duration of execution of 1 command... variable=value command ...

sql - How to clean database table from garbage data after it is populated with a data from excel file? -

Image
i have package dumps data .xls file kind of staging table. need insert data main table. i'm looking way write sql code rid off garbage data staging table. this example of xls file when executing package, staging table looks this: after that, run following code delete garbage data statging table: delete stagingtable data null , data = 'date' that takes care of garbage removal particular case. but if data comes in so, xls columns names different, delete statement not work is there work around problem? i found answer. work if first column of staging table has date value: select * statgingtable isdate(date) = 1 this return:

sql server - Adding an IF Condition in WHERE Clause to Add an 'AND' only on particular occasion. In other occasion skip the 'AND' part -

i'm trying workout this. it's sample code, since i'm not able put whole stored procedure. i'm taking value table, while getting @children parameter sp. want run and condition if the value in @children greater one. possible add if condition in where clause within sql server 2008? how can achieve following? logically, below situation want achieve. if have questions please let me know, can provide additional information. select empid, empdesignation, empsalary, haschildren employee empdesignation = 'manager' if (@children > 2 ) { , haschildren = 1 } you can use combined query and , or operators: select empid, empdesignation, empsalary, haschildren employee empdesignation = 'manager' , (@children < 2 or haschildren = 1) in case if @children 1 or less condition @children < 2 valid condition haschildren = 1 never evaluated. in on other hand @children more 1 condition @children < 2 invalid , in case conditi...

command line - How do I add a right-click option to search the web using a selected file's name? -

i'm looking add option right-click menu in windows explorer launch chrome , search specific site file's name. little more specific, want able on video file , available subtitles it. i'm aware there number of programs can variation of this, after trying out bunch of them, haven't quite found want. not that, i'd rather use lightweight, native code having install program. the closest thing guide i've found in post , doesn't quite work. of course, i've tried cleaning needs, still doesn't work, think there's flaw in there. here's have far... running command prompt administrator, executed these 2 lines add them registry: reg add "hklm\software\classes\*\shell\subtitle search" /d "subtitle search" reg add "hklm\software\classes\*\shell\subtitle search\command" /d "c:\my projects\my code\subtitlesearch.bat ""%1""" the, create batch file (subtitlesearch.bat) following: set x...

asp.net - What is the best way to create .xls from datatable in asp .Net c#? -

i have datatable , want export excel that, datatable contains unicode characters (persian characters) , want convert .xls files correctly. wonder possible stimulsoft? this common method use public void exportdetails(datatable tempdatatable, string filename) { try { system.io.stringwriter objstringwriter1 = new system.io.stringwriter(); system.web.ui.webcontrols.gridview gridview1 = new system.web.ui.webcontrols.gridview(); system.web.ui.htmltextwriter objhtmltextwriter1 = new system.web.ui.htmltextwriter(objstringwriter1); httpcontext.current.response.clearcontent(); httpcontext.current.response.clearheaders(); httpcontext.current.response.contenttype = "application/vnd.ms-excel"; httpcontext.current.response.charset = ""; httpcontext.current...

python - .exe closes immediately after launch when double clicked -

i've created exe file using py2exe module. weird thing works has work when run exe command line when double-click on exe , opens console (as has do) , console closes immediately. i wrote logging method figure out problem , surrounded method try-except not catch exception. here piece of code: if __name__ == '__main__': try: mh = moto() db = database() # can find __init__ of database() below log('ok') # can't find line in log file problem inside __init__ od database() except exception e: log(str(e)) log(str(traceback.format_exc)) url in [__cats__,__hyphens__]: log(' url') init database(): class database(): def __init__(self): self.conn = sqlite3.connect('db.db') # database created self.cursor = self.conn.cursor() self.create_table_moto() self.drop_and_create_temp_table() log('init_end') # can fin...

neo4j - The @QueryResult doesn't work -

i'm using spring data neo4j 4 (sdn4),and trying return more 1 entities using @queryresult there no exception thrown,but null in @queryresult object model simple (:user)-[:role]-(:role) does 1 know root cause? the user model @nodeentity public class user implements userdetails { @graphid private long id; public long getid() { return id; } public void setid(long id) { this.id = id; } private string userid; @relationship(type="role") private set<role> roles = new hashset<>(); public aduser getaduser() { return aduser; } public void setaduser(aduser aduser) { this.aduser = aduser; } public string getuserid() { return userid; } public void setuserid(string userid) { this.userid = userid; } public set<role> getroles() { return roles; } public void setroles(set<role> roles) { this.roles = r...

How do I create a photo gallery with same widths and different heights using HTML/CSS? -

i beginner html , css. want create photo gallery columns same width, each photo have different height. want photos "hug" each other, photos in second row may not start in same vertical position each other. how accomplish that? saw columns - maybe work? i'm grateful available! you create html page contains div s each column. you either use css stylesheet place columns together: - either float these column div left (refer w3c school's css floating ), or - using relative or absolute position ing (refer w3c school's css positioning ) , give each div x , y coordinate. then give each column div preset width (refer w3c school's css width , max-width ). every item in column move new row (when has static positioning, default tags). give each image in column same fixed should fine...

arrays - how to change the value of a specific key in short words in php -

array of title replaced words temporary array ( [title] => led flash macro ring light (48 x led) 6 adapter rings for canon/sony/nikon/sigma lenses [manufacturer] => neewer electronics accessories [currency] => cad [price] => 35.99 ) convert title values have less words temporary compare key array ( [title] => led flash macro ring [manufacturer] => neewer electronics accessories [currency] => cad [price] => 35.99 ) not entirely sure if suffice try following. $title=$arr['title']; $length=30; $smalltitle=rtrim( preg_replace('/\s+?(\s+)?$/', '', substr( $title, 0, $length ) ) ); echo $smalltitle; $arr['title']=$smalltitle;

image processing - How to convert a jpg to yuv in C? -

Image
even though question of nature sounds similar, having problems in converting jpg image yuv in c (without using opencv). this have understood of now, how solve problem : identify structure of file formats jpg , yuv. i.e each byte in file contains. think jpg format looks like. with above structure tried read jpg file , tried decipher 18th , 19th bytes. did type cast them both char , int don`t meaningful values width , height of image. once have read these values, should able convert them jpg yuv. looking @ resource . appropriately, construct yuv image , write (.yuv) file. kindly me pointing me appropriate resources. keep updating progress on post. in advance. based on https://en.wikipedia.org/wiki/yuv#y.27uv444_to_rgb888_conversion decoding jpeg, in pure c without libraries ... following code straightforward ... https://bitbucket.org/halicery/firerainbow-progressive-jpeg-decoder/src assuming have jpeg decoded rgb using above or library (us...

java - QueryDSL add cross join when building predicate queries -

i want fetch data modela base on user in modelb. not compulsory every record have record in modelb. when use below code fetch data, return 0 records. booleanexpression searchcriteria = searchcriteria .and( qmodela.modelb.user.id.eq(userid) ) .and ( other conditions well); modela.findall(searchcriteria, pageable); when debug found querydsl put cross join. can tell me how fix this, there way querydsl add left join instead of cross join? below 2 models. @entity public class modela implements serializable { private long id; private string label; private modelb modelb; @id @sequencegenerator(name = "modelaseq", sequencename = "modela_id_seq", allocationsize = 1) @generatedvalue(strategy = generationtype.sequence, generator = "modelaseq") public long getid() { return id; } public void setid(long id) { this.id = id; } @column(length = 15...

javascript - eq(0) is not a valid selector with $.each -

<select class="qty"> <option>1</option> <option>2</option> <option>3</option> <option>4</option> </select> <select class="qty"> <option>1</option> <option>2</option> <option>3</option> <option>4</option> </select> i have 2 select tags , want update them array. means changing selected correct value, why in attempt below :eq() not working loop? selectedarr = [2,3]; $.each(selectedarr,function(i,obj){ console.log(obj); $('.qty:eq(' + + ')').prop('selected', true); }); there's few things wrong here: $('.qty:eq('+i+')').prop('selected',true) setting selected property on <select> element - not <option> element you aren't selecting appropriate option array according selectedarr i this: var selectedarr = [2, 3]; ...

c# - should web api content negotiation from xml to json insert @? -

i have xml document want return via web api call. i want allow user option of response via content negotiation. [httpget] public httpresponsemessage get() { var doc = new xmldocument(); doc.loadxml("<myexport someproperty='some value'></myexport>"); return request.createresponse(httpstatuscode.ok, doc); } when request accept header of application/json get: { "myexport": { "@someproperty": "some value" } } is correct @ included in property name? if why?

mysql - SQL Query - Separating or batch excluding results based on a parameter -

so here's i'm trying accomplish. from database pulling date, invoice#, customer name, state, , invoice total amount. within "invoice_details" table, i'm looking @ column called "description" entries keyword tax (via "%tax%"). each invoice may have several entries in 'description' column each item listed on invoice gets description. for invoices charged sales tax: item added invoice tax charged. want query in way see if particular invoice# (or rowid in "invoice" table) has entry "%tax%", not return results invoice# (again, or rowid), including it's other lines of 'description' not relate tax charged. in other words, searching description column entries, of multiple exist each invoice # - exclude entries of invoice# if 1 of 'description' entries contain "%tax%".

codeigniter - PHP include is not including existing file content -

in application/config.php have include function so include($_server['document_root'].'/config/log.php'); or include($_server['document_root'].'/config/session.php'); obviously config files in root/config/whatever.php. since moved files new server include not working probably. if write name of file i'll error if file exists not going include constant of , ci through error such in order use session class required set encryption key in config file. as solution can include contact file in config.php (but that's not want since use came details in several separate ci applications). appreciate better solution. many in advance p.s. i'm using php 5.5.9-1ubuntu4.11 (cli) (built: jul 2 2015 15:23:08) update: echo $_server['document_root'].'/config/session.php'; ///returns : var/www/html/config/session.php include($_server['document_root'].'/config/session.php'); //return nothing , not includ...

javascript - How can an object literal's property be assigned to the return value of one of its methods? -

so making game practice using mvc paradigm. create object literal model , want functions needs generate values properties in object itself. have tried no success. have tried using "this" when calling function , not using it. either way, function not defined error chrome. can fix this? here's relevant code: var model = { genplayers: function() { return tempplayerarray; }, playerarray: genplayers() } you can't that. 1. there no function name genplayers() model.genplayers() , 2. object properties can't accessed during object initialization. what is: var model = { genplayers: function() { return tempplayerarray; }, playerarray: null }; model.playerarray = model.genplayers(); or if model.genplayers returns tempplayerarray this: var model = { genplayers: function() { return tempplayerarray; }, playerarray: tempplayerarray };

IntelliJ IDEA Cucumber Configuration -

i have created dummy project figure out how cucumber android works , followed "tutorial" here https://www.jetbrains.com/idea/help/enabling-cucumber-support-in-project.html i using intellij idea ide can see , feature looks this: feature: testing scenario: testiranje given on 'new pet' page , press "registrer" should go "registrer" page given on new pet page and java file: public class proradistepdefs { @given("^i on 'new pet' page$") public void i_am_on_the_new_pet_page() throws throwable { } @and("^i press \\\"([^\\\"]*)\\\"$") public void i_press(string arg1) throws throwable { system.out.println(arg1); } @then("^i should go \\\"([^\\\"]*)\\\" page$") public void i_should_go_to_the_page(string arg1) throws throwable { system.out.println(arg1); throw new pendingexception(); } @given(...

Executing a Query to Insert Data from VBA to MySQL and What Will Said Data Look Like -

i'm trying insert snippets of word document mysql database. did in java, lost formatting of microsoft document, i'm trying same in vba (i'm hoping keep formatting?!). find out if will, need try.. i've set connection , table in mysql can't insert values. throws syntax error on "conn.execute" line. sub connecttodatabase() ' ' dim conn new adodb.connection dim server_name string dim database_name string dim user_id string dim password string ' dim long ' counter dim sqlstr string ' sql perform various actions dim table1 string, table2 string dim field1 string, field2 string dim rs adodb.recordset dim vtype variant ' server_name = "127.0.0.1" ' enter server name here - database_name = "rmp" ' enter database name here user_id = "root" ' enter user id here password = "password1" ' enter password here set conn = new adodb.connection conn.open "driver={...

c# - Asynchronous task using Task.Factory.StartNew() -

at point of execution of our project using task.factory.startnew() creating asynchronous tasks. required delete temporary files. following code using : task.factory.startnew(function() deletetempdocs(path)) the problem folders may have privilege restrictions. need run tasks administrator rights . if project not running in admin rights. possible set rights this? it isn't possible run task administrator rights, rights assigned on process level. have start new process, example batch file, , run administrator. var process = new process(); var processstartinfo = new processstartinfo(); processstartinfo.verb = "runas"; // runs administrator processstartinfo.filename = "myfiledeleter.exe"; process.startinfo = processstartinfo; process.start(); process.waitforexit();

Git overwrite certain files with every pull/push -

i working on project using git repository , having issues. building app angular , have several .js , .css files. using grunt concatenate , minify these files because don't want include .css , .js files in main html file. doing have import 2 files, css , js file both concatenated. the easy solution use .gitignore on these files avoid constant merges in repository, thought too. building app angular, giving option build apps in phonegap , practically make native apps. problem ignoring concatenated .js , .css files build process needs these files build process. i think can solve problem having these files never pulled , overwritten on pushing. or have version of file on repository overwrite local version, , upon pushing running grunt again (we using grunt watch) , having local version overwrite version on repository. how guys solve such problem? may have read, have probable solutions, yet figure out how solve them. interested in solutions. i solve with: git update-...

java - Incorrectly displayed view created programmaticaly(android) -

sorry english. create views programmatically, on devices displayed wrong. have layout in programmatically add spinner. xml: container - it's layout create spinner(programmatically) spinnerl - here add spinner <linearlayout android:id="@+id/container" android:layout_width="match_parent" android:orientation="horizontal" android:background="#26ffffff" android:layout_height="wrap_content"> <linearlayout android:id="@+id/spinnerl" android:orientation="horizontal" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_alignparenttop="true" android:layout_weight="0.2" android:layout_centerhorizontal="true" /> <relativelayout android:id="@+id/spinneropen...

javascript - Reactjs adding an object to state -

i'm using reactjs populate state.users new member when or signs in. the following code working var users = this.state.users; users.push(member); this.setstate({users: users}); but when try wrap in 1 line of code fails this.setstate({users: this.users.state.push(member)}); when try above error further down in list.jsx uncaught typeerror: this.props.users.map not function any idea causing this? i'm thinking when use 1 line solution wrong kind of object passed state? thank you! it happens because .push returns new length (int number), not array, var data = { users: [] }; data.users = data.users.push(10); console.log(typeof data.users); // number .push - return new length property of object upon method called. you can use .concat instead of .push this.setstate({ users: this.state.users.concat(member) }); or this.setstate({ users: [...this.state.users, member] });

php - MySQL Math on "join" function -

not sure how explain this, but, have 2 tables, , need math on values. having issues other addition (which automatically). this mysql statement using. select snippet_id, count(snippet_id) cnt snippets_likes join snippets_engagement on snippet_id = snippets_engagement.snip_id group snippet_id order cnt desc this statements pulls total number of likes + engagements. however, want have equal likes + ( engagements/1000 ). table construction create table `iotunes`.`snippets_engagement` ( `id` int(10) unsigned not null auto_increment, `snip_id` int(10) unsigned not null default '0', `artist_id` int(10) unsigned not null default '0', `snip_timestamp` timestamp not null default current_timestamp, `engagement_type` int(10) unsigned not null default '0', primary key (`id`) ) engine=innodb auto_increment=6694 default charset=latin1; create table `iotunes`.`snippets_likes` ( `id` int(10) unsigned not null auto_increment, `snippet_id` int(10...

powershell - Sorting objects by multiple properties -

i'm trying use powershell sorting objects representing application verions $versionsobjects = @{ major = 3 minor = 2 bugfix = 1 }, @{ major = 3 minor = 5 bugfix = 1 }, @{ major = 1 minor = 2 bugfix = 1 }, @{ major = 4 minor = 2 bugfix = 1 } $sortedversions = ($versionsobjects | sort-object -property @{expression="major"; descending=$true}, @{expression="minor" ;descending=$true}, @{expression="bugfix"; descending=$true}) $sortedversions | %{echo ( "{0}.{1}.{2}" -f $_.major, $_.minor, $_.bugfix)} the output in same order input: 3.2.1 3.5.1 1.2.1 4.2.1 but should 4.2.1 3.5.1 3.2.1 1.2.1 what doing wrong? if @ least in powershell v3.0 can this: $versionsobjects = [ordered]@{ major = 3 minor = 2 bugfix = 1 }, [ordered]@{ major = 3 minor = 5 bugfix = 1 }, [ordered]@{ major = 1 minor = 2 bugfix = 1 }, [ordered]@{ major = 4 minor =...

php - Problems transfering codeigniter 3.0 from localhost to live server hostgator -

i 404 page when trying transfer codeigniter 3.0 localhost live server @ hostgator. data on config file, .htaccess , index.php. structure: application system index.php .htaccess my config file $config['base_url'] = 'http://mysyite/'; $config['index_page'] = ''; $config['uri_protocol'] = 'request_uri'; $config['url_suffix'] = ''; $config['language'] = 'english'; $config['charset'] = 'utf-8'; $config['enable_hooks'] = false; $config['subclass_prefix'] = 'my_'; $config['composer_autoload'] = false; $config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-'; $config['allow_get_array'] = true; $config['enable_query_strings'] = false; $config['controller_trigger'] = 'c'; $config['function_trigger'] = 'm'; $config['directory_trigger'] = 'd'; // experimental ...

validation - How can I validate a file upload field in TYPO3? -

i want validate file input field in typo3 seems notempty annonation not work on property of type filereference: /** * image * * @var \typo3\cms\extbase\domain\model\filereference * @validate notempty */ protected $image; /** * returns image * * @return \typo3\cms\extbase\domain\model\filereference $image */ public function getimage() { return $this->image; } /** * sets image * * @param \typo3\cms\extbase\domain\model\filereference $image * @return void */ public function setimage(\typo3\cms\extbase\domain\model\filereference $image) { $this->image = $image; } and simple fluid mark-up: <f:render partial="formerrors" arguments="{field: 'data.image'}" /> <f:form.upload property="image" /> so if try submit empty upload form following error message, because filereference still null: exception while property mapping @ property path "":php catchable fatal error: argument 1 passed fox\exa...

ios - Optimize Interface Builder update for iPhone 6/6+ screens -

i have old project no storyboard. luckily, i've got xib files each view controller , custom content ( table view cells, views etc ). so, obviously, project isn't optimized 6/6+ screens. how turn on 6/6+ screen support, add autolayout ( project doesn't use autolayout either )? check use autolayout in document inspector in xib file. (most articles explain autolayout start out showing check box. going autolayout without reading on uphill battle. try watching wwdc sessions on it, taking control of auto layout .) to turn on 6/6+ screen support, must provide launch images native resolutions. if can, use asset catalogs make easier, otherwise consult documentation resolution of these launch images .

php - How To Get Array Sum -

i have 2 arrays. $fruits = [ 'mango' => 20, 'apple' => 30, 'orange' => 10, 'banana' => 5, ]; $purchased = ['mango','banana']; how sum of values on $fruits array available on $purchased array? sum = 25 try loop - $sum = 0; foreach($purchased $v) { $sum += (!empty($fruits[$v]) ? $fruits[$v] : 0); }

javascript - How do I declare a variable inside an if else statement? -

var user = prompt("what name?"); if (user == "joe") { var game = "what's joe" } if (user == "alex") { var game = "hello alex how you" } else { game = "sorry don't know you" } var other = alert(game); for reason not work want make game equal number of different things. if use more 3 if statements game equal last one. please me? declare "game" outside if statement use inside. var user = prompt("what name?"); var game = ""; if (user == "joe") { game = "what's joe" } else if (user == "alex") { game = "hello alex how you" } else { game = "sorry don't know you" } var other = alert(game);

python - gcloud on Windows 10 CommandLoadFailure: not loading gcloud.container: AddCustomJsonEnumMapping() got an unexpected keyword argument 'package' -

google cloud sdk installed correctly unable run gcloud command @ on windows 10. error same in both powershell , command prompt administrative rights. gcloud compute/config/setting things works surprisingly fine , can list instances/set things. only commands result these error messages typing "gcloud" no additional parameters, or enever wrong command sequence typed (like "gcloud foe" results in same error message). following error message below: traceback (most recent call last): file "c:\program files\google\cloud sdk\google-cloud-sdk\bin\..\./lib\googlecloudsdk\gcloud\gcloud.py", line 194, in main _cli.execute() file "c:\program files\google\cloud sdk\google-cloud-sdk\bin\..\./lib\googlecloudsdk\calliope\cli.py", line 607, in execute file "c:\program files\google\cloud sdk\google-cloud-sdk\bin\..\./lib\argparse\__init__.py", line 1703, in parse_args args, argv = self.parse_known_args(args, namespace) file ...

javascript - How to dynamically change the template in aurelia / click to edit table row? -

Image
with knockout dynamically change template of table row when clicked on it, row become editable using edit template. no navigation, no routing, assigning row new template. how do in aurelia? here's how accomplish using if binding command: https://gist.run/?id=2408b065ecfac30ff2b1034ea8da800d code: app.js export class app { editing = null; planets = [ { name: 'mercury', diameter: 3032, distance: 35983610 }, { name: 'venus', diameter: 7521, distance: 67232360 }, { name: 'earth', diameter: 7926, distance: 92957100 }, { name: 'mars', diameter: 4222, distance: 141635300 }, { name: 'jupiter', diameter: 88846, distance: 483632000 }, { name: 'saturn', diameter: 74898, distance: 888188000 }, { name: 'uranus', diameter: 31763, distance: 1783950000 }, { name: 'neptune', diameter: 30778, distance: 2798842000 }]; edit(planet) { this.editing = planet; } } ...

arraylist - Garbage collector not working in java? -

Image
this question has answer here: why java program taking memory? 3 answers i have simple program saves screenshots arraylist - example take 100 screenshots, add them list , clear list. this: public static void main(string[] args) { jframe frame = new jframe(); // creating simple jframe frame.setdefaultcloseoperation(jframe.exit_on_close); frame.setvisible(true); list<bufferedimage> list = new arraylist<>(); (int = 1; <= 100; i++) { bufferedimage capture = makescreenshot(); list.add(capture); system.out.println("capture saved arraylist " + i); } list.clear(); } and method makescreenshot: private static bufferedimage makescreenshot() { robot robot = null; try { robot = new robot(); } catch (awtexception e) { e.printstacktrace(); } toolkit toolkit = tool...

c# - There is no ViewData item of type 'IEnumerable<SelectListItem>' that has the key 'Clients' -

i have variable populating records database. display list on view drop down box. however, fails once reaches drop down. controller: public actionresult review() { var reviews = reviewrepo.getallreviews(); var clients = clientrepo.clients(); list<selectlistitem> items = new selectlist(clients, "clientid", "clientname").tolist(); items.insert(0, (new selectlistitem { text = "default", value = "0" })); viewbag.listofclients = items; ienumerable<adminreviewviewmodel> model = reviews.select(s => new adminreviewviewmodel() { clientid = s.clientid, reviewid = s.reviewid, reviewname = s.reviewname, reviewperiodid = s.reviewperiodid, reviewperiodname = s.reviewperiod }); return view(model); } view: @using (html.beginform("review...

sql server - Reading a string expression with parameters and executing the expression as date -

i trying create dynamic code date calculation in sql stored procedures having problems executing string expressions , parameters date expressions. i want hold generic string expressions in table create dates according value of parameters. for example generic expression : dateadd(@timeresolution, -@iterationn, @currentcalc) as can see these generic expressions composed out of parameters to. in stored procedures intend declare variables in expression , assign values them using select statement different table. the problem after deriving these string values , writing expression not give me date want fails. so example if write following code declare @today date declare @lastyear date set @today = getdate() set @lastyear = dateadd(year, -1, @today) select @lastyear it works fine , last year's date. but when try : declare @today date declare @lastyear date declare @timeresolution varchar(5) select @timeresolution = [timeresolution] dbo.mytable rule...

How to convert long number string value to numeric value using Javascript / jQuery -

user allowed insert 25 value in textbox . i.e. 1234567890123456789012345 on change event of textbox need convert same numeric value perform numeric operations , after need display same entered value thousand separator along 2 decimal places. i tried following code: number($('#textbox1').val()).tofixed(2).replace(/\b(?=(\d{3})+(?!\d))/g, ",") parseint($('#textbox1').val(), 10).tofixed(2).replace(/\b(?=(\d{3})+(?!\d))/g, ",") both gives me following output 1.2,345,679,801,234,568e+21 expected output:- 1,234,567,890,123,456,789,012,345.00 try using autonumeric js. find here

oracle adf - How to upgrade JDeveloper11 to 12c? -

Image
i have downloaded oracle jdeveloper 11.1.1.7 ( jdevstudio11117install.exe ) developing adf/maf mobile application , want upgrade jdeveloper version latest. it possible upgrade/update latest version? or should need download latest freshly. please suggest. i suggest download fresh copy of jdeveloper 12c. jdeveloper 11.1.1.* has wizard updates, shown on image but can see stated can apply updates jdeveloper 11g (which means cannot automatically upgrade 12c).

swift - convert json marshall time to nsdate -

when marshall time.now() json object gives result "2009-11-10t23:00:00z" printing time.now gives 2009-11-10 23:00:00 +0000 utc . why different. t , z . how can convert swift nsdate object according this table? the meaning of values irrelevant, they're part of format (iso8601). there couple approaches this. 1 define custom marshaljson() method time or struct , use format date, other represent string in struct in first place when default implementation executes result you're looking for. the method you'll need use is; time.format(format string) golang docs show example using it; package main import ( "fmt" "time" ) func main() { // layout shows example how reference time should represented. const layout = "jan 2, 2006 @ 3:04pm (mst)" t := time.date(2009, time.november, 10, 15, 0, 0, 0, time.local) fmt.println(t.format(layout)) fmt.println(t.utc().format(layout)) } the medium date f...

how to make a global variables in single controller and call function inside factory in Angularjs -

i want make global variable can access in same controller. want data variable should global can access anywhere within controller. code :- var enterprise = angular.module('enterprisectrl',[]); enterprise.controller('enterprisecontroller',function($scope,$routeparams,$http,$location,enterprise){ $scope.enterprisesubmit = function(){ $scope.enterprise.sector_id = $scope.enterprise.select_sector.id; var f = document.getelementbyid('file').files[0], reader = new filereader(); reader.onloadend = function(e){ var data = e.target.result; } reader.readasbinarystring(f); var enterprise = enterprise.insert($scope.enterprise,$rootscope.file); enterprise.success(function(response){ if(response.data !=""){ $location.path('/enterprises'); }else alert(...

c++ - Why can I call getline without using std::getline? -

i following c++ primer book , trying out code examples. intrigued one: #include <iostream> #include <string> using std::string; using std::cin; using std::cout; using std::endl; int main() { string line; while (getline(cin,line)) cout << line << endl; return 0; } before compiling code guessing compilation fail, since not using while (std::getline(cin,line)) why getline in global namespace? understand, should happen if used namespace std; or using std::getline; i using g++ version 4.8.2 on linux mint debian edition. this argument dependent lookup . unqualified lookup (what doing when call getline() instead of std::getline() ) start trying normal name lookup getline . find nothing - have no variables, functions, classes, etc. in scope name. we in "associated namespaces" of each of arguments. in case, arguments cin , line , have types std::istream , std::string respectively, associated namespaces ...

html - css: How to make elements not to overlap + automatically place them in a relevant position -

so i'm trying make website users allowed post posts, have 2 problems. the first 1 being elements overlap, elements automatically placed divs using data db, wouldn't giving each 1 different id. the second 1 being, how allow 3 of them stay in same line. thanks in advance help. it depends on how structure every div, recommend use css box model avoid overlaping of divs div { width: 320px; padding: 10px; border: 5px solid gray; margin: 0; }

javascript - Does CreateJS contain an event listener similar to "ENTER_FRAME" in AS3? -

i trying translate effect found in "actionscript 3.0: game programming university" on html5 canvas rendering, , more specifically, create/easeljs. this code working on: private var flipstep:uint; private var isflipping:boolean = false; private var fliptoframe:uint; // begin flip, remember frame jump public function startflip(fliptowhichframe:uint) { isflipping = true; flipstep = 10; fliptoframe = fliptowhichframe; this.addeventlistener(event.enter_frame, flip); } // take 10 steps flip public function flip(event:event) { flipstep--; // next step if (flipstep > 5) { // first half of flip this.scalex = .20*(flipstep-6); } else { // second half of flip this.scalex = .20*(5-flipstep); } // when middle of flip, go new frame if (flipstep == 5) { gotoandstop(fliptoframe); } // @ end of flip, stop animation ...

Facebook connect - Javascript -

i'm trying implement facebook connect on website filling input fields. but can't email address or last , first name despite facebook application ask me if can access email address. here script: <script> window.fbasyncinit = function() { fb.init({ appid : '######', // app id status : true, // check login status xfbml : true, cookie : true, version : 'v2.4' // version }); }; function login() { fb.login(function(response) { if(response.authresponse) { getuserinfo(); }else{ console.log('user cancelled login or did not authorize.'); } },{scope: 'public_profile,email'}); } function getuserinfo() { fb.api('/me', function(response) { document.getelementbyid("name").value = resp...

ios - URL format for SOAP Web service that returns a JSON response -

i'm building ios app relies on web service. (using nsmutableurlrequest) i've been trying connect web service api gives json response based on parameters in url. i'm getting invalid json parameters. the guys host api have said http request should have following format: https://thewebserviceapi?parameters= {“api_key”:”your_api_ key”,”query”:{“perpage”:50}} i'm having no luck connecting @ all. under impression url's parameters had format: https://thewebserviceapi?firstparam=firstparamvalue&secondparam=secondparamvalue but format not working me. can tell me correct format should url? apparently double quotes required. working this: nsstring *urlstring = @"https://webserviceapi?parameters={\"api_key\":\"your_api_key\",\"query\":{\"perpage\":50}}"; nsmutableurlrequest *request = [nsmutableurlrequest requestwithurl: [nsurl urlwithstring:urlstring]];

windows - Invalid port in python sockets -

i getting error while trying send bare icmp message using following snippet: windows says port invalid given ip range. def send_ping(source_ip,target_ip,data_function=construct_icmp_echo): fail = 0 skt_send = socket.socket(socket.af_inet,socket.sock_raw,socket.ipproto_icmp) skt_recv = socket.socket(socket.af_inet,socket.sock_raw,socket.ipproto_icmp) (src_binary,) = struct.unpack (">l",socket.inet_aton(source_ip)) (tgt_binary,) = struct.unpack (">l",socket.inet_aton(source_ip)) skt_send.setsockopt(socket.sol_ip, socket.ip_ttl, 16) ipheader = struct.pack("bbhhhbbhll",0x54,0xdc,48,50,8,16,1,0,src_binary,tgt_binary) cksum = icmpcksum(ipheader) ipheader = ipheader = struct.pack("bbhhhbbhll",0x54,0xdc,48,50,8,16,1,cksum,src_binary,tgt_binary) skt_send.sendto(data_function(),(target_ip,22433)) skt_recv.bind((target_ip,22433)) skt_recv.settimeout(5) thetime = datetime.datetime.now() t...