Posts

Showing posts from July, 2014

javascript - Stop passing by reference in closures -

this question has answer here: how javascript closures work? 88 answers i have code looks this: var = []; for(var = 0; < 10; i++) { a[i] = function() { console.log(i); } } unfortunately, seems i being passed reference, functions in a output 10. how make each function outputs value i had when created? i.e. a[0]() gives 0, a[1]() gives 1, etc. edit : clarify, not want a store values 0-9. want a store functions return values 0-9. you need invoke function (to create closure captures value) returns function (the 1 want end with). this: var = []; (var = 0; < 10; i++) { a[i] = (function(value) { return function() { console.log(value); } })(i); }

php - Adding dynamic rows in html with javascript -

Image
i experimenting following .js code adds form field dynamically page me : var i=$('table tr').length; $(".addmore").on('click',function(){ addnewrow(); }); $(".addmany").on('click',function(){ addnewrow(); addnewrow(); }); $(document).on('keypress', ".addnewrow", function(e){ var keycode = e.which ? e.which : e.keycode; if(keycode == 9 ) addnewrow(); }); var addnewrow = function(){ html = '<tr>'; html += '<td><input class="case" id="caseno_'+i+'" type="checkbox"/></td>'; html += '<td><input type="text" data-type="productcode" name="data[invoicedetail]['+i+'][product_id]" id="itemno_'+i+'" class="form-control autocomplete_txt" autocomplete="off"></td>'; html += '<td><input type="text"...

java - Modifying or adding new tags to a jpg (Metadata) with iim4j -

i trying modify or add new tags iim4j library, documentation poor. i've been searching examples on internet , didn't found far. got examples library offers. there's 1 example reading metadata , can title, description , tags of image (the ones care). know library manage these info dataset , datasetinfo tried create new instances of these objects info want add have no results far. this code reading iptc section of jpeg file: public static void dump(file file) throws exception { system.out.println("iptc segment " + file); iimfile iimfile = new iimfile(); iimreader reader = new iimreader(new jpegiiminputstream(new fileiiminputstream(file)), new iimdatasetinfofactory()); iimfile.readfrom(reader, 20); (iterator = iimfile.getdatasets().iterator(); i.hasnext();) { dataset ds = (dataset) i.next(); object value = ds.getvalue(); if (value instanceof byte[]) { value = "<bytes " + (...

python 2.7 - Django Model __unicode__ raising exception when logging -

i have model class looks following: class address(models.model): # taking length of address/city fields existing userprofile model address_1 = models.charfield(max_length=128, blank=false, null=false) address_2 = models.charfield(max_length=128, blank=true, null=true) address_3 = models.charfield(max_length=128, blank=true, null=true) unit = models.charfield(max_length=10, blank=true, null=true) city = models.charfield(max_length=128, blank=false, null=false) state_or_province = models.foreignkey(stateorprovince) postal_code = models.charfield(max_length=20, blank=false, ...

C++ Check if Windows 10 -

i making app os specific can't seem narrow down windows 10, comes windows 8. have tested on window 10 pro , outcome major: 6 min:2. there way check if it's windows 10 more efficiently? edit: found working api rtlgetversion() works os's properly! #include "windows.h" #include <iostream> using namespace std; bool equalsmajorversion(dword majorversion) { osversioninfoex osversioninfo; ::zeromemory(&osversioninfo, sizeof(osversioninfoex)); osversioninfo.dwosversioninfosize = sizeof(osversioninfoex); osversioninfo.dwmajorversion = majorversion; ulonglong maskcondition = ::versetconditionmask(0, ver_majorversion, ver_equal); return ::verifyversioninfo(&osversioninfo, ver_majorversion, maskcondition); } bool equalsminorversion(dword minorversion) { osversioninfoex osversioninfo; ::zeromemory(&osversioninfo, sizeof(osversioninfoex)); osversioninfo.dwosversioninfosize = sizeof(osversioninfoex); osversioninfo.dwminorversion = minorversion; ulonglon...

python - Appending rows to csv using dict_writer -

i appending rows existing csv file following code: counter=1 thepage in newpages: web_page = urllib2.urlopen(thepage) soup = beautifulsoup(web_page.read()) fieldnames=["var1", "var2","var3","var4","var5", "var6", "var7"] if counter==1: f = open('file.csv', 'wb') my_writer = csv.dictwriter(f, fieldnames) my_writer.writeheader() f.close() variables={ele:"missing" ele in fieldnames} variables['var1']=str(counter) variables['var2']=soup.find_all('strong')[0].text variables['var3']=soup.find_all('p')[1].text[0] variables['var4']=soup.find_all('p')[1].text[1] variables['var4']=soup.find_all('p')[2].text variables['var6']=soup.find_all('p')[6].text variables['var7']=soup.find_all('p')[7]....

encode - Node.js convert Chinese character to \uXXXX -

i want convert string '字符串' '\u5b57\u7b26\u4e32', how implement in node.js? function convert(str) { //... } var s = '字符串' convert(s); // => \u5b57\u7b26\u4e32 this can done in better way (and mentioned jsesc safer choice): function convert(s) { return s.split('').map(function(c) { return '\\u' + ('0000' + c.charcodeat(0).tostring(16).touppercase()).slice(-4); }).join(''); } var s = '字符串'; convert(s)

java - GLFW No monitors found in LWJGL 3 application -

so problem came day ago in program i'd been working on quite while now. of sudden glfw failed initialize every single time launched it. after further investigation (adding error callback) found glfw can't find monitors , fails @ further calls. code never changed, decided not work. i've updated drivers , everything, nothing working. launched old c++ program using glfw , worked fine, lwjgl fails. not hello, world! app on lwjgl's website works. i'm not uploading code since can refer lwjgl hello, world! app. edit: downloaded , earlier version of lwjgl , worked, use newest version.

javascript - Hover over an element underneath another element -

Image
i'm creating basketball shot chart visualization support area brushing (see grey box) individual point interaction (by hovering on points). using d3.js achieve this. however, brush canvas element above hexagon elements, , cannot interact elements behind, although visible. i wondering if possible have mouseover event on hexagons despite them being in background. keep in mind click , drag events apply top level canvas element. thank help. edit: clarify, making top layer invisible clicks not work still need click , drag events register on brush canvas. need mouseover option hexagons, lying underneath. if talking 2 superposed dom elements yes, it's possible. can't tell out of structure of html because it's not there keep in mind event bubble through parents if element not in being moused over. $('#container').on('mouseover', function(){ $('#results1').html('inside green square'); $('#results3').html('...

java - Caught a RuntimeException from the binder stub implementation when swap data in arrayadapter -

public class mainactivity extends appcompatactivity { arraylist<string> list = new arraylist<>(); arrayadapter<string> adapter; arraylist<string> data1 = new arraylist<>(); arraylist<string> data2 = new arraylist<>(); @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); (int = 0 ; i< 10 ;i++){ data1.add(string.valueof(i)); } (int = 20; < 30; i++){ data2.add(string.valueof(i)); } spinner spinner = (spinner) findviewbyid(r.id.demo); adapter = new arrayadapter<>(this,android.r.layout.simple_dropdown_item_1line,list); spinner.setadapter(adapter); } private void change(boolean which){ if (which){ list.clear(); list.addall(data1); }else{ list.clear(); list.addall(data2); } adapter.notifydatasetchanged(); } @override publ...

logback - Spring Boot application log level -

Image
i want change log level of spring boot application running. is possible change log level @ runtime? right have logger configuration in jar itself. changing log level while application running part of underlying logger implementation. you did not specify logger implementation using assume using default logback provided via spring-boot-starter-logging or spring-boot-starter-web dependencies. comment out logger related configurations application.properties e.g. #logging.path=logs #logging.level.org.springframework.web= info #logging.level.=info add logback.xml in root of classpath tag see http://logback.qos.ch/manual/jmxconfig.html start application , open jconsole , go mbeans tab. select package ch.qos.logback.classic.jmxconfigurator.under default locate setloggerlevel operation e.g. org.springframework.web, debug the change effective immediately. other logger libraries see spring boot ...

php - How to compare textbox value with table cell value -

i have table displays values of product name , available stock retrieving database. want insert quantity manually. the code contains php incremental id's table row, available stock cell , quantity textbox, such last_<?php echo $id; ?> stock , quanti_<?php echo $id; ?> quantity. i want compare these 2 values such quantity value must less or equal stock value.onclick of generate bill button again want validate not submit form if quantity greater stock. $(".edit_td1").click(function() { var id=$(this).attr('id'); //alert(id); //$('#quanti_'+id).blur(function(){ $('.cls_quant').blur(function(){ //var id=$(this).attr('id'); //var qt=$('#quanti_'+id).val(); var qt=$(this).val(); var stk=$('#last_'+id).html(); console.log("quanty"+qt); console.log("stock"+stk); if (qt>stk) { console.log(...

javascript - Submit button not sending anything -

i'm trying use custom-built submit button made website design i'm using , don't know how make submit button send post request forms on page. far thing button make "thank you!" show on webpage. here code: //signup form. (function() { // vars. var $form = document.queryselectorall('#signup-form')[0], $submit = document.queryselectorall('#signup-form input[type="submit"]')[0], $message; // bail if addeventlistener isn't supported. if (!('addeventlistener' in $form)) return; // message. $message = document.createelement('span'); $message.classlist.add('message'); $form.appendchild($message); $message._show = function(type, text) { $message.innerhtml = text; $message.classlist.add(type); $message.classlis...

riemann - Need help in optimising clojure statement -

i'm new clojure , need set riemann config easy edit/add new conditions. have now: (defn tell-ops ([to] (by [:service] (throttle 3 360 (rollup 2 360 slackerdefault (email to))))) ([to channel] (by [:service] (throttle 3 360 (rollup 2 360 (slacker channel) (email to)))))) ............ (where (state "fatal") (where (service #"^serv1") (tell-ops "dev.ops1@foo.com" "#dev-ops1")) (where (service #"^serv2") (tell-ops "dev.ops2@bar.com")) .... ) moreover, lacks default statement, if nothing matches, tell-ops "admin@fo.bar" i think need top level struct (def services [{:regex #"^serv1" :mail "foo@bar.com" :channel "#serv1"} {:regex #"serv2$" :mail "foo@baz.com"} ]) so easy add new ones. have no ...

c# - update the database from package manager console in code first environment -

code first environment i'm trying update database package manager console.if domain class change, have drop , create database,instead of dropping database how can update database. i have try reading blogs in google. commands pm> install-package entityframework by using command install entity framework successfully. pm> enable-migrations by using command created migration file in project. pm> update-database by using command , may update table have problem here . error specify '-verbose' flag view sql statements being applied target database. system.data.sqlclient.sqlexception (0x80131904): network-related or instance-specific error occurred while establishing connection sql server. server not found or not accessible. verify instance name correct , sql server configured allow remote connections. doubt here sometimes may update if 1 field changes in poco class. example have updated more number of domain class ,how can update d...

Efficient way to structure falcor router for deep paths? -

i'm continuing experiments falcor , enjoying of it, i'm noticing concerning. i'm assembling jsongraph multiple disparate apis, falcor-router intended do. can't seem find way cleanly provide catch-all fields don't need special handling w/o blowing routes do need special handling. my routes following: items[{integers:ids}].name items[{integers:ids}][{keys:fields}] no matter order declare routes in generic 1 wins. there better way avoid full-nuclear option of structuring routes this? items[{integers:ids}].name items[{integers:ids}]['fooga', 'wooga', 'booga', 'tooga', ... ] that seems brittle, if data coming backing server changes have update not application code router well. becomes real mess if have nested objects number of permutations climb in hurry. i believe bug. router should match specific path first. appreciate if log issue. fix you.

html - Jquery mobile, Footer does not move down with <data-position="fixed"> -

i tried put footer down seems not work code provided below. deleted standard text in css file ensure there no connection problem.. should move down <div data-role="footer" data-position="fixed"> <h5>test</h5> </div> right? this complete code of index.html <!doctype html> <html> <head> <meta charset="utf-8" /> <meta name="format-detection" content="telephone=no" /> <!-- warning: ios 7, remove width=device-width , height=device-height attributes. see https://issues.apache.org/jira/browse/cb-4323 --> <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi" /> <link rel="stylesheet" type="text/css" href="css/index.css" /> <link...

javascript - Add properties to context in cordova plugin for Application Insights -

i use cordova plugin application insight named cordova-plugin-ms-appinsights ( https://github.com/msopentech/cordova-plugin-ms-appinsights/blob/master/readme.md ) , tried add properties context, through each request application send additional info, example code name of application. i tried below: appinsights.context.application.codename = "code name app"; appinsights.trackevent("my event"); and did not work. can add additional info context? there 2 issues: 1) cordova plugin seems use old version of js sdk. can try update manually after pulls down old 1 (take recent 1 https://github.com/microsoft/applicationinsights-js/blob/master/dist/ai.0.js ) 2) feature adds data all telemetry items not released yet. implemented - see js sdk commit on github . can either wait bit until it's released or latest master , compile (and take result /javascript/min/ai.min.js) a hacky alternative may create wrapper on top of sdk methods trackevent() adds da...

angularjs - Javascript null checking not working as expected -

i'm using angularjs framework , connect webservice fetch json data. have following code: $login.onlinelogin($scope.credentials). success(function (data, status, headers, config) { if (data !== null ) { console.log('successful login!'); console.log('returned data: ' + data); } else { console.log('failed login...'); } }). error(function (data, status, headers, config) { console.log('http error...'); }); now, when http call comes status still 200:ok object returns null, in case user provided wrong user credentials example. i'm expecting happen in case if object not null, it'll print out 'successful login!' , print out object. however, what's happening use fake credentials, webservice returns null. still 'successful login!' gets printed, , after prints 'returned data: null'... doesn't make sense. if data null, should nev...

error in taking input string after integer in java -

i trying : int n = myscanner.nextint(); for(int i=0;i<n;i++){ string str = myscanner.nextline(); . . . } when compiled shows errors java.util.scanner.nextint(scanner.java:2117). thought problem of nextline() used next() . found out if add myscanner.nextline() after taking input in n i.e int n = myscanner.nextint(); myscanner.nextline(); then worked fine. want know why happened? you need consume newline character enter when passing integer: int n = myscanner.nextint(); //gets integers, no newline myscanner.nextline(); //reads newline string str; for(int i=0;i<n;i++){ str = myscanner.nextline(); //reads next input newline . . . }

Java only making .class file but not running program -

Image
this question has answer here: what “could not find or load main class” mean? 35 answers only making .class file not running program. class shayan { public static void main(string args[]) { system.out.println("shayan"); } } your class not declared public. additionally convention in java start classes upper case letter - should called shayan.

jquery - Why javascript function is not running? -

i have created javascript function in html file, , in ajax success console data. there aren't showing in console, , there not error found in console. what happen? this code: <!doctype html> <html> <head> <meta charset="utf-8"> <meta http-equiv="x-ua-compatible" content="ie=edge"> <title>home</title> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> </head> <body> <div class="container"> <div class="div-form"> <h1>form</h1> <fom action="#" id="ajax-form" method="post" accept-charset="utf-8"> <div class="input-group"> ...

using subprocess.popen with ssh - python -

i'm trying run python script host clients via subprocess.popen. command sort of fire , forget , process in clients should run unlimited time untill kill it. problem - when run line in python process run on clients hour , stops after 1 hour , 2 minutes : subprocess.popen(["rsh {} {} {}".format(ipclient,command,args)], shell=true) where "command" path , command in clients. , when run rsh 'ip' 'command' 'args' in shell works expected , not stop suddenly. any idea? while subprocess.popen might work wrapping ssh access, not preferred way so. i recommend using paramiko . import paramiko ssh_client = paramiko.sshclient() ssh_client.set_missing_host_key_policy(paramiko.autoaddpolicy()) ssh_client.connect(server, username=user,password=password) ... ssh_client.close() and if want simulate terminal, if user typing: chan=self.ssh_client.invoke_shell() def exec_cmd(cmd): """gets ssh command(s), exec...

regex - strange SQL query results on MySQL for REGEXP match -

i using mysql , running follow query column title starts a, b or c. below query can still match title test. if give hint wrong, great. select title customer title regexp '[a-c].*' thanks in advance, lin you need use string start anchor ^ , use binary regexp enable case matching: select title customer title regexp binary '^[a-c]' regexp not case sensitive, except when used binary strings. note regexp not require full string match, thus, can safely remove .* pattern.

jquery - Loading options in Dropdown (using delegate) -

hello everyone in code, there 1 drop down list. want add options it. have used following code. adding fields via jquery. after that, can not select option drop down. think because of click event.. var myoptions = { 'india' : 'india', 'sri lanka' : 'sri lanka', 'uae' : 'uae', 'qatar' : 'qatar' }; var drop_down = jquery("[name='ab-custom-field-1252']"); jquery("body").on('click',drop_down,function() { var myselect = jquery("[name='ab-custom-field-1252']"); myselect.html(''); jquery.each(myoptions, function(val, text) { myselect.append( jquery('<option></option>').val(val).html(text) ); }); }); can me? highly appreciated.

Spring constructor injection without configuration (annotations, XML, java config) -

i have problem constructor injection component scanned beans. have following service public class someservice implements isomeservice { private isomeservice2 someservice2; public someservice(isomeservice2 someservice2) { this.someservice2 = someservice2; } . . . } then have configuration perform component scanning: @configuration @componentscan( basepackages = "base.backage", includefilters = @componentscan.filter(type = filtertype.regex, pattern = ".*")) public class appconfig { } then try resolve isomeservice: applicationcontext ctx = new annotationconfigapplicationcontext(appconfig.class); isomeservice someservice1 = ctx.getbean(isomeservice.class); this throws exception java.lang.nosuchmethodexception (it not have default non arg constructor). have isomeservice2 bean scanned , registered well. can fix adding @autowired annotation someservice constructor. is there way how make const...

python - Error with Sklearn Random Forest Regressor -

when trying fit random forest regressor model y data looks this: [ 0.00000000e+00 1.36094276e+02 4.46608221e+03 8.72660888e+03 1.31375786e+04 1.73580193e+04 2.29420671e+04 3.12216341e+04 4.11395711e+04 5.07972062e+04 6.14904935e+04 7.34275322e+04 7.87333933e+04 8.46302456e+04 9.71074959e+04 1.07146672e+05 1.17187952e+05 1.26953374e+05 1.37736003e+05 1.47239359e+05 1.53943242e+05 1.78806710e+05 1.92657725e+05 2.08912711e+05 2.22855152e+05 2.34532982e+05 2.41391255e+05 2.48699216e+05 2.62421197e+05 2.79544300e+05 2.95550971e+05 3.13524275e+05 3.23365158e+05 3.24069067e+05 3.24472999e+05 3.24804951e+05 and x data looks this: [ 735233.27082176 735234.27082176 735235.27082176 735236.27082176 735237.27082176 735238.27082176 735239.27082176 735240.27082176 735241.27082176 735242.27082176 735243.27082176 735244.27082176 735245.27082176 735246.27082176 735247.27082176 735248.27082176 wit...

objective c - "setFrame" doesn't work for UIScrollView in iOS -

i've put scrollview in storyboard. next, in code call self.scroll.frame = cgrectmake(100, 0, 800, 900); i suppose scroll should change position (100, 0) but somehow still remains in original position set in storyboard. what missing ? yes won't work view in autolayout system @ if added using storyboard or xib. if want set frame initialise in code. @property (nonatomic,strong) uiscrollview *scrollview; _scrollview = [[uiscrollview alloc] initwithframe:cgrectmake(0, 0, 320, 568)]; if want set position in autolayout system should consider updating constraints of view. self.scrollviewwidthconstraint.constant += 20; [self.scrollview updateconstraints];

javascript - TypeError: R[o5R.F6s] is not a function in changing states in phaser box2d -

Image
i build game using phaser.2.4.3.min.js , phaser.2.2.2.box2d.min.js when trying change states error being raised typeerror: r[o5r.f6s] not function , can't seem figure out problem ps : took source code of box2d plugin example folder in phaser , , did not purchase full plugin yet testing . is there anyway fix issue ? here game code : http://jsfiddle.net/fbdtq1tg/5/ and here error raised : setgameover: function () { this.game.state.start("thegame"); } the error seems clear: script trying execute function, variable isn't function. what happens: box2d.m_gravity = box2d.clone(); r[o5r.f6s]() string "clone" , not function. r = box2d, the script trying execute function( r[o5r.f6s]() . o5r object lot of functions in requested f6s string("clone"). so, did research why box2d.b2world = function(gravity){...this.m_gravity = gravity.clone();.. } , seems bug. check out following links: http://www.html5...

pdf - PDFsharp text formatting -

i saw this question doesn’t me. the problem can write text pdf file, if new gfx.drawstring put second text on first... like this.... here code used set new line: gfx.drawstring(lbname.text + " " + lbnamei.text, font, xbrushes.black, new xrect(0, 0, page.width.point, page.height.point), xstringformats.topleft); gfx.drawstring(lbvorname.text + " " + lbvornamei.text, font, xbrushes.black, new xrect(0, 0, page.width.point, page.height.point), xstringformats.topleft); i think has numbers in first argument ( new xrect(0, 0, ) i’m not sure how set them please me. i can't remember parameter which, discover yourself: set 1 of numbers 20 on 1 of pieces of text; observe effect. change , change different number; observe effect.

Spring SAML - Global logout not working after hitting URL '/saml/logout' -

accoriding spring saml extension document : local logout terminates local session , doesn't affect neither session @ idp, nor sessions @ other sps user logged in using single sign-on. local logout can initialized @ scheme://server:port/contextpath/saml/logout?local=true. for global logout, have hit scheme://server:port/contextpath/saml/logout url, me, logs out local session, doesn't logout idp. this [websecurityconfig] ( https://github.com/vdenotaris/spring-boot-security-saml-sample/blob/master/src/main/java/com/vdenotaris/spring/boot/security/saml/web/config/websecurityconfig.java ) , i'm using create saml sp. question is, doing wrong here? or problem because of idp i'm using (can't mention idp it's 1 of firm's saml sso). or have define global logout handler here? if yes, how? global logout in case of single sign on (sso) needs support both service providers (sp) identity providers (idp). doing enabling global logout endpoint sp side en...

html - Scale image from the middle using jQuery -

is possible make image scale middle jquery? right it's going top left. $( document ).ready(function() { $("#logo").animate({ height: '+=100%', width: '+=100%' }); }); #logoblock { position: relative; width: 700px; height: 700px; margin: auto; } #logo { position: absolute; width: 0%; height: 0%; } <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> <div id="logoblock"> <div id="logo"> <img src="http://placehold.it/700x700"> </div> </div> is possible? may b not want $( document ).ready(function() { $("#logo").animate({ height: '+=100%', width: '+=100%', top: 0, left:0 }); }); css #logoblock { position: relative; width: 700px; height: 700px; margin: auto; } #logo { position: a...

php - Error on server Local host working fine -

a php error encountered severity: core warning message: php startup: unable load dynamic library '/opt/php54/lib/php/extensions/no-debug-non-zts-20100525/php_curl.dll' - /opt/php54/lib/php/extensions/no-debug-non-zts-20100525/php_curl.dll: cannot open shared object file: no such file or directory filename: unknown line number: 0 backtrace: it means there extension or zend_extension line in 1 of php configuration file (php.ini, or close it) trying load extension : ixed.5.2.lin but corresponding file doesn't exist. try search in .ini files loaded php (phpinfo() can indicate ones are) : 1 of them should try load extension. comment correspond line.

Select Box Css - a triangle indicating dropdown -

Image
this question has answer here: how style <select> dropdown css without javascript? 23 answers following select box: rather having traditional drop down icon intending have different colored yellow triangle shape indicating dropdown. select { font-family: inherit; font-size: inherit; line-height: inherit; background-color: #363583; border-color: #363583; color: #a2a1c6; } how achieve such look. in advance. dropdown styling interesting thing. if have customized dropdown current element span use ::after selector make this position: absolute; border-left: 0.7rem solid transparent; border-bottom: 0.7rem solid #777; bottom: 0; right: 0; but kumar right, kinda need code of dropdown know can it.

spring - Enable Fips for MQ-messaging no effect -

i try use ssl_rsa_with_3des_ede_cbc_sha fips enabled connect ibm mq 7.5.0.5. my problem receive error because ciphersuites don't match. in queuemanager see, suite, used client still triple_des_sha_us if fips still disabled. in springframework-bean i'm using: <prop key="javax.net.ssl.sslfipsrequired">true</prop> and in mqqueueconnectionfactory -bean i'm using: <property name="sslfipsrequired" value="true" /> is there possible place have add fips-required property? edit: the jms-report says: jvm not contain fips compliant jsse so think problem jsse.

html - using URL hashes in javascript AND anchors -

we're using url hashes in places in our app filter display, e.g. #highlight=free highlight our free content. use javascript process hash, listen hash changes. works great. we're wondering best way mix "real" html anchor links. i.e. links point specific html id on page, e.g. #chapter-5 . should implement jumping right place using javascript , stop relying on default browser behaviour? example, link #chapter=chapter-5&highlight=free , handle both filter , anchor in javascript? or there safe/standard way "mix" anchors , custom hashes? if target environment allows it, "safe/standard way" leave hashes old-school hash (commonly seen "hashbang") approach alone regular in-page anchors , use modern html5 history api instead . if must support older browsers can use polyfill resorts hash.

php - Optimized solution for Comparison in 2D array -

so have 2d array. array (size=6) 'us-20150018889-a1' => array (size=5) 0 => string 'us-13795596' (length=11) 1 => string 'us-13713626' (length=11) 2 => string 'us-11361942' (length=11) // match 1 3 => string 'wo-ch2003000577' (length=15) 4 => string 'us-20150018889' (length=14) 'us-20140018803-a1' => array (size=2) 0 => string 'us-11159064' (length=11) 1 => string 'us-20140018803' (length=14) 'us-8523858-b2' => array (size=17) 0 => string 'us-20060287652' (length=14) 1 => string 'cn-101296665' (length=12) 2 => string 'ca-2613278' (length=10) 3 => string 'za-200711136' (length=12) 4 => string 'kr-101334253' (length=12) 5 => string 'jp-5138587' (length=10) 6 => string 'tw-200709800' (lengt...

c# - Create XML file from REST response -

i have following method making rest request returns data in xml format - public void test() { string requesturi = string.empty; try { requesturi = string.format("uri/{0}?locales={1}", "test", "en-gb"); httpclient client = new httpclient(); client.baseaddress = new uri(requesturi); httpresponsemessage response = client.getasync(requesturi).result; if (response.issuccessstatuscode) { string content = response.content.readasstringasync().result; // want create xml file here this.writetofile(content); } } catch (exception) { throw; } } how can create xml file response got api? since content xml change this.writetofile(content) to file.writealltext("foo.xml", content); also try {} catch (exception e) {throw e} bad. rethr...

Translation Transformation in openGL -

Image
i learning opengl. got problem when try translation transformation. result isn't translation wanted. static image and code translationtransformation.cpp #include <gl/glew.h> #include <gl/freeglut.h> #include <stdio.h> #include <math.h> #define num_vertices 3 #define num_indices 3 #define buffer_offset(i) ((char *)null + (i)) gluint vbo, gworldlocation, indexbufferid, shaderprogramid, positionid; static float scale; struct vector3f{ glfloat x; glfloat y; glfloat z; vector3f(){}; vector3f(glfloat _x, glfloat _y, glfloat _z){ x = _x; y = _y; z = _z; } }; struct vector4f{ glfloat x; glfloat y; glfloat z; glfloat w; vector4f(){}; vector4f(glfloat _x, glfloat _y, glfloat _z, glfloat _w){ x = _x; y = _y; z = _z; w = _w; } }; struct matrix4f{ float m[4][4]; }; static char* readfile(const char* filename) { // open file file* fp = fop...

how to use or(||) in jquery -

i have functions want trigger if whether first button clicked or second button clicked don't know syntax write it store function , add buttons click event. function yourfunc(){ //the code } $("#firstbutid").click(yourfunc); $("#secondbutid").click(yourfunc); btw, wrote cause short stack overflow philosofy encourages make research, try , come here , ask when can't find solution problem. rather come , ask make code you.

python - Run two parallel cmd from single batch file ? -

i want run 2 python files batch file in parallel want each 1 executed in separate cmd because take time finish , want them run in parallel there away ? start runs script in new shell. start "" script1.py script2.py runs them in parallel, note there no (easy) way resynchronize, ie. wait in calling batch script1.py complete. (the empty quotes after start optional window title argument start , if omit them , enclose script path in quotes because contains spaces, start take erroneously window title)

How to write a condition when a date field should be sorted according to date filters in rails? -

i having date filters named start_date , end_date , have sort contacts based on filters , sort according created_at (a date field). this method listing records: def execute_records @items = [] if @params[:category_id] && !@params[:category_id].empty? contacts = contact.joins(:company).where(active: true, account_id: @user.id, companies: {category_id: @params[:category_id], active: true}) else contacts = contact.joins(:company).where(active: true, account_id: @user.id, companies: {active: true}) end contacts.includes(company: [:addresses, :category, :lead_source]).each |contact| @items << report.new(contact) if contact.is_a?(contact) end end here in above method wanted add condition created_at in between start_date , end_date . created_at field in contacts table. please me.. i think need this: contact.joins(:company).where(active: true, account_id: @user.id, companies: {created_at: time.new(params[:start_...

ios - Get the first Monday in the month -

i test if today first monday of month. doing : nscalendar *gregoriancalendar = [[nscalendar alloc] initwithcalendaridentifier:nscalendaridentifiergregorian]; nsdate *today = [nsdate date]; nsinteger weekdayofdate = [gregoriancalendar ordinalityofunit:nsweekdaycalendarunit inunit:nsweekcalendarunit fordate:today]; if (weekdayofdate == 2) { // monday } but code correct every monday in month. how can first monday of month ? you need add condition checking if we're in first 7 days of month. however, notice of values you're using have been deprecated, starting ios8. i've added complete version of code, including replacements deprecated values: nscalendar *gregoriancalendar = [[nscalendar alloc] initwithcalendaridentifier:nscalendaridentifiergregorian]; nsdate *today = [nsdate date]; nsinteger weekdayofdate = [gregoriancalendar ordinalityofunit:nscalendarunitweekday inunit:nscalendarunitweekofyear fordate:today]; nsinteger dayofmonth = [gregorianc...

Installing a specific version of docker-engine (v1.7+) on Ubuntu? -

docker have changed way docker-engine installed on ubuntu since version 1.7 (if i'm not mistaken). before example: sudo apt-get install lxc-docker-1.3.3 to install version 1.3.3 described in this answer. nowadays installation instructions tells do: curl -ssl https://get.docker.com/ | sh but installs (or upgrades to) lastest version of docker. not want do, example when managing cluster of servers needs run specific docker version. question is, how install specific version required dependencies? short answer add command after curl command # apt-get install docker-engine=1.7.1-0~trusty more detail explaination: docker-engine used instead of lxc-docker since 1.7.x noticed. the command used curl -ssl https://get.docker.com/ | sh shortcut install latest version, , works platform if use ubuntu, can check detail steps inside https://get.docker.com , below: # apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118e89f3a912897c0...

mysql - Selective query -

i'm keeping database of accesses website (origin ip, refrer , landing page) can analisys of visitors , pages more interesting , wich need work (amongst other things) now visitor ips don't interest me - google's or microsoft's robots have identified, or company's own ip (we have static ip hosting , mail server), have table holding ips. i have query's access data both pages , date range, however, need show full access history on ips except ones on excluded ips table - want first access of each day edit: per request, here's example of need: here's sample tables/data (also on sqlfiddler ) create table access ( id int(11), accessdate datetime, ip varchar(15), referer varchar(150), landpage varchar(150) ); create table removed ( ip varchar(15) ); insert access (id, accessdate, ip, referer, landpage) values (1, '2015-08-25 12:22:24', '123.123.123.123', 'www.google.com', 'www.mydomain.com'); insert access ...

jquery - Print of chart generated using c3js -

need way take print of chart generated using c3js. i tried below code: var mywindow = window.open('', 'my div', 'height=400,width=600'); mywindow.document.write('<html><head><title>my div</title>'); //mywindow.document.write('<link rel="stylesheet" href="~/content/c3.css" type="text/css" />'); mywindow.document.write('</head><body>'); mywindow.document.write($('#chart').html()); mywindow.document.write('</body></html>'); mywindow.document.close(); // necessary ie >= 10 mywindow.focus(); // necessary ie >= 10 mywindow.print(); mywindow.close(); but gives me improper chart enter link description here in example inclusion of c3.css file uncommented, why that? seems it's css that's missing. and should try call window.print() when window opened finished loadi...

javascript - Receiving Uncaught SyntaxError: missing ) after argument list -

i'm trying pass task object controller , if go this: var task = task.save(task: {user_id: $scope.user.id}, $scope.newtext); i'm getting error saying uncaught syntaxerror: missing ) after argument list . what's wrong code? in advance. you can't give arguments names in way. may have wanted pass in object via object initializer, in case need { , } : var task = task.save({task: {user_id: $scope.user.id}, somenamehere: $scope.newtext}); // ------------------^-------------------------------------------------------------^ note somenamehere , you'll need name second property. or if task.save accepts 2 separate arguments, remove task: part: var task = task.save({user_id: $scope.user.id}, $scope.newtext);