Posts

Showing posts from March, 2015

sql - Update column from inner join -

this question has answer here: update table using join in sql server? 9 answers i have table of posts forum, there 1 row posting of pdf file , there row posting of image url goes pdf. took rows out of posts table , inserted them item table if pdf. have column in item table want filled row in posts table has image want update item set i.imageurl = p.guid join posts p on i.old_id = p.parent_post p.posttype = 'image' i have not been able find example anywhere update uses join , has clause , have idea doing wrong? the correct syntax in sql server looks more this: update set imageurl = p.guid item join posts p on i.old_id = p.parent_post p.posttype = 'image';

plsql - Use of Decode() if not equal condition in pl sql -

i working on cursors. in have 1 task such if column1=21 column2 can in ('item1','item2','item3') if column1 other 21 column2 can 'item1'. , both column1 , column2 part of primary_key. so tried approach.. i provide value in column2 above 3 values , in processing check if column1 21 can use of above 3 values , if column2 other 21 have use 'item1'. but using 2 columns in cursor , part of primary key , have fetch rowid in cursor check duplicate record. but not rowid change value of column2 in processing. so thinking use decode() not getting idea how use case: if column1 =21 column2:={item1,item2,item3}//any 3 values end if; if column1 <> 21 column2:='item1' end if; please suggest me. you can do: column2 := decode(column1, 21, '{item1,item2,item3}', item1) by way, "any 3 values" - non-deterministic why entered string '{item1,item2,item3}' . if know 1 of these values want -

sql - how to use concat columns of same table in Where condition -

user_id | email_id | type --------------------------------------- 000121 | test1234 | ext 000125 | best_21 | lot 000128 | lite_21@ | ext i want use like select * tablename concat (emailid,'',type) 'test1234 ext' but query not working why not use select * tablename emailid 'test1234' , type ' ext'

Regex for Currency with specific length in javascript -

i'm using following regex expression currency in input form fields: requirement maximum length of input field 16 digit , after decimal ( . ) 2 digit. try expression not working. wrong expression. ^(\d*\.\d{1,2}|\d+){0,16}$ valid //space- if user leave input box blank 0 0.9 9999 9999.0 9999.00 9999999999999999.00 invalid 0.00. 99999999999999999.00 999......000 ab999 $99.00 note :-alphabet , symbol not allowed (only . allow) you can use regex: ^\d{0,16}(?:.\d{1,2})?$ regex demo

numpy - Show confidence limits and prediction limits in scatter plot -

Image
i have 2 arrays of data hight , weight: import numpy np, matplotlib.pyplot plt heights = np.array([50,52,53,54,58,60,62,64,66,67, 68,70,72,74,76,55,50,45,65]) weights = np.array([25,50,55,75,80,85,50,65,85,55,45,45,50,75,95,65,50,40,45]) plt.plot(heights,weights,'bo') plt.show() i want produce plot similiar this: http://www.sas.com/en_us/software/analytics/stat.html#m=screenshot6 any ideas appreciated. here's put together. tried emulate screenshot closely. #------------------------------------------------------------------------------ import matplotlib.pyplot plt import scipy.stats stats import numpy np # data heights = np.array([50,52,53,54,58,60,62,64,66,67,68,70,72,74,76,55,50,45,65]) weights = np.array([25,50,55,75,80,85,50,65,85,55,45,45,50,75,95,65,50,40,45]) x = heights y = weights # modeling numpy p, cov = np.polyfit(x,y,1,cov=true) # parameters , covariance of fit y_model = np.polyval(p, x) # model using fit

mysql - registration form values are not getting inserted into database in php -

registration form values not getting inserted database in php. showing error while using mysql_connect , when using mysqli_connect, values not getting inserted database. form.html <html> <body> <form action="signup.php" method="post"> username <input type="text" name="username"> password <input type="password" name="password"> <input type="submit" value="ok" name="submit"> </body> </html> signup.php <?php $connection=mysqli_connect("localhost","root","","form") or die("not connected"); if(isset($_post['submit'])){ $username=mysql_real_escape_string($_post['username']); $password=mysql_real_escape_string($_post['password']); mysql_query("insert formval('username','password') values('$username','$password')"); } ?>

javascript - Responsive Menu not Displaying in Smartphone Default Browser? -

my responsive website when open in smartphone default browser responsive menu not displaying , when check smartphone chrome browser working fine . can me out of issue please ? here code : responsive css code here : .navigation { display: none; } .mobi-menu { display: block; float: right; width: 40px; height: 40px; position: absolute; right: 30px; bottom: -6px; outline: none; } .mobi-menu span { position: absolute; width: 20px; height: 2px; left: 10px; -moz-transition: 0.4s ease; -webkit-transition: 0.4s ease; -ms-transition: 0.4s ease; -o-transition: 0.4s ease; transition: 0.4s ease; } .mobi-menu span:nth-child(1) { top: 13px; } .mobi-menu span:nth-child(2) { top: 50%; margin-top: -1px; } .mobi-menu span:nth-child(3) { bottom: 13px; } .mobi-nav-container { display: block; -moz-transition: 0.4s ease; -webkit-transition: 0.4s ease; -ms-transition: 0.4s ease; -

css - WordPress sub-menu items not displaying properly on hover -

i having trouble sub-menu items @ following site. problem sub-sub-menu items, i.e. 3rd level items (i not sure these called). you may need front-end password view "calzada321" (no quote marks). http://polynovo.com.au/ as per screenshot (link below), in browsers, 3rd level items squished, ie not display in attractive or useful fashion on hover. not sure how fix (obviously). appreciated. http://polynovo.com.au/wp-content/uploads/2014/11/untitled-1.jpg /* 2.3 navigation ------------------------------------------------------------------------------*/ #navigation { margin-bottom: 7px; position: relative; z-index: 2; } #navigation .menu-item { float: left; background: url(../images/common/bg_nav-separator.png) no-repeat 0 center; position: relative; } #navigation .menu-item:first-child { background: none; } #navigation .menu-item.has-sub-menu:hover { background-color: #e5eaef; } #navigation .menu-item { color: #002d62; di

getting index of element in list (python) -

didn't understand why getting index of elements in list works differnt in next examples: list = [1, 1, 1, 4] print list.index(list[3]) returns expected 3 index fourth element in list but list = [1, 1, 1, 1] print list.index(list[3]) unexpectedly returns 0. what difference? it's python 3.3 list.index(x) returns index of first match. in first case first match @ index 3 i.e., 4 @ index 3, while in second case first match @ index 0 i.e, 1 @ index 0. 1 @ indices 1,2 , 3.

c# - Does Write send all bytes? (Serial Port) -

does write method of serialport write bytes told to? have code send data via serial port. serialport port = new serialport( "com1", 9600, parity.none, 8, stopbits.one); // open port communications port.open(); // write bytes byte[] bytes = encoding.ascii.getbytes("hello world pc"); port.write(bytes, 0, bytes.length); // close port port.close(); if send string "hello" device connected pc via serial port receives well. if send string "hello world pc" receives first 16 bytes instead of 19. there way can verify in code bytes sent? or problem of hardware connected via serial port? yes, .write synchronous data send before returns. anyway, 30 second timeout more enough, event if wouldn't.

database - Get Count of different values in comma separated row in mysql -

a table jobs have 2 column jobid, city when save job job location may multiple city below ----------------------------- jobid city ------------------------------- 1 new york 2 new york , ohio , virginia 3 new york , virginia how count jobid in perticular city want count of jobid in new york city want result new york 3 ohio 1 virginia 2 your database poorly designed , going have lot of trouble down line. using current structure can count using find_in_set function should avoid . your table as create table test (jobid int ,city varchar(100)); insert test values (1,'new york'), (2,'new york, ohio,virginia'), (3,'new york,virginia'); now count can use following select count(*) tot test find_in_set('virginia',city) > 0; as mentioned poor db design ideal as first job table job details a location table containing locations and table linking job ,

Android studio (0.9.1) beta - Ctrl+F1 hotkey -

Image
i'm beginner apologize silly question. ctrl + f1 hotkey displaying error. when press combination there painting tool appearing. i've tried change couldn't find combination ( ctrl + f1 ) in settings -> keymap, couldn't find name of functionality describes error (what ctrl + f1 did before). bug? how can revert ctrl + f1 did?

php - Parse error: syntax error, unexpected '',-2),'' (T_CONSTANT_ENCAPSED_STRING), expecting ',' or ';' -

"select " . table_prefix.db_usertable . "." . db_usertable_userid . " userid, " . table_prefix.db_usertable . "." . db_usertable_name . " username, " . table_prefix.db_usertable . "." . db_usertable_name . " link, " . db_avatarfield . " avatar,substring_index(substring_index(wp_usermeta.meta_value ,'"',-2),'"',1) role " . table_prefix.db_usertable . "left join wp_usermeta on " . table_prefix.db_usertable . "." . db_usertable_userid . "= wp_usermeta.user_id left join cometchat_status on " . table_prefix.db_usertable . "." . db_usertable_userid . " = cometchat_status.userid " . db_avatartable . " (select count(*) wp_bp_friends (initiator_user_id='" . $userid . "' , friend_user_id=wp_users.id) or (initiator_user_id=wp_users.id , friend_user_id='" . $userid . "'))=1 , wp_usermeta.meta_key =

wcf - How to Handle Fault Contracts in Biztalk -

error : <s:fault xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><faultcode xmlns:a="http://schemas.microsoft.com/ws/2005/05/addressing/none">a:actionnotsupported</faultcode><faultstring xml:lang="en-us">the message action '&lt;btsactionmapping xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:xsd="http://www.w3.org/2001/xmlschema"&gt; &lt;operation name="myoperation" action="http://tempuri.org/class/myoperation" /&gt; &lt;/btsactionmapping&gt;' cannot processed @ receiver, due contractfilter mismatch @ endpointdispatcher. may because of either contract mismatch (mismatched actions between sender , receiver) or binding/security mismatch between sender , receiver. check sender , receiver have same contract , same binding (including security requirements, e.g. message, transport, none).</faultstring></s:fault> operation used in

ios AVPlayer failed to stream remote video -

i have avplayer plays video remote url. here code: avplayeritem* playeritem = [avplayeritem playeritemwithurl:videourl]; self.player = [avplayer playerwithplayeritem:playeritem]; self.player.actionatitemend = avplayeractionatitemendnone; avplayerlayer *playerlayer = [avplayerlayer playerlayerwithplayer:self.player]; playerlayer.frame = playerview.bounds; [playerview.layer addsublayer:playerlayer]; [self.player play]; when start stream have less second video chunck , downloading stops , nothing happens. mpmovieplayercontroller , browser plays video usual. i doubt, might effect of cropping video (because videos without cropping works fine). here guide use crod video http://www.one-dreamer.com/cropping-video-square-like-vine-instagram-xcode/ also clean app same setup can't play video. any ideas? thanks! use avplayeritemplaybackstallednotification [[nsnotificationcenter defaultcenter] addobserverforname:avplayeritemplaybackstallednotification object:nil

javascript - angular : how can i bind select containing date with angular bootstrap calendar? -

i fill dropdown list array containing objects date attribute. list binded on date variable. angular boostrap calendar binded on variable. <select id="installfulldate" name="installfulldate" class="form-control" ng-options="installationslot.displaydate installationslot.displaydate installationslot in installationslots" ng-model="user.installation.date" required> </select> <img class="calendar-datepicker" src="images/calendar.png" datepicker-popup="mm/dd/yyyy" ng-model="user.installation.date" is-open="opened" datepicker-options="dateoptions" date-disabled="disableddate(date, mode)" min-date="mindate" max-date="maxdate" ng-required="true" close-text="x" ng-click="open($event)"> <span class="field-description">mm/dd/yy

android - get current system time in broadcast reciever -

i using below code time in broadcastreceiver on call performed i'm getting same value after making outgoing call. geting time code works when used activity it's throwing same value in broadcastreceiver. @override public void onreceive(context context, intent intent) { simpledateformat s = new simpledateformat("hhmmss"); string time= s.format(new date()); system.out.println(time); } receiver <receiver android:name="com.pairdroid.information.outcalllogger" > <intent-filter> <action android:name="android.intent.action.new_outgoing_call" /> </intent-filter> </receiver> your time format string wrong try replace : format formatter = new simpledateformat("hh:mm:ss a");

php - Laravel - the same validator works in one controller method but doesn't work in another -

i have 2 simmilar forms, 1 adding news site, edit news: {{ form::open(array('action' => 'mycontroller@verifyadminaddnews', 'files' => true)) }} {{ form::text('title', form::old('title'), ['required' => 'required']) }}<br><br> {{ form::textarea('subtitle', form::old('subtitle'), ['required' => 'required', 'style' => 'height:60px;']) }} <br><br> {{ form::textarea('text', form::old('text'), ['required' => 'required']) }} <br><br> {{ form::file('image', '') }} @if(isset($errormessage)) <div class="error-message"> {{ $errormessage }} </div> @endif {{ form::submit('pridať novinku', ['class' => 'form-control']) }} {{ form::close() }} and: {{ form::open(array('

javascript - Angular view template content updates only on mouse over -

Image
i have strange behavior using angular template controller . special view content updates on mouse on only. have setup few jsfiddles cannot reproduce problem. mistake in source code. special thing see here use $scope method format , display html content. {{order.total()}} € weird work sometimes. all other html parts updating expected. idea wrong? $scope.order = { _total : 0, total : function() { return globalize.format(this._total, "n"); }, positions: [] }; $scope.addproducttocurrentorder = function(packageindex, productid) { var rs = { _id : productid }; var tab = $scope.categories[packageindex].packages; (var = 0; < tab.length; i++) { var pack = tab[i]; if (pack.productid === productid){ pack.quantity++; rs.articlename = pack.name; rs.price = pack.price; rs._price = pack._price; rs.unit = pack.unit; rs.weight = pack.weight; break; } } $scope.

compare csv files with bash\awk\shell -

i write script perform compare between csv files. still have problem need be 5 values - space - 5 values the problem there lines contain 4 values, need add instead of missing value space columum input: file1: 1,1,1,1 3,3,3,3,3 file2: 2,2,2,2 4,4,4,4,4 now results that: 1,1,1,1, ,2,2,2,2 3,3,3,3,3, ,4,4,4,4,4 i need results this: 1,1,1,1, , , 2,2,2,2,*space* 3,3,3,3,3, ,4,4,4,4,4 this code: #! /bin/bash #------------------------------------------------------------------------------ # # description: joins files vartically based on file extensions. # # usage : ./joinfile directory1 directory2 # #------------------------------------------------------------------------------ #---- variables --------------------------------------------------------------- resultfile="resultfile.csv" #---- main -------------------------------------------------------------------- # checking if 2 arguments provided, if not, display usage info, , exit. if [ &quo

html5 - Transitions and backgrounds not mixing -

i've been testing in ie11/win7 since doesn't work there matters little me if works in other browser. need solution work accross browsers. im creating na html5 menu using css. have background set dropdowns , using :before place na arrow in menu items have submenu. want submenus show in fade - , that's problems start. at first had transition , background set in inner ul, , worked - except :before counts child arrows show when submenu visible , that's not good. so placed div around inner ul , used :before in div while fade ul. arrows still show when submenu wasn't visible, when menu visible background show line accross top (height 0 guess) so placed background in div , workd except fading happens menu items themselfs , not background. here's jsfiddle last attempt . is there way can make want? (show arrows + background shows , fades in)

JS error when a linked page has jQuery mobile tabs and navbar widget -

{{ see demo }} page 1 jquery mobile page. page 2 page with jquery mobile tabs , navbar widget. page 3 page without jquery mobile tabs , navbar widget. the structural difference between 2 , 3 presence of data-role=tabs. a) when each of them run (you type url on address bar), fine. b) when click page 1 page 2, i) js error: uncaught syntaxerror: unexpected token < vm10189 jquery-1.11.1.min.js:2 ii) code outside <page/> on page 2 run, see alert. c) when click page 1 page 3, fine (no js error, code outside <page/> not run). what wrong? somebody gave an answer on same question asked elsewhere. checked working. for $.widget( "ui.tabs", $.ui.tabs, { ....

How to use PHP alert box -

i have html page, textbox(required field) , button , php script associated button sending email whenever put email address , clicks on button sending mail, working fine want whenever give his/her email id , clicks butto alert box come message subscribing us. how .?? this html subscribe us</p> <form id="subscribe" name="subscribe" action="subscribe.php" method="post" class="validate" target="_blank"> <div class="input-append"> <input type="email" id="email" name="email" placeholder="your email" /> <button class="subscribe-button btn" type="submit" onclick="return check();">subscribe</button> </div> </form> and php script <?php /* subject , email varialbles*/ $emailsbuject = 'subscribe'; $webmaster =

qt - How to make an applicantion icon for c++ in Netbeans -

i trying create application icon c++ program using qt in netbeans. able change form icon, want change icon on .exe. most of methods have found involves editing .rc , .pro files in project, .rc , .pro files can find in project folder, gets generated automatically , changes make gets lost. any appreciated. just posting solution cause needed long time figure out (won't perfect or beautiful solution works.) 1) create file called "resource.rc": (supposed icon.ico in same folder) mainicon icon "icon.ico" 2) call "windres resources.rc -o coff -o resources.res" 3) put resources.res project folder 4) right click on c++ project in netbeans -> properties -> build -> linker -> additional options: add "resources.res" 5) build.

microcontroller - what are the hex value in MCP2515 SPI instruction set, looks not like address -

i read mcp2515.h files online. there 1 part spi instruction set, or spi commands. example: #define mcp_cmd_write 0x02 #define mcp_cmd_read 0x03 #define mcp_cmd_bit_modify 0x05 #define mcp_cmd_load_tx 0x40 #define mcp_cmd_rts 0x80 #define mcp_cmd_read_rx 0x90 #define mcp_cmd_read_status 0xa0 #define mcp_cmd_rx_status 0xb0 #define mcp_cmd_reset 0xc0 those hex 0*xx values not address. or microchip defined values? they refer spi instruction sets. under table 12-1. definitions asking instruction format converted hex. http://ww1.microchip.com/downloads/en/devicedoc/21801g.pdf

.net - NameSplit = Source.Split(New [Char]() {CChar(Seperator)}) -

can me, im new vb , using code log temperatures via usart microcontroller. have function string in csv format. have difficulty understanding line : namesplit = source.split(new [char]() {cchar(seperator)}) public class form1 'parse text in file per "csv" style ==> (items per record) public function field(byval source string, byval seperator string, byval index integer) string dim namesplit string() 'declare nuwe variable waarin namesplit = source.split(new [char]() {cchar(seperator)}) 'vind enige karakter en gryp hom, soek dan n komma wat die sepearotr en split if index - 1 < 0 field = "index out of range" else field = namesplit(index - 1) end if end function any appreciated. string.split msdn returns string array contains substrings in instance delimited elements of specified string or unicode character array. in case using overload: split(c

javascript - Read XML in PHP with simplexml_load_string -

via javascript xml sent php. how can read xml in php simplexml_load_string . xml send encodeuricomponent(curtainxml) . when read xml in php variable $unique_id empty. why empty? php: $importxml2 = urldecode($importxml); $unique_id = $xml->gordijn->info->windecor_reference_number $unique_id empty? ajax: var curtainxml = '<\?xml version="1.0" encoding="utf-8" \?><order><gordijn><info> <commissienaam>www</commissienaam> <stofnaam>peyton plus 16 zand</stofnaam> <kleur>16 zand</kleur> <windecor_reference_number>605994_8eb9366a96de44058b7a0e903d0d9b84</windecor_reference_number> <debiteur_nummer>bakel, van interieur</debiteur_nummer> <debiteur_name>110101 </debiteur_name> </info> <gordijnsoort>plooigordijn</gordijnsoort> <vertrek>222</vertrek> <hoogte>222.0</hoogte> <breedte>222.0</breedte> <

java - Mongo DB eval nolock:true -

hi, running eval script node js making nolock true disable global lock.the same eval script running java nolock true. string jsfunction = "function(){" + "var uid = 12;" + "return refreshlist(uid,false);}"; dbobject commandobj = new basicdbobject(); commandobj.put("eval", jsfunction); commandobj.put("nolock", true); commandresult status =db.command(commandobj); db.eval("function (x, isoverwrite) { return refreshlist(x, isoverwrite);}", [21,isoverwrite] ,{nolock:true}, function(err, result){ }); in java while running script there no lock in db , can able run query simultaneously.but in node js running above code no able other process simulatneously.i not able see lock logs in mongodb console also. don't know why behaviour changes in both. tried using command query in node js got same issue.

CMake: how to change compiler for individual target -

i have embedded project using cross compiler. introduce google test, compiled native gcc compiler. additionally build unit test targets ctc compiler. briefly: have 3 different targets , compile them 3 different compilers. how express in cmakelists.txt ? tried set_target_properties ; seems impossible set cxx variable command! i had same issue right now, other answer didn't me. i'm cross-compiling, , need utility programs compiled gcc, core code compiled avr-gcc. basically, if have cmakelists.txt , , want targets in file compiled compiler, can set variables hand. define these macros somewhere: macro(use_host_compiler) if (${current_compiler} strequal "native") # save current native flags set(native_c_flags ${cmake_c_flags} cache string "gcc flags native compiler." force) # change compiler set(cmake_system_name ${cmake_host_system_name}) set(cmake_system_processor ${cmake_host_system_processor}) set(cmake_c_co

How fast is perl hash select? -

i use perl hash store ip -> hostname pairs. have millions of it. i cache gethostbyip syscall in hash %hostname{$ip}. memory not issue. time is. how fast perl hash search works in condition? will work faster if use mysqldb or berkleydb instead? assuming have sufficient ram hold of data, in-memory lookups always faster retrieving data external source (disk, database, etc.) because ram fast , i/o operations slow. if can't hold in ram, becomes less predictable , may need benchmark determine what's faster particular combination of program , hardware.

java - What is wrong with my JTextField here? (details in text) -

edit: ui class sends #login client, client sends server, server sends "@login" client indicating successful log-in , client sends "@login" along ui via ui.display() apologies bad grammar/formatting. here's relevant block of code, explanation follow: else if (e.getsource() == this.loginbutton) { if (this.soundon == true) { this.clicksound.play(); } this.client.handlemessagefromclientui("#login "+this.loginfield.gettext()); this.client.handlemessagefromclientui("#balance"); this.client.setloginid(this.loginfield.gettext()); if (this.loggedin) { this.loginbutton.setenabled(true); this.note.settext("account screen"); this.status.settext("logged in to: "+this.client.getloginid()); this.maindisplay.removeall();

c# - How to bind the view to the VM wrapper instead of directly to the Model when multiple levels -

say have model structure this being |_ person |_ billing address |_ customer |_ shipping addresses (collection) |_ etc.. |_ etc.. my view this listbox (itemssource - bound vm wrapper of "being") - datatemplate containing listbox2 (itemssource - bound vm wrapper of "person") - datatemplate containing listbox3 (itemssource want bound "shipping adresses") problem! im using mvvm light , locator, cannot figure out how third level - "shipping adresses" binding in third second datatemplate (listbox3). allows me bind shipping addresses collection in model directly. want in vm wrapper of customer, because need collection. code inner binding. if understand model hierarchy, looks shipping address 4th level (unless mean being abstract or zero). should able dig each model's members so <listbox itemssource="{binding being}"> <datatemplate> <listbox itemsource=&quo

forms - InfoPath 2010 How to avoid validation when a section is hidden? -

i trying design info path form links share point list. have "extra" section on form visible if check box value = true. the problem of fields on "extra" section mandatory. when check box value = false, section hidden , cannot fill in fields. when try submit form error message mandatory fields must completed. not want complete fields.. section kept hidden. any suggestion on how working helpful thanks. do not add required field checkbox instead create validation rule checks if value true , hidden field empty send required error. this way can submit form.

javascript - Knockout update observable -

i extending application knockout.js set want dynamically display file upload. code function search() { var self = this; //many different items set self.totalsize = ko.observable(total); self.uploadedsize = ko.observable(uploaded); } var uploadprogress; var total = 100; var uploaded = 0; function runuploadprogress() { uploadprogress = setinterval(function () { callwebapi({ api: webapi.getuploadprogress, data: null, cache: false, success: function (json) { total = json.totalbytes; uploaded = json.transferedbytes; console.log(total + " - " + uploaded); } }); if (total == uploaded) { stopuploadprogress(); } }, 1000); return true; } function stopuploadprogress() { clearinterval(uploadprogress); } how can make totalsize , uploadedsize observable update new values? thought if change value

jquery - Randomly position divs on page load -

i looking randomly position batch of divs on screen when page loads - i'd opacity value , size random on load. tips on how achieve this? looking jquery way // thanks for (var i=1; <= 3; i++) { // minimum 0 , maximum 60%. can change that. var x = math.max(0, math.min(60, math.ceil(math.random() * 100))); var y = math.max(0, math.min(60, math.ceil(math.random() * 100))); $('<div />').css({ position: 'absolute', width: '300px', height: '100px', top: y + '%', left: x + '%', 'background-color': 'rgba(0,0,0,' + math.random() + ')' }).text('top:' + y + ', left:' + x).appendto('body'); } http://jsfiddle.net/hspvadfv/ it's turn play math , change var x , y.

error handling - TYPO3: How to handle missing typeNum? -

when given typenum not configured in typoscript, typo3 throw exception/cms/1294587217 . background: after moving system typo3 have lot of these exceptions type param used there form field, search engines still stores many links domain users meet "oooops, error occurred" page i'd handle myself i.e. redirecting 404 page instead displaying error (fide pagenotfound_handling ), there ready use solution or should create handler myself , interact requests typenum > 0 ? apparently i'm looking pageunavailable_handling : $globals['typo3_conf_vars']['fe']['pageunavailable_handling'] = 'redirect:/404.html';

Multiple plots in R on one page using par(pin) result in wasted space -

Image
i want plot several plots in r, 24 in 1 page. furthermore, want plots have rectangular form. when use: par(mfrow = c(6,4),pin = c(2,1)) i plot massive white space wasted, @ bottom , top of plots. if try reduce outer margin of plots using: par(mfrow = c(6,4),pin = c(2,1), oma = c(0,0,0,0)) the result same. you can control margins, have tried this: layout(matrix(c(1:24), nrow = 6, byrow = t));par(mfrow = c(6,4),pin = c(2,1), oma = c(0,0,0,0)); (i in 1:24) { plot(rnorm(100), main = sprintf("%do gráfico", i)) }

automation - Error #NAME? after putting formula from Visual FoxPro into the Excel cell -

i populate existing excel spreadsheet using visual foxpro automation. if put valid excel formula =sum(d2:d4) #name? error. when confirm (that is, click on cell , press enter) cell (with no changes), error disappears. use excel 2007 polish version, proper formula =suma(d2:d4) . here part of code: oexcel = createobject("excel.application") oexcel.visible = .t. oexcel.application.usercontrol=.t. oexcel.application.interactive=.t. oexcel.displayalerts = .f. oworkbook = oexcel.application.workbooks.open("&xfile") oexcel.activesheet.usedrange.entirecolumn.autofit tformula = "=suma(d2:d4)" tcell = "d5" oexcel.range("&tcell").value = [&tformula] as see, turned off displayalerts . if manually turn off formulas checking option-formulas in excel doesn't help.

Can we dual boot on Intel Xeon MIC card? -

i'm using rhel machine host mic0 coprocessor. have mpss3.2.3 installed on mic0 . i wanted know if can apply concept of dual boot , can install mpss3.3. on boot screen can select kernel want work on. can install different kernel versions , can select 1 work on eg.: windows or linux, same way can have setup give me previledge of installing different kernel versions of mpss on mic0 coprocessor. if yes, how? if no , why not? thanks it's possible bit involved (my scripts convert standard rpm base automatically multi version setup 3000 lines of shell code ....) a) unpack *rpm packages using rpm2cpio , cpio location, /opt/intel/mpss/version instead of installing them directly b) create custom script load/unload mpss mic.ko driver c) set path/ld_library_path/mic_ld_library_path .... suitable values d) create custom somepath/etc/mpss.version directory , conf files - important correct pointers bzimage , initrd e) start mpssd via: /opt/intel/mpss/version/

optimization - Python, combinations, permutations without repeat -

python. have 2 lists, same length. idea build paired data (for regression analysis). figured out loops , this. a=(1,3,5,7) #first list b=(2,4,6,10) #second list w=zip(a,b) #paired values both lists i=0 j=0 each in w: x= w[i] in xrange(i,len(w)-1): i+=1 print x, w[i] j+=1 i=j the output expected - first pair second, third.. on, second pair third, fourth.. , on (skipping combination between second pair , first pair, because kinda same combination of first , second pairs...) (1, 2) (3, 4) (1, 2) (5, 6) (1, 2) (7, 10) (3, 4) (5, 6) (3, 4) (7, 10) (5, 6) (7, 10) [..] , on expecting. the question - there other, shorter, optimized ways how rewrite code, maybe using itertools? yes: itertools.combinations print list(itertools.combinations(w, 2)) you mention in question - i'm not sure why wouldn't in docs before asking on stackoverflow.

javascript - In google chrome, getBoundingClientRect().x is undefined -

i'm performing drawing operations on canvas. best way calculate cursor position relative canvase top left corner is, in opinion, usage of .getboundingclientrect() : htmlcanvaselement.prototype.relativecoords = function(event) { var x,y; //this current screen rectangle of canvas var rect = this.getboundingclientrect(); //recalculate mouse offsets relative offsets x = event.clientx - rect.x; y = event.clienty - rect.y; //debug console.log("x(",x,") = event.clientx(",event.clientx,") - rect.x(",rect.x,")"); //return array return [x,y]; } i see nothing wrong code , works in firefox. test it. in google chrome however, debug line prints this: x( nan ) = event.clientx( 166 ) - rect.x( undefined ) what doing wrong? is not according specifications? edit: seems code follows w3c: from specs: getboundingclientrect() the getboundingclientrect() method, when invoked, must return result of following algo

CSS - Floating sections left and right, responsive design -

i trying create responsive layout sections of article appear in right hand column on larger breakpoints. sections in each column must stack on top of each other. the problem having box 4 appearing opposite box 3, creating unwanted gap under box 2 in right hand column. .wrapper { width: 400px; } .section { width: 50%; } .left { float: left; clear: left; background-color: #e26a6a; } .right { float: right; clear: right; background-color: #dcc6e0; } <body> <div class="wrapper"> <div class="section left">1 lorem ipsum dolor sit amet, consectetur adipisicing elit, sed eiusmod tempor incididunt ut labore et dolore magna aliqua. ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. duis aute irure dolor</div> <div class="section right">2</div> <div class="section left">3</div> <

java - ORA-00911: invalid character error using a PreparedStatement -

i trying pass list of order numbers in clause using prepared stmt. getting error invalid character . using below code list<string> ordernolist = arrays.aslist(orderno.split(",")); string sql = "select * order_"+market+".marc_ord_un_sts_t s,order_"+market+".marc_ord_ln_t l, " + "order_"+market+".marc_ord_t o ,order_"+market+".ord_rls_rel_t ort,order_"+market+".rls_t rt,order_"+market+".rls_ln_t rn " + "where rt.rls_key=rn.rls_key , o.marc_ord_key=l.marc_ord_key , l.marc_ord_ln_key=s.marc_ord_ln_key , " + "o.ord_no=ort.ord_nbr , ort.crm_ord_nbr=rt.crm_ord_nbr , " //+ "s.marc_ord_sts_cd='500' , " + "rn.ln_qty>0 , rn.orig_ord_ln_nbr=l.ord_ln_nbr , s.sts_qty>0 " + "and o.ord_no in ("; for( string id : ordern

gruntjs - HAML to HTML converter on Windows -

is there haml html converter windows see on ubuntu uses grunt. ex. in terminal grunt haml converts code .haml .php offline. windows have app or something? there's grunt-haml-php . doesn't work on windows. in order make run on windows, have make hacks it. after installation done, find node_moules/grunt-haml-php/tasks/haml.js file , have tweak this. ... var compilehaml = function(item, cb) { var args = ['-t', hamltarget || 'php', item ]; // change above line following // var args = [path.join(__dirname, '../bin/haml'), '-t', hamltarget || 'php', item ]; ... var child = grunt.util.spawn({ cmd: path.join(__dirname, '../bin/haml'), // change above line following // cmd: 'php', args: args }, function(error, result, code) { cb(error, result.stdout); }); ... grunt-haml-php uses mthaml , looks mthaml still not stable. lacks many features yet. hope answer helps you're

jquery - What is the best way to delete object from complex JavaScript object -

i have javascript object looks this: { "filters": [ { "name": "test", "items": [ { "id": 1207700620, "checked": false }, { "id": 1207825584, "checked": false }, { "id": 1207969166, "checked": true } ] }, { "name": "empty", "items": [] }, { "name": "thirdlist", "items": [ { "id": "1207828314", "checked": true }, { "id": "1236723086"

annotations - Polygon annotorious with openseadragon -

i using annotorious openseadragon. facing issue polygonselector plugin. anno.addplugin('polygonselector', { activate: true }); if use add plugin code in window load says 'annotator.addselector not function'. if use add plugin code while click add annote button says not load plugin: polygonselector. thanks !!

python - Django's ORM. Group by elements with difference -

Image
i have django model: class visits(models.model): ip = models.genericipaddressfield() url = models.charfield(max_length=200) datetime = models.datetimefield(auto_now_add=true) def __unicode__(self): return "%s : %s (%s)" % (unicode(self.ip), unicode(self.datetime.strftime('%d/%m/%y %h:%m:%s')), unicode(self.url)) it contains visits website. example, these values db: <visits: 127.0.0.1 : 27/11/14 00:00:00 (/)>, <visits: 127.0.0.1 : 27/11/14 00:01:00 (/)>, <visits: 127.0.0.1 : 27/11/14 00:09:00 (/)>, <visits: 127.0.0.1 : 27/11/14 00:45:00 (/)>, <visits: 127.0.0.1 : 27/11/14 00:46:00 (/)> i want write orm query groups values 15-minutes delta. example, query should return count()==2 (first 3 values in first group, second 2 in second). how can using django's orm? here have 4 visits , tried filter out minitues grater 28. >>> vi

java - loading tomcat using code -

im using tomcat 7 , , im trying nice. want have little swing program operate current project (a site) i wish have in swing application button run server , shut server , such. i know there option of running start application dont want it. want have option click swing button , load it. for , need run server code. is there way load tomcat server via code? a quick solution may using runtime can - runtime.getruntime().exec("startup.bat"); similarly, stop - runtime.getruntime().exec("shutdown.bat"); assuming both batch files exist in tomcat bin directory.

c# - MVC UpdateModel is not updating some of the model properties -

in mvc 5 ef database first project have been using updatemodel method in controller action successfully, after including additional fields (previously unused application) find new fields refuse values updatemodel method call. thing of significance can identify fields share part of name. consider class example: public class record { public int id {get;set;} public string details {get;set;} public string detailsfile {get;set;} ... } the property/field detailsfile unused, optional field on web form. stored in <input type="hidden" name="detailsfile" id="detailsfile /> , posted controller action correct value (or empty string). within controller action handle update this: [httppost] public async task<actionresult> edit(record_editview model, formcollection collection) { if (modelstate.isvalid) { try { var record = await db.record.findasync(model.id); updatemodel(record, collection);

c# - Windows Phone 8.1 How to programatically create a tile with specified template -

i'm trying figure out how create programatically tile specified template (tilesquare150x150text03)? tried follow these guides link , msdn , few similiar, wherever paste < tile> ... < /tile > markup (e.g. in page or app .xaml file) visual studio underlines markup , says "tile not supported in windows phone project". don't need tile updates or tiles 2 sides. simple 1 specified template, background color/image , filled text. can explain me i'm doing wrong? thank help. simple! need parse tile template (an xml string) xelement object in code : var template = "<tile>etc</tile>"; var tilexe = xelement.parse(template); either configure template xml liking before or after (demo in article linked) then post tile manager var tilenotification = new tilenotification(tilexe); tileupdatemanager.createtileupdaterforapplication().update(tilenotification); you can anywhere in app long code runs on ui thread. note there li

java - What is reason for list couldn't convert into array? -

i'm trying convert list type data collection array. public void method1(list s1){ list s=s1; string []array = new string[s.size()]; array=(string[])s.toarray(); for(int i=0;i<array.length;i++){ system.out.println(array[i]); } } then following class cast exception occurs. error line "array=(string[])s.toarray();" line. java.lang.classcastexception: [ljava.lang.object; cannot cast [ljava.lang.string; what reason that? list.toarray() method in interface list , , documentation not specify kind of array returned method. however, unlike other answers suggested, list.toarray() method cannot return array of generic type of list, because generic type of list not known @ runtime. because of that, implementations of list built-in standard api return object[] , , not string[] . however, allowed pass own pre-allocated array method list.toarray(object[]) . if that, guaranteed return value has same element type array p

I didn't find c3.css and c3.min.js for c3.js chart -

<%@ page language="java" contenttype="text/html; charset=iso-8859-1" pageencoding="iso-8859-1"%> <!doctype html public "-//w3c//dtd html 4.01 transitional//en" "http://www.w3.org/tr/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1"> <title>insert title here</title> <link href="/path/to/c3.css" rel="stylesheet" type="text/css"> <script src="http://d3js.org/d3.v3.min.js" charset="utf-8"></script> <script src="/path/to/c3.min.js"></script> </head> <body> <script type="text/javascript"> var chart = c3.generate({ data: { columns: [ ['data1', 30, 200, 100, 400, 150, 250], ['data2', 50, 20, 10, 40, 15, 25] ] } }); settimeout(function