Posts

javascript - IFrame get parameters from parent url on different domain -

it seems not possible default because error blocked frame origin x accessing frame origin y. know because of security allow partners integrate iframe. iframe on domain mysubdomain.mysite.com , contains search box. once user has made search has been redirected page partners-domain-containing-search-results.com search results on domain mysubdomain.mysite.com , read parameters url (hash , query string parameters) can't because can't read parent url parameters (from partners-domain-containing-search-results.com ). you should able use top.location subdomain.mysite.com read parent urls of partners-domain-containing-search-results.com: e.g. iframe hosted on mysubdomain.mysite.com , embedded in partners-domain-containing-search-results.com?hello=true#blabla should able run: top.location.hash >"#blabla" top.location.search >"?hello=true" note: cannot modify other domain's location object or see: uncaught securityerror: blocked fram...

memory - How can I write code to purposefully eat up RAM and CPU resources? -

i have written code in ruby , c before has accomplished similar purposes, think situation bit trickier now. said, need purposefully write code ties resources on machine, , measure , when these events happen. are there libraries/modules out there this, , if not, best way accomplish this? should flood processor huge numbers , make try find primes? should shoot tons of packets 1 of machines , wait till crashes? i have spent past 2 days writing code accomplish various tasks related this, i'm dissatisfied because when accomplish task, can't real data out on where, why, , when these events happening. suggestions appreciated. please consider using stress utility in linux. i'm assuming linux system. either way, "stress" allows target subsystem of choice , load accordingly.

python - Concatenating strings containing many quotations results in slashes in output -

i trying build string needs contain specific double , single quotation characters executing sql expression. i need output formatted this: " "full_stree" = 'allendale rd' " where value of allendale rd variable defined through loop. in following code sample, variable tos trying pass query variable. tos = "allendale rd" query = '" "full_stree" = ' + "'" + tos + "' " + '"' and when print value of query variable output: '" "full_stree" = \'allendale rd\' "' the slashes causing query fail. tried using modulus operator pass value of tos variable, same results: where = '" "full_stree" = \'%s\' "' % (tos) print '" "full_stree" = \'allendale rd\' "' how can string concatenated correct format, leaving slashes out of expression? what seeing repr of string. ...

c# - Issue with ScriptCam in MVC4 -

im trying use scriptcam https://www.scriptcam.com/demo_5.cfm mvc4 project. have downloaded files required , followed instructions on site. when go run application issue in google debugger (shown below)- http://localhost:9171/qr/webcamlogo.png 404 (not found) qr:145 uncaught typeerror: undefined not function qr:194 http://localhost:9171/qr/webcamlogo.png 404 (not found) swfobject.js:4 http://localhost:9171/qr/scriptcam.swf 404 (not found) now i've tried figure out how change path location of swf.file javascript experience week old. below view file...the rest of javascript files can got link provided above. qr.cshtml @{ viewbag.title = "webcam"; } <script language="javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> <script language="javascript" src="//ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js"></script> <script la...

ruby on rails - Factory girl conflict between field names with association -

for legacy reasons, have model in rails 2 fields: city , city_id . city string city name. city_id reference city object. how should declare factory factory_girl? i populate both city_id , city this: factory :address street "street x" city #uses city factory city "mycity" #uses legacy city end but not possible. how differentiate between these 2 city fields? as per the docs , can use implicit association when you're following normal conventions. case need use explicit call association method. in example below, replace :replace_this whatever belongs_to association in model called: factory :address street "street x" association :replace_this, factory: :city #uses city factory city "mycity" #uses legacy city end

jquery - Multiple issues with pushstate: history, loading, calling functions -

i have script pulling data via ajax/pushstate; works relatively well, there issues i'm running into. first , foremost, here code i'm using: function goto(href) { $.ajax({ url: href, success: function(data) { $('#wrapper').fadeout('fast', function(){ $(this).html(data).fadeto('fast', 1); $(".scroll").nicescroll({cursorcolor:"#f33d39", cursorwidth: "10px", cursorborder: "none", cursorborderradius: "0px", fixed: true}); }); // update page title var title = $('#page-right').find('h1').text(); $('head').find('title').text(title); } }); } if (typeof history.pushstate !== "undefined") { var historycount = 0; $('a[href*="rage.rage-wrestling.com"]').live('click',function(){ var href = $(this).attr('h...

numpy - create a feature vector using pandas or python -

i have binary classifier takes 200 element input feature vector shown below [ id, v1, v2, ...,v190, v200, class] [ 7, 0, 0, ..., 0, 0, 0 ], [ 8, 0, 1, ..., 0, 0, 1 ], [ 9, 0, 0, ..., 0, 0, 1 ], for each element x may have set of attributes in v1-v200 sql = 'select x_id, x_attr elements x_hash = %s' cur.execute(sql, (x_hash,)) x1 = cur.fetchone() x1 # x1 returns id , list of attributes (123, [v2,v56,v200]) given output want create feature vector such 1 above, if attribute in list matches attribute in set v1- v200 set 1. [ id, v1, v2,...,v56,...,v190, v200, class ], [ 123, 0, 1,...,1,..., 0, 1, ? ], how can in pandas or python? first initializing pandas dataframe , building on example: df = pd.dataframe(none, columns=['v'+str(i) in range(1,201)]) sql = 'select x_id, x_attr elements x_hash = %s' cur.execute(sql, (x_hash,)) x1_id, features = ...