Posts

Showing posts from March, 2012

javascript - Three js, block textures are blured -

Image
i'm trying make 3d block three.js library. i've done it. wan't put texture on it. did , it's working : var textureherbe = [ new three.meshbasicmaterial({map:three.imageutils.loadtexture('img/texture/herbe/border.gif')}), new three.meshbasicmaterial({map:three.imageutils.loadtexture('img/texture/herbe/border.gif')}), new three.meshbasicmaterial({map:three.imageutils.loadtexture('img/texture/herbe/top.gif')}), new three.meshbasicmaterial({map:three.imageutils.loadtexture('img/texture/herbe/bottom.gif')}), new three.meshbasicmaterial({map:three.imageutils.loadtexture('img/texture/herbe/border.gif')}), new three.meshbasicmaterial({map:three.imageutils.loadtexture('img/texture/herbe/border.gif')}) ]; thats result : @ this, it's blured ! looked @ this link . , don't know how mix code solution's code :/ jnow how can ? thx , have day. first of loading same texture se...

Height of left and right sides are uneven - CSS -

with following code, i'm trying leftside , rightside same height despite fact have lots of info on left , little bit on right. want there vacant space under text on rightside . have coded wrong or missing something? thanks. #sides { padding-bottom: 40px; margin-bottom; 40px; background-color: white; } #leftside { width: 62%; display: inline-table; background-color: #000000; float: left; padding-right: 20px; padding-left: 5%; box-sizing: border-box; } #rightside { width: 38%; display: flex; background-color: #808080; float: left; padding-left: 20px; box-sizing: border-box; flex-direction: column; } <div id="sides"> <div id="leftside"> <h1>tons o' text</h1> </div> <div id="rightside"> <h1>tiny amount of text</h1> </div> </div> remove display: inline-table; #leftside

php - Use of Undefined Constant Notice on CodeIgniter -

i checked whole site couldn't find answers it, decided post question. i'm developing website codeigniter 3.0 , oftenly getting notice below: severity: notice message: use of undefined constant - assumed ' ' filename: yonetim/master.php line number: 149 backtrace: file: /home/address/public_html/application/views/yonetim/master.php line: 149 function: _error_handler file: /home/address/public_html/application/controllers/yonetim/anasayfa.php line: 9 function: view file: /home/address/public_html/index.php line: 292 function: require_once line 149 on master.php below: <li <?php if($this->uri->segment(3) == 'bayiler') { ?>class="active"<?php } ?>> i know, can disable notification alert on index.php don't want make way. know right solution? thanks in advance.

Java Swing - How make a component either a Combobox or a JtextField -

please bear me new java swing , have literally spent days trying figure out. have frame 2 panels. first panel has 2 buttons ("i simplifying"): "new" , "open". second panel displays empty jcombobox when frame appears, jcombobox setenable(false). intention have user select either "new" or "open" , component in second panel either convert jtextfield, if user presses "new" or remain jcombobox if user presses open. items of jcombobox populated database, populating combobox working. problem trying figure out how convert component in second panel either jtextfield or jcombobox. tried making combobox jtextfield using removeallitems , setting setpopupvisible false, not seem work. keep getting component pulldown arrow, when clicked on displays single empty row, looks strange. want inhibit pulldown displaying empty row, or convert component simple jtextfield. apprepriated. public class newbuttonlistener implements act...

javascript - Get HTML instead of text using YQL Web Service URLs -

how html instead of text using yql? my code : <div id="container" style="width:500px;height:500px;"> </div> jquery.ajax = (function (_ajax) { var protocol = location.protocol, hostname = location.hostname, exregex = regexp(protocol + '//' + hostname), yql = 'http' + (/^https/.test(protocol) ? 's' : '') + '://query.yahooapis.com/v1/public/yql?callback=?', query = 'select * html url="{url}" , xpath="*"'; function isexternal(url) { return !exregex.test(url) && /:\/\//.test(url); } return function (o) { var url = o.url; if (/get/i.test(o.type) && !/json/i.test(o.datatype) && isexternal(url)) { // manipulate options jsonp-x request made yql o.url = yql; o.datatype = 'json'; ...

Parsing Json into a dynamic c# object with a dynamic key -

Image
i'm trying parse google calendar response i'm getting rest api using c#, seem keep getting stuck. [edited] update, @ symbol isn't preventing drill down, verified replacing @ _at_ . see screenshot of quick watch: i'm sure i'm accessing incorrectly... here's jsonstring i'm trying parse: { "kind": "calendar#freebusy", "timemin": "2015-06-12t14:00:00.000z", "timemax": "2015-06-14t14:00:00.000z", "calendars": { "joe@bobs.com": { "busy": [ { "start": "2015-06-13t18:30:00z", "end": "2015-06-13t19:30:00z" }, { "start": "2015-06-13t20:30:00z", "end": "2015-06-13t21:30:00z" }, { "start": "2015-06-13t23:00:00z", "end": "2015-06-14t00:00:00z" } ] } } } i've tried using: dynam...

scala - Connecting the first two nodes with an edge from two RDDs in GraphX -

i using graphx first time , want build graph incrementally. need connect first 2 nodes edge knowing have 2 rdds (each 1 has single value): firstrdd: rdd[((int, array[int]), ((vertexid, array[int]), int))] secondrdd: rdd[((int, array[int]), ((vertexid, array[int]), int))] i want connect first vertexid second one. appreciate help basically, use map , case statements pick out vertexids, then, use rdd.zip stitch them together, map create final edgerdd: firstrdd.map{ case ((junk1,junk2), ((vertex1, junk3), junk4)) => vertex1 }.zip( secondrdd.map{ case ((junk1,junk2), ((vertex2, junk3), junk4)) => vertex2 } ).map{ case(vertex1, vertex2) => edge(vertex1, vertex2, 0) }

c# - SQL Simulating a foreach -

i have insert 7 rows table each row found in table, doing c# application, dreadfully slow relatively small database. i want move 1 query, , best method foreach loop, sql doesnt have though while loop have do. however cant insert part cannot loop through rows, here sql far declare @cnt int = 0; select resno res tsgrno = 1; print 'row cnt'; print @@rowcount; -- prints 0 though 6 rows returned while @cnt < @@rowcount begin print @cnt; --in here need -- insert tbl (_,tbl.resno,_, _, _) -- values (_,row.resno,_,_,_) set @cnt = @cnt + 1; end does know better , working way this? edit: this @ now declare @_r1 int = 7, @_date int = 20150608 select * res r not exists ( select * vis_resr rr rr.resno = r.resno , rr.date = @_date ) , r.tsgrno = 1 , r.r1 = @_r1 insert vis_resr (r1, resno, vis_resr.date, frtm, totm) values (@_r1,r.resno,@_date,0,0) @_r1 , @_date set before send...

c++ - When is constructor's code of a class defined in global space running? -

class testclass { public: int x, y; testclass(); }; testclass::testclass() { cout << "testclass ctor" << endl; } testclass globaltestclass; int main() { cout << "main " << endl; return 0; } in code known first output "testclass ctor" . my question: ctor function call codes run before main() (i mean, entry point change ?) , or right after main() , before executable statements or there different mechanism ? (sorry english) the question stated not meaningful, because main not machine code level entry point program ( main called same code e.g. executes constructors of non-local static class type variables), and the notion of “right after main() , before executable statements” isn't meaningful: executable statements in main . generally, in practice can count on static variable being initialized before main in concrete example, standard not guarantee that. c++11 §3.6.2/4: ...

php min() array is returing wrong from foreach -

i calculating , getting result , array function in foreach loop , min() or max() on result result wrong. can explain me why? thanks function subtract($a, $b){ $c=$b-$a; return $c. ','; } $r=3; $numbers = array(12, 11, 6, 9, 15); foreach ($numbers $index=>$value) { $deductions[]=array(subtract($r, $value)); $minimum=min($deductions); } print_r($minimum); i 12 instead of 3 in case. function subtract($a, $b){ $c=$b-$a; return $c; } $r=3; $numbers = array(12, 11, 6, 9, 15); foreach ($numbers $index=>$value) { $deductions[]=array(subtract($r, $value)); $minimum=min($deductions); } echo min($minimum);

jquery - Enable button when passwords are alike -

so figured out how check out if 2 password inputs alike. now, want when passwords alike, wanna enable submit button. i've come with: $("#pass2").keyup(function() { settimeout(function() { if ($("#pass1").val() !== $("#pass2").val()) { $(".nosamepass").fadein('slow'); $(".password").css("border", "1px solid #ff0033"); $('#postpass').attr('disabled', 'true'); } else { $(".nosamepass").fadeout('slow'); $(".password").css("border", "1px solid #232323"); $('#postpass').attr('disabled', 'false'); } }, 0); }); the button disabled default. but fore reason, button doesn't enable. how can fix this? you have put false in string needs be $('#postpass').attr('disabled', false); ...

javascript - Joomla 3.3.6 Uncaught ReferenceError: Install is not defined -

i try configurate joomla 3.3.6 in vm instance of google compute engine, , when configurate configuration tab , click "next" not work, , console appears "uncaught referenceerror: install not defined". what error? forgot configurate something? sorry english.

jquery - bootstrap carousel doesn't work it is not responsive to the pictures -

bootstrap carousel doesn't work not responsive pictures. arrows go @ left/right of screen , not @ left/right of pictures have tried different codes still doesn't work. may problem google drive? my website is: googledrive.com/host/0b48_aimahv6_fnaynhdkmtdft0vms2iwcg4ytw1stmdgugr3dg5fowzacgpwbxo0x1pwalu i hope can me out. i'm still working on exact solution i'll editing this, , it'd easier if had jsfiddle link. so far have images working in this fiddle: . if i'd replace code carousel one.

android - Clicking hamburger icon on Toolbar does not open Navigation Drawer -

i have simple android.support.v7.widget.toolbar , trying open navigationdrawer pressing "hamburger" icon in top left corner. "hamburger" button visible, , when start pull left see animation on button pressing button not open/close navigationdrawer expect. have followed [google documentation][1] , still not able figure out. sorry confusion, below simplified code attempting use: public class mainactivity extends appcompatactivity implements view.onclicklistener, googleapiclient.connectioncallbacks, googleapiclient.onconnectionfailedlistener { @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); toolbar toolbar = (toolbar) findviewbyid(r.id.my_toolbar); setsupportactionbar(toolbar); getsupportactionbar().setdisplayhomeasupenabled(true); toolbar.setnavigationonclicklistener(new view.onclicklistener() { @override publ...

c++ - Getting started with nrf51882a -

i'm trying start nordic development kits, installed tools required able start development & files have following: drivers' codes ?& header files contain functions. some examples using of these drivers the main problem faced can't understand drivers code or can't use functions, don't know can illustration or step step examples using drivers, know that's difficult find that, i'd know how use these drivers or external drivers available or how deal these codes the nordic team have done nice job in creating needed developers started. in general, there 3 places find information need:- the nrf51x sdk : software development kit includes drivers, libraries, , importantly numerous examples on using drivers. examples demonstrate how different components can used. the nrf51 infocenter : infocentre nordic's web library chipsets , specifications. have @ softdevice api , message sequence charts. the nordic devzone: equivalent stackov...

css - How to make Google Chrome and iOS remember scroll position in div after returning back? -

the problem scroll container div , not body . , causes google chrome , ios fail remember scroll position of div after users go page , return back. the related css code follows. scroll container #container . * { margin: 0; padding: 0; } html { height: 100%; } body { height: 100%; overflow: hidden; } #container { height: 100%; overflow: auto; } and here demo on jsfiddle. please reproduce issue on google chrome , ios scrolling content 50% (or other noticeable length), click on hyperlink go nother page, , click browser's button. is there uncomplicated way make google chrome , ios remember scroll position firefox does? == edit in response answer == a simple .html file test if code in onbeforeunload works. <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <script> window.onbeforeunload = function () { alert('are sure'); ...

xcode - Fix iOS ipa file (missing code-signing certificate) -

i'm able compile , deploy ipad app ipad device no problems. when use apple's application loader program submit ipa itunes connect, error: invalid provisioning profile , missing code-signing certificate . is there way xcode or command-line tool "fix" ipa, or re-sign provisioning profile? ipa generated 3rd-party app (not apple), , result ipa file. any ideas? there number of blogs , articles describe re-codesigning of apps sometimes apple's app loader complaining mismatch of entitlements inside profile - make sure correct well. i highly recommend article objc.io http://www.objc.io/issues/17-security/inside-code-signing/ looks folks have built gui's doing same thing. http://dev.mlsdigital.net/posts/how-to-resign-an-ios-app-from-external-developers/

parse.com .Net sdk works on windows 7? -

i'm trying understand parse.com, can't find documentation or support topic. i'm not sure if app make work on windows 7, because whenever try open solution on vs, says need windows 8.1 windows 8 exclusive? or there way run parse.com app on windows 7. any appreciated. according http://blog.parse.com/announcements/got-net-parse-now-supports-net-4-5/ parse works on windows 7: today, we’re excited introduce support .net 4.5 our windows sdk, making easy target wide range of platforms including windows 7 , windows server.

javascript - jQuery Finds Elements Position Before Repositioned in CSS -

i trying repositioned elements animate when page scrolls down , become visible. problem jquery using first (before being positioned) position trigger animation, element higher on page when scroll, see element , continue scrolling little animation triggered. how can make jquery find re-positioned position , use animate instead of position before element positioned? here code. $(document).ready(function() { (function($) { /** * copyright 2012, digital fusion * licensed under mit license. * http://teamdf.com/jquery-plugins/license/ * * @author sam sehnert * @desc small plugin checks whether elements within * user visible viewport of web browser. * accounts vertical position, not horizontal. */ $.fn.visible = function(partial) { var $t = $(this), $w = $(window), viewtop = $w.scrolltop(), viewbottom = viewtop + $w.height(), _top = $t.offset().top, ...

Php Scandir to Mysql Which is Good Practice? -

i have file structure below. ali --543 --01.jpg --02.jpg --544 --545 veli --002 like have 50 main folder , every main folder has 500 chapter folder. every chapter folder has 30 images in it. gonna save image paths , folder names mysql. , saved data pull out json data using wtih angularjs. method keep server less busy? table a: every image path takes 1 cell. name folder path ali 787 01.jpg ali 787 02.jpg ali 787 03.jpg ali 787 04.jpg . . . . . . . . . ali 788 01.jpg . . . . . . veli 332 01.jpg veli 332 02.jpg veli 332 03.jpg so have thousands of images dont think above method not practice. table b: table in every chapter folder's images take 1 cell. said not practice. 1 should prefer? or other suggusti...

php - How to make nginx rewrite rules work? -

i want add rewrite rules this. location / { autoindex on; root /users/guest/projects/demo/public; index index.php index.html index.htm; location ~* ^/signin { rewrite ^/signin(.*)$ /account/page/signin$1 break; } if (!-e $request_filename) { rewrite ^/(.*) /index.php?$1 last; } } i want works these steps long type url " http://host/signin ". step 1 : rewrite url " http://host/account/page/signin " step 2 : rewrite rule "rewrite ^/(.*) /index.php?$1 last;" but now, step 1 working, seems rule stop @ there. i tried different way do, such as if (!-e $request_filename) { rewrite ^/signin(.*)$ /account/page/signin$1; rewrite ^/(.*) /index.php?$1 last; } or rewrite ^/signin(.*)$ /account/page/signin$1; if (!-e $request_filename) { rewrite ^/(.*) /index.php?$1 last; } sometimes can error log : open() "/users/guest/projects/demo/public/account/page/signin...

jquery - If.... Else If.... statement is not giving any Output in javascript -

if.... else if.... not giving output in javascript acctually matching navigation.useragent string of javascript predefined strings using if.... else if..... statement script long 1.76 mb script contains jquery javascript codes @ time of execution didn't output if condition true defined in if.... else if.... statement code block. please suggest simple , working solution must appreciated. edit 01 the script attached index.html <script> tag's src attribute. the actual code block large small code snippet of script code beyond similar one. $(function(){ var winurl = $("body").attr("winredirection"); var androidurl = $("body").attr("androidredirection"); var moburl = $("body").attr("mobredirection"); var bburl = $("body").attr("bbredirection"); if (navigator.useragent=="mozilla/5.0 (compatible; u; abrowse 0.6;syllable) applewebkit/420+ (khtml, gecko)") { wi...

matlab - How can I change uipanel dimensions by using user input? -

i'm trying change panel , axes width , height values using user input. these values represent photograph's resolution. example, if user inputs 512*512 , uipanel , axes ' width , height change 512 , user work on workspace. what tried far: prompt = {'enter width', 'enter height'}; dlg_title = 'input'; num_lines = 1; def = {'256','256'}; answer = inputdlg(prompt,dlg_title,num_lines,def); uipanel1.width = str2num(answer{1}); uipanel1.height = str2num(answer{2}); but size of uipanel1 not change. here's code demonstrates how want can done, works matlab-hg2 (default matlab 2014b , onward). %% //create figure uipanel & axes hfig = figure('units','pixels'); %// create new figure hfig.position = [100 100 600 600]; %// adjust figure's position hpan = uipanel(hfig,'units','pixels'); %// create new panel hpan.position = [150 150 300 300]; %// adjust panel's p...

ios - accessing variables created in the override func viewDidLoad() { super.viewDidLoad() function outside that function in swift -

import uikit class secondviewcontroller: uiviewcontroller { @iboutlet weak var labela: uilabel! @iboutlet weak var labelb: uilabel! var datapassed:string! var seconddatapassed:string! var newvar: string! var newvar2: string! override func viewdidload() { super.viewdidload() labela.text = datapassed labelb.text = seconddatapassed newvar = labela.text println(newvar) } println(newvar) *** can't access newvar outside override func viewdidload() { - gives "expected declaration" driving me crazy!!!*** override func didreceivememorywarning() { super.didreceivememorywarning() // dispose of resources can recreated. } } is there data in datapassed? if don't assign string datapassed variable, , assign newvar datapassed, newvar have nothing print. try: import uikit class secondviewcontroller: uiviewcontroller { @iboutlet weak var labela: uilabel...

javascript - How and When can I use &lt or &gt? -

i'm new javascript, , learned &lt , &gt . don't how use them or how in javascript. can give me example? , better use < or > ? &lt; , &gt; html representations of < , > characters. should use them when creating html want these characters appear. otherwise, interpreted syntactic elements html engine.

html - Deciphering Websites Code -

as part of education, reading code following website, , trying figure out how fits together. http://p.w3layouts.com/demos/resume_pages/web/ my question; upon inspection of '.logo h1 a' (the word 'resume' in top left corner) see floated left, 0 margin , no additional positioning. why then, element not sit 'flush' left-hand margin of page? instructing element position in way has? the '.logo h1 a' sitting inside of div tag class of 'header_style1'. 'header_style1' sitting inside of div tag class 'wrap'. if @ css code '.wrap'. see set have width of 80% , centered page. since '.logo h1 a' sitting inside of '.wrap' tag, being loaded left of tag.

Javascript performance when making chess board -

i use html table draw chess board(8x8), generate yellow cell appear randomly in chess board. code: $('#random').click(function(){ (i=0; i<100; i++){ setinterval(function(){ resetboard(); // re-draw chess board without yellow cell var index = math.floor((math.random() * 64)); $('.chess-board tr td').eq(index).css('background-color', 'yellow'); }, 150); } }); the appearence of yellow cell doesn't stop. , code make browser compute (i saw in task manager firefox use 32% cpu while run this). problem in this, thank bro ? you keep initializing sequence of new repetitive timers in loop timer functions triggered in row small delay between each of them (no, please). thus, event loop should massively busy this: time lapse t0 ........... interval#1 first runs t0+1 ...

underscore.js - Limit underscorejs group by length -

Image
i have long list of articles grouped category, how can limit each category have 4 (or other number) items? my input is: and want 4 articles on each section map object values sliced versions of themselves: _.mapobject(groupedarticles, function(group) { return group.slice(0, 4); })

java - How can I convert these streamed Map keys from Longs to Objects? -

i've current got method looks like: public map<long, list<referraldetailsdto>> getwaiting() { return referraldao.findall() .stream() .map(referraldetailsdto::new) .collect(collectors.groupingby(referraldetailsdto::getlocationid, collectors.tolist())); } } it returns me map of location ids referraldetailsdto objects. however, i'd swap out location id locationdto object. i'd have naively imagined might work: public map<long, list<referraldetailsdto>> getwaiting() { return referraldao.findall() .stream() .map(referraldetailsdto::new) .collect(collectors.groupingby(locationdao.findbyid(referraldetailsdto::getlocationid), collectors.tolist())); } obviously, i'm here because doesn't - java complains findbyid method expecting long value, not method reference. suggestions how can neatly address this? in advance. first of all, cha...

javascript - FullCalendar event directing to wrong url -

so have set fullcalendar site. used this tutorial . everything works fine except urls add events on calendar. when i've added url event should direct me url when press on event. for example, when add www.eventurl.com event doesn't direct me it, directs me www.mysiteurl.com/www.eventurl.com . when inspect element browser can see there href="www.eventurl.com" . looks should use url, when press on event goes www.mysiteurl.com/www.eventurl.com . i thankful if know how fix this. thanks! i figured out. when javascript promt() asks me url attach event didn't add 'http://' in front of it. when did that, worked!

Java reflection - get field value -

i try make class generate new classname.java file using reflection. have problem fields value. here test class. public class classtest { @deprecated private int a; public int[] b; private final string c = "hi"; ... } method in try generate fields. private void writeattributes(class<?> cls, printwriter writer){ field[] atr = cls.getdeclaredfields(); (field field : atr) { this.writeannotations(writer, field.getdeclaredannotations()); writer.write(modifier.tostring(field.getmodifiers())+" " + field.gettype().gettypename()+ " " + field.getname()); try{ system.out.println(field); // null pointer exception there object value = field.get(null); if(value!= null){ writer.write(" = " + value.tostring()); } }catch(illegalaccessexception ex){ } writer.write(";"); this.writenewline(writer)...

filtering - Spreadsheet and address: how to filter based on a range -

Image
i have spreadsheet thousands of entries. need extract data based on content of spreadsheet. the file looks this: id location address ------ ------ ------------ 000001 london oxford st. 000002 london ladbroke sq. 000003 london beryl rd. ... ... ... on second sheet have list of address. need filter content of first sheet based on address listed. i thought arrayformula the work i'm stuck this: =arrayformula(sum(((sample!$a:$a)=$a2) * ((sample!$b:$b)=b$1) * (sample!$c:$c) )) if data on first sheet looked this: one option index(match()) on second sheet: another option - creating separate column filtering in first sheet: too bad conditional formatting formulas not work when take references sheet.

Parsing my string to int is causing ValueError in python -

for reason int(str) causing error. can't work out why. i'm wondering if can tell me why. cx4_list_reduce = ['[#1]',(1,3,5),(7,6,9)] list2= ['[#2]',(2,5,4), (1,3,5), (5,8,1), (7,2,6)] n2 =3 process_tuple in cx4_list_reduce: d_num = "" if process_tuple == list2[0]: d_num = process_tuple[2:3] n1 = int(d_num) if n1 <= n2: print('n1 =< n2') continue else: print('n1 => n2') error: invalid literal int() base 10: '' look closely @ condition: d_num = "" if process_tuple == list2[0]: d_num = process_tuple[2:3] so should happen when if test false (when value not equal list2[0] ? d_num remains empty string , cannot convert integer. the error message tells that; invalid literal int() base 10: '' tells empty string cannot converted. your first value in cx4_list_reduce list '[#1]' , , string not equal...

.net - ListBox with Button in ItemTemplate should do Select on ButtonClick also -

i have listbox itemtemplate. in itemtemplate have button , textblock. <window x:class="listboxitemwithtogglebutton.mainwindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" title="mainwindow" height="350" width="525"> <grid> <listbox itemssource="{binding listitems}"> <listbox.itemtemplate> <datatemplate> <stackpanel orientation="horizontal"> <button width="16" height="16" content="c" padding="0" margin="0,0,5,0"></button> <textblock text="{binding path=name}"></textblock> </stackpanel> </datatemplate> </listbox.itemtemplate> </listbox> </grid> if...

symfony - Twig: Allow HTML, but escape script -

i investigating possible xss attack vector application. what have: formtype single textarea field. field can contain html tags. twig template renders data inserted. i use form insert following content: <b>some valid html text</b> <script type="text/javascript">alert("xss")</script> viewing data require escaping. familiar few strategies when comes escaping data. 1) raw filter: disables escaping -> introduces possible xss 2) e filter: html flavor outputs: <b>some valid html text</b> <script type="text/javascript">alert("xss")</script> js flavor outputs: \x3cb\x3esome\x20valid\x20html\x20text\x3c\x2fb\x3e\x0d\x0a\x3cscript\x20type\x3d\x22text\x2fjavascript\x22\x3ealert\x28\x22xss\x22\x29\x3c\x2fscript\x3e 3) {{ var|striptags('<br>')|raw }} , outputs: some valid html text alert("xss") this 1 works, somehow don't it. rather looking bla...

html - Difference between adding <![CDATA[ in page source v/s dynamically using javascript -

is there difference between -- <![cdata[ // content of javascript goes here ]]> adding part of html response server v/s adding dynamically after page load using javascript (lets $('body').append(/ cdata_goes_here /)) main question here whether cdata needs available part of page source or not? leaving aside general issues adding content using js, cdata doesn't make difference. it renders in xhtml document , gets parsed comment in html document .

java - JPanel which layout -

Image
say have frame , want create 6 panels in so: which layout best? tried this: public static void main ( string[] args ) { jframe frame = new jframe("testing"); frame.setdefaultcloseoperation(jframe.exit_on_close); frame.setpreferredsize(new dimension(800,600)); frame.setlayout(new flowlayout(flowlayout.left)); jpanel lefttop = new jpanel(); lefttop.setpreferredsize(new dimension(251,300)); lefttop.setbackground(color.black); frame.getcontentpane().add(lefttop); jpanel middletop = new jpanel(); middletop.setpreferredsize(new dimension(251,300)); middletop.setbackground(color.white); frame.getcontentpane().add(middletop); jpanel righttop = new jpanel(); righttop.setpreferredsize(new dimension(251,300)); righttop.setbackground(color.red); frame.getcontentpane().add(righttop); jpanel leftbottom = new jpanel(); leftbottom.setpref...

python - Tkinter Password System -

i'm new using tkinter in python , i'm wondering if can me password system. i'm struggling when comes checking user entered username actual username, i'm not bothered password part @ point once have got username part working should easy enough adjust code username section. anyway here code: #toms password system import tkinter tkinter import * tkinter import ttk username = ("tom") password = ("") usernameguess1 = ("") passwordguess1 = ("") #ignore file writing part,i'll sort out later. file = open("userlogondata.txt", "w") file.write("user data:\n") file = open("userlogondata.txt", "r") def trylogin(): print ("trying login...") if usernameguess == username: print ("complete sucsessfull!") messagebox.showinfo("-- complete --", "you have logged in.",icon="info") else: print ("e...

Partial Response received from Apigee -

the flow sap nwas 7/java ---> apigee on premise--->apigee oncloud -----> backend. , back. backend posting response of appx 17 mb back. have streaming enabled both on cloud , on premise apigee. sap nwas client states partial response received . when invoke postman however, getting complete response. please suggest problem can be? since postman works fine you, seems might problem on client side. so, it's possible client requires more info on response in order able display content e.g. content-type header. way troubleshoot issue send curl command resource in apigee , store in filesystem validate not postman can parse response. e.g. curl http://yourresourcehere/images/12344 > img12344.png

python - BaseHTTPRequestHandler parse_request() never returns -

i'm totally new python , trying create sublime plugin needs websocket server. found this , tried port python 3 (originally written in 2?) , run problem following code: class httprequest(http.server.basehttprequesthandler): def __init__(self, request_text): self.rfile = stringio(request_text) self.raw_requestline = self.rfile.readline() self.error_code = self.error_message = none print('before') self.parse_request() print('after') # never reached! taken here . the parse_reqeust() method never returns. 'after' never printed. point me in right direction how debug things in python? (the technique above seems come this post )

c - Please explain the code? -

int main() { int n, k, i, j, k, x, final, cur, a[22]; for(i=!!scanf("%d %d",&n,&k), printf("%d\n",(final=n*n)-n);i<=n;a[i++]=i); for(i=(cur=n)-1; i>=1; i--) for(j=1; j<=i; printf("%d %d min\n%d %d max\n",a[j],a[j+1],a[j],a[j+1]),a[j]=++cur, a[j+1]=++cur, j++); for(printf("%d",final-1+(cur=final)*0+(x=2)*0); cur>n; printf(" %d",cur), cur-=x, x+=2); return 0; } please explain use of 2 exclamation marks in first "for" statement. i explain first loops, last 3 loops easy understand. step step explanation. step 1: for(i=!!scanf("%d %d",&n,&k), printf("%d\n",(final=n*n)-n);i<=n;a[i++]=i); here, scanf("%d %d",&n,&k) returns 2 (number of integer read successfully.) step 2: single negation, !2 = 0 , negate 0, !0 = 1 . so, i = !!2 = 1 step 3: suppose input 3 5 [n=3, k=5]. output of printf("%d\n",(final=n*n)-n) f...

Python: Eval with undefined variables (2*x+x = 3*x) -

i'm looking way, calculate strings, might include variables. eval won't job, want use undefined variables. i'm talking function, turn "2*3*x" "6*x" example. is there function that? you use sympy symbolic computation: in [126]: import sympy sy in [127]: sy.simplify('2*x+x') out[127]: 3*x to convert rationals floats, use sy.nfloat : in [170]: sy.nfloat(sy.simplify('2*3+x+3/4')) out[170]: x + 6.75

scikit learn - Affinity Propagation (sklearn) - strange behavior -

trying use affinity propagation simple clustering task: from sklearn.cluster import affinitypropagation c = [[0], [0], [0], [0], [0], [0], [0], [0]] af = affinitypropagation (affinity = 'euclidean').fit (c) print (af.labels_) i strange result: [0 1 0 1 2 1 1 0] i expect have samples in same cluster, in case: c = [[0], [0], [0]] af = affinitypropagation (affinity = 'euclidean').fit (c) print (af.labels_) which indeed puts samples in same cluster: [0 0 0] what missing? thanks i believe because problem ill-posed (you pass lots of same point algorithm trying find similarity between different points). affinitypropagation doing matrix math under hood, , similarity matrix (which zeros) nastily degenerate. in order not error out, implementation adds small random matrix similarity matrix, preventing algorithm quitting when encounters 2 of same point.

android - Using AsyncTask to load more than two images in daimajia-AndroidImageSlider with jsonData -

i'm using https://github.com/daimajia/androidimageslider slider three images .and here i've tried in asynctask load 3 image json data : public class asynchttptask extends asynctask<string, void, integer> { public progressdialog pdialog; @override protected void onpreexecute() { super.onpreexecute(); pdialog = new progressdialog(mainactivity.this); pdialog.setindeterminate(false); pdialog.setmessage("loading, please wait..."); pdialog.setcancelable(true); pdialog.show(); } @override protected integer doinbackground(string... params) { integer result = 0; httpurlconnection urlconnection; try { /* forming th java.net.url object */ url url = new url(params[0]); urlconnection = (httpurlconnection) url.openconnection(); /* request */ ...