Posts

Showing posts from March, 2012

authentication - How to use friend with compojure? -

i'm new clojure, , i'm trying add authentication system compujure app , i'm using cemerick.friend. all routes working fine, i'm never able login, when using dummy in memory database (if can call that). the problem, believe, on cemerick.friend.credentials/bcrypt-credential-fn , never validating credentials. here's gist relevant code: https://gist.github.com/zamith/5940965 any on how solve problem nice. thanks. you want use workflows/interactive-form specify workflows/interactive-login-redirect . the latter function's purpose serve default :login-failure-handler . perform redirect after failed login attempt; makes no attempt log user in. you need remove (resp/redirect "/signup") body of friend/authenticated form in "/dashboard" route, it's unconditionally redirecting logged in users signup page. (that redirect happens in fact proof of user being authenticated, since otherwise body of friend/authenticated not

c++ - duplicate symbol for architecture x86_64 : Eclipse -

Image
not able run simple c++ program. kindly me solve problem the message means have loaded same functions twice. in hw.cpp? compiled , linked. if main function cause. suspect since have 1 function.

In XDocReport, how to handle null value? -

is there way handle null value field in xdocreport? or need manipulate on own? example: if (thisvar == null) context.put("sampletext", ""); else context.put("sampletext", thisvar); or there option in docx quick parts? i found line in error message of xdocreport. not understand apply this, in template or in code. tip: if failing expression known legally refer that's null or missing, either specify default value myoptionalvar!mydefault, or use [#if myoptionalvar??]when-present[#else]when-missing[/#if]. (these cover last step of expression; cover whole expression, use parenthesis: (myoptionalvar.foo)!mydefault, (myoptionalvar.foo)?? in docx, append ?if_exists field name «${tx.amount?if_exists}» you may append ! «${tx.amount!}» please refer link uses freemarker. how check if variable exists in freemarker template?

perl - How do I sort a list of IP addresses and compute a class and netmask for each? -

i have 2 options. 1 have array has list of ips. example @ip=(); # array has ips below in sample input: 108.0.0.30 108.0.0.30 108.0.0.30 192.168.1.1 192.168.1.2 10.0.0.1 i need program can sort such array , tell network class , subnet mask is. example, output should 10.1.1.1/25 10.1.1.1 ip , 25 submask net::ip , net::ip::resolver , net::ip::match::regexp , other submodules net::ip doing fine you. part sorting difficult. if google it, find nice methods. example: my @ips = qw( 172.27.32.200 172.19.32.100 10.1.1.60 192.20.30.133 ); @ips = map {s/\s+//g; $_} sort map {s/(\d+)/sprintf "%3s", $1/eg; $_} @ips; print join "\n", @ips; found here

PHP Stack Array Push & Pop -

ive been trying create navigation system project have been working on. i've been stuck while now, feel i'm on right track. i want know how make when user selects sql1.php removed $phpfiles same page wont appear again href. it's set random, fine want, never want user see same link twice. <?php $currentpage = $_server["php_self"]; $nextpage; $prevpage; $phpfiles = array(); $phpfilesprevious = array(); $phpfiles[] = 'sql1.php'; $phpfiles[] = 'sql2.php'; $phpfiles[] = 'sql3.php'; $phpfiles[] = 'sql4.php'; $phpfiles[] = 'sql5_1.php'; $phpfiles[] = 'sql6.php'; $phpfiles[] = 'sql7.php'; $phpfiles[] = 'sql8.php'; $phpfiles[] = 'sql9.php'; $phpfiles[] = 'sql10.php'; $nextpage=$phpfiles[rand(0, count($phpfiles)-1)]; $prevpage=$currentpage; $currentpage=$nextpage; array_push($phpfilesprevious, $currentpage); array_push($phpfilesprevious, $prevpage); unset($phpf

php - How to add browser cache in Laravel 5? -

i wish add browser caching laravel application. i have used elixir versioning tool so: https://laravel.com/docs/5.2/elixir#versioning-and-cache-busting however, according google pagespeed insights, files still not caching , instead got message: setting expiry date or maximum age in http headers static resources instructs browser load downloaded resources local disk rather on network. i think may because need manually add cache headers? yes need set cache-control , expires in http header static resources, google pagespeed message not show up. since you're using elixir versioning tool, can safely set expires of js/css files 1 week. the way depends on web server using. if using apache , may put following code in .htaccess or config file of virtual website. <filesmatch "\.(js|css)$"> expiresactive on expiresdefault "access plus 1 weeks" </filesmatch> be sure enable mod_expires apache module! with same synt

javascript - How to create specific chain of numbers -

i have school prompt create function finds out integer, in range user enters, produces longest chain. "chain" consists of: ask user number. if number even, divide 2. if it's odd multiply 3 , add 1. continue until reach 1. e.g. if start 3, sequence 3-10-5-16-8-4-2-1. function print out number produces longest chain , actual integers in chain (length of chain). this have far. can't figure out. function chain2() var startnumber = prompt("enter starting number of range", "4"); var endnumber = prompt ("enter ending number of range", "9") var separator="-"; while (currentnumber>1){ if (currentnumber%2==1){ currentnumber=currentnumber*3+1; chain+=separator+currentnumber; } else if (currentnumber%2==0){ currentnumber=currentnumber/2; chain+=separator+currentnumber;

Is it possible to use Microsoft 2013 sharepoint search server as my search engine for my site -

my site not written sharepoint. runs on iis(aspmvc) interacts on http request/response , fetches db data. does make sense install , use microsoft 2013 sharepoint search db indexing , free text querying (ms sql) ? (i know can use ms full text search features , performance poor) (i know can use solr/lucene. great solution indeed. wonder if can in ms technologies) can install not part of sharepoint? standalone indexer? how? require sharepoint foundation search? should install microsoft search server 2010 instead feature? 2013 sharepoint search? thanks. not going answer questions 1 one, skimming through them: you not able use of sharepoint's searches without installing sharepoint. there no separate search server sp2013 anymore, it's 1 product. so answer question three: sp2013 better using search server 2010 includes fast features had pay for. complete comparison free version (foundation) see page: sharepoint 2013 feature comparison chart editions yo

c - what the difference between a function and *function? -

i confused in c newbie. know 1.1 giving me maximum value , 1.2 giving me maximum value variable address [ picture ]. my question how call *findmax function in main? int * findmax(int *a,int size){ int i,max=*a,address,add; for(i=0;i<size;i++){ if(max<*(a+i)){ max=*(a+i); } } //printf("maxium value %d @ index %x",max,&max); return &max; } the * in function definition not function pointer, it's function's return type. findmax function returns pointer integer. call other functions in main: int a[] = {1,2,3,4}; int *p = findmax(a, 4); there problem, in findmax function, returned pointer local variable, storage of variable no longer available when function returns. use causes undefined behavior. can return max integer instead, if need return pointer, should allocate it, or return pointer remains valid. for example: int* findmax

How many partitions should we use in Redis? As the data become larger, how can i rearrange the partition? -

i m new team in store customer data hash in redis. our customers million, , hash partition number 8 const in server code, , select partition customer id, number 1 customer in partition 1, number 2 in partition 2, , number 9 still in partition 1, , on. wonder 8 suited data? , customer numbers increase faster, should adjust partition number? , how should choose? btw, m totally newbie redis. what doing in sharding in redis, , current logic, might face scaling , key movement issues when add new partition, or try increase partitions. thankfully, redis 3.0+ supports redis cluster , stable , production ready, , has drivers in programming languages. manage partitioning automatically. should preferred design.

verilog - How to convert two digit BCD into binary? -

i want make calculator based on fpga board(spartan 3). have following code module bcd_converter( input [7:0] r, output reg [3:0] hundreds, output reg [3:0] tens, output reg [3:0] ones ); integer i; @ (r) begin hundreds = 4'd0; tens = 4'd0; ones = 4'd0; for(i=7;i>=0;i = i-1) begin if(hundreds >= 5) hundreds = hundreds + 3; if(tens >= 5) tens = tens + 3; if(ones >= 5) ones = ones + 3; hundreds = hundreds<<1; hundreds[0] = tens[3]; tens = tens << 1; tens[0] = ones[3]; ones = ones<<1; ones[0] = r[i]; end end endmodule however, code provided conversion binary bcd. looking way reverse algorithm. there better way of converting bcd binary? you decode each bcd digit binary separate case statements, , add results. example, hundreds case statement this: case(hundreds) 4'd0 : hundreds_bin =

ruby - Stoping condition of recursive method doesn't work at the right time -

a peculiar problem ocurring me. i'm coding binary search tree methods: class binarysearchtree class node attr_accessor :value, :height attr_accessor :left, :right def initialize(value, height) @value = value @height = height end end attr_accessor :root def initialize @root = node.new(nil, 0) end def insert(value) node = @root loop case value <=> node.value when -1 if node.left.nil? node.left = node.new(value, node.height + 1) break else node = node.left end when 1 if node.right.nil? node.right = node.new(value, node.height + 1) break else node = node.right end else node.value = value break end end end def delete(value, node = @root) return if node.nil? if value == node.value node = delete_node(node) elsif value < node.value node.left = delete(value, node.left) elsif node.right = delete(va

python - arcpy + multiprocessing: error: could not save Raster dataset -

i'm doing number crunching on raster arcpy , want use multiprocessing package speed things up. basically, need loop through list of tuples, raster calculations using each tuple , write outputs files. inputs consist of data raster (bathymetry), raster defines zones, , tuple of 2 floats (water surface elevation, depth). procedure consists of function computeplane takes tuple , runs series of raster calculations produce 5 rasters (total, littoral, surface, subsurface, profundal), , calls function processtable each of rasters write values dbf using arcpy.sa.zonalstatisticsastable , add fields using arcpy.addfield_management , convert dbf csv using arcpy.tabletotable_conversion , , delete dbf file using arcpy.delete_management . based on other posts , i've wrapped code in main() multiprocessing.pool supposedly play nice. use main() create set of tuples , pool.map multiprocessing. use tempfile package pick names dbf file avoid name conflicts; csv file names guaranteed

javascript - Search box in select -

hello having big select box have huge list of elements , need search box while selecting option , how can done . thank . <select title="title"> <option></option> <option>burger, shake , smile</option> <option>sugar, spice , things nice</option> <option>baby ribs</option> <option>a really long option made illustrate issue live search in inline form</option> </select> i have created select option using divs. container , options needed, original tag. jquery rest. sample html needed: <div class='select search' id='sel1'> <div class='item'>this</div> <div class='item'>is a</div> <div class='item'>select</div> <div class='item'>with many</div> <div class='item'>option</div> <div class='item'>and <

java - How to use javax.ws.rs.core.Feature with CXF? -

i use jax-rs feature created cxf. i prefer use jax-rs feature ( javax.ws.rs.core.feature ) if possible , not cxf feature ( org.apache.cxf.feature.feature ). prefer use springcomponentscanserver ( org.apache.cxf.jaxrs.spring.springcomponentscanserver ) configure cxf rather having create server factory or servers manually. here how tried configure cxf: import com.fasterxml.jackson.jaxrs.json.jacksonjsonprovider; import com.mycustomapp.restexception.providers.restexceptionfeature; import org.apache.cxf.jaxrs.spring.springcomponentscanserver; import org.springframework.context.annotation.bean; import org.springframework.context.annotation.configuration; import org.springframework.context.annotation.import; @configuration @import(springcomponentscanserver.class) public class cxfconfiguration { @bean public restexceptionfeature restexceptionfeature() { return new restexceptionfeature(); } @bean public jacksonjsonprovider jacksonjsonprovider() {

linux - Wget over SSL gives: Unable to establish SSL connection -

this may similar post others have mentioned wget --no-check-certificate returns "unable establish ssl connection" wget https://example.com/xyz unable establish ssl connection. same curl. any way fix ? try wget --no-check-certificate https://example.com/xyz

ios - Filter Array of Custom Data Class With NSPredicate in Objective-C -

i have custom class of data named dataclass here there detail. @interface dataclass : nsobject @property (assign,nonatomic)nsinteger invoiceid; @property (assign,nonatomic)nsinteger aninvoiceid; @property (strong,nonatomic)nsstring *customername; @property (strong,nonatomic)nsstring *departmentname; @property (strong,nonatomic)nsstring *typenumberofinvoice; @property (strong,nonatomic)nsstring *invoicedate; @property (strong,nonatomic)nsstring *stocknumber; @property (strong,nonatomic)nsstring *vehicledetail; @property (strong,nonatomic)nsstring *ronumber; @property (assign,nonatomic)nsinteger amount; @property (strong,nonatomic)nsstring *color; @property (strong,nonatomic)nsstring *year; @property (strong,nonatomic)nsstring *location; @property (strong,nonatomic)nsstring *carvinnumber; @property (strong,nonatomic)nsstring *dealership; @property (strong,nonatomic)nsstring *technician; @property (strong,nonatomic)nsdata *imagedata; @property (strong, nonatomic)nsmutablearray *ar

javascript - Detect which element is clicked -

in briefly, load local html page div inside other web form in asp.net. jquery: <script> $(function () { $("#includedcontent").load("../htmlholder/index.html"); }); </script> html: <div id="includedcontent" class="webholder" style="width: 450px; height: 300px; border: 1px solid #808080; margin: 0px auto; overflow-y: scroll;"></div> now want element's class name click on them below script: <script> $(document).ready(function () { $('.webholder').on("click", "*", function (e) { alert("class :" + $(this).attr("class")); }); }); </script> my problem is, when click on element, code alert class name , it's parent! how resolve it? note: element not specific object, maybe it's input or button or textarea or ... . you should use e.target ( use selector ) not

c# - Change column position in XamDataGrid at runtime -

i working on xamdatagrid binded list of columns. want change column position on xamdatagrid on load using mvvm . have created behavior of xamdatagrid . can suggest solution according requirement? this work me: fieldlayout.fields[columnlist[i]].actualposition = new fieldposition(i, 0, 0, 0);

regex - RegExp in Javascript String Split method -

the following javascript code snippet famous javascript book nicholas c. zakas: var colortext = “red,blue,green,yellow”; var colors1 = colortext.split(“,”); //[“red”, “blue”, “green”, “yellow”] var colors2 = colortext.split(/[^\,]+/); //[“”, “,”, “,”, “,”, “”] it quite difficult understand how second split works. can explain it? javascript split based on delimeter give. if give "," omit "," string , give between string characters array. in regex case choosing expect "," it's omits other characters , 4 "," array

reactjs - Access React component from this.props.children with react-router -

i have website following react-router , react-router-relay setup: main.jsx: <router history={browserhistory} render={applyroutermiddleware(userelay)}> <route path="/:classroom_id" component={mainview} queries={classroomqueries}> <indexroute component={start} queries={classroomqueries} /> <route path="tasks" component={taskroot} queries={classroomqueries}> <indexroute component={tasklist} queries={classroomqueries} /> <route path="task/:task_id" component={taskview} queries={classroomtaskqueries} /> <route path="task/:task_id/edit" component={taskedit} queries={classroomtaskqueries} /> </route> </route> </router> the site virtual classroom, in teacher can create tasks students. these tasks can edited. when user edits task in taskedit , hits save, changes applied , user redirected tasklist . want give user " your changes saved! " m

publishing - Visual Studio 2015 publish not installing on Windows 10 Surface 3 -

having completed project in visual studio 2015 community edition, "published" project cd. copied published directory windows 10 surface 3. in elevated cmd prompt (as administrator), ran setup.exe file created published project. the application loads , runs without error. but, when program exited, not show in windows 10 start menu or application list. furthermore, checking installed programs shows ran program not installed. what doing wrong? i administrator on surface 3. (should noted, same visual studio 2015 program used create other applications published , loaded on windows 10 machines not surface 3). tia suggestions on this. simple solution -- took exploring. go "publish" tab on project properties. under install mode , settings. check √ application available offline (launchable start menu). publish "publish now". now when publish directory copied surface 3 , setup run, application correctly listed on start menu. (i'm sure

python - How to convert a string to a base64 format standard RFC-2045 MIME? -

i'm trying convert string base64 format standard rfc-2045. my code is import base64 auth_header = base64.b64encode('user:abcd'.decode('ascii')) don't know base64 standard whether using rfc-2045 (base64 encoding in python)[ https://docs.python.org/3/library/base64.html] : provides encoding , decoding functions encodings specified in rfc 3548 , defines base16, base32, , base64 algorithms, , de-facto standard ascii85 , base85 encodings. rfc-2045 mime used email. refer : encoding-of-headers-in-mimetext docs : email.mime: creating email , mime objects scratch i think solution looking code base64 encoding rfc 2045 , check this: # copyright (c) 2002-2006 python software foundation # author: ben gertzfield # contact: email-sig@python.org """base64 content transfer encoding per rfcs 2045-2047. module handles content transfer encoding method defined in rfc 2045 encode arbitrary 8-bit data using 3 8-bit bytes in 4 7-bit cha

authentication - grails spring security acl query exception -

i trying authenticate user email address using spring security acl. want use email address of accountperson belongs user domain object. when save user works fine , database updates correctly when try authenticate hibernate.queryexception: not resolve property: accountperson.email of: com.loggyt.user here code , error messages. appreciated. thanks accountperson.groovy class accountperson implements serializable{ string firstname string lastname address address string email string primaryphone string secondaryphone static belongsto = [user:user] static mapping = { address cascade: 'all' } date datecreated date lastupdated static constraints = { firstname nullable: false, blank: false lastname nullable: false, blank: false address nullable: true primaryphone blank: false, nullable: false secondaryphone blank: true, nullable: true email nullable: false, blank: false, email: true, unique: true } } user.groovy: import java.util.date cla

How to split array dynamically based on single value in JavaScript Node.js -

i need split array dynamically based on single value in javascript. i've got array: var datastuff = [ { name: 'apple', tag: 'fruit', price: '2,5'}, { name: 'bike', tag: 'sport', price: '150'}, { name: 'kiwi', tag: 'fruit', price: '1,5'}, { name: 'knife', tag: 'kitchen', price: '8'}, { name: 'fork', tag: 'kitchen', price: '7'} ]; and expect arrays split tag, eg. var fruit = [ { name: 'apple', tag: 'fruit', price: '2,5'}, { name: 'kiwi', tag: 'fruit', price: '1,5'} ]; var sport = [ { name: 'bike', tag: 'sport', price: '150'} ]; var kitchen = [ { name: 'knife', tag: 'kitchen', price: '8'}, { name: 'fork', tag: 'kitchen', price: '7'} ]; if in datastuff array more tags in result more arrays. any

Python: self.assertEqual(a, b, msg) --> I want diff AND msg -

if call this, see nice diff: self.assertequal(a, b) if call this, see msg only: self.assertequal(a, b, msg) is there easy way show diff , msg? implementing assertequal() myself work, ask myself if best way. plattform: python2.7 , pytest 2.6.2. if set longmessage attribute true , see both message. example: class testfoo(unittest.testcase): longmessage = true # <-- def test_foo(self): self.assertequal(1+2, 2, 'custom message') output: f ====================================================================== fail: test_foo (__main__.testfoo) ---------------------------------------------------------------------- traceback (most recent call last): file "t.py", line 6, in test_foo self.assertequal(1+2, 2, 'custom message') assertionerror: 3 != 2 : custom message ---------------------------------------------------------------------- ran 1 test in 0.000s

debugging - How is ProcDump implemented? Is it essentially a debugger? -

i interested in internals of procdump (a sysinternals utility): debugger? how manage dump process on exceptions, first chance exceptions , managed (clr) exceptions? i can see has imports such debugactiveprocess kernel32.dll. strings contain names of clr libraries assume dynamically loads them make use of clr debugging api (although don't see mscordbi.dll in strings - should i?). i try give elementary answer own question, after taking @ procdump ida pro. at least unmanaged side, procdump seems make use of win32 debugging api: uses debugactiveprocess , debug loop of waitfordebugevent & continuedebugevent. then, depending on startup parameters, can e.g. inspect exception , dump contents readprocessmemory io device.

Android - smoothScrollToPosition inside a child Fragment in a ViewPager -

i'm having difficulty in setting smooth scroll fragments inside viewpager , nested in fragment acts parent. i set method : public void scrolltotop() { this.recyclerview.smoothscrolltoposition(0); } for fragments not in viewpager , don't know how reference of fragments inside viewpager . i did bottomlobifragment activelobi = (bottomlobifragment)getsupportfragmentmanager().findfragmentbytag(utilities.lobbytag); to parent fragment . code viewpager (the rest identical, difference @ number of item, , constructor) public class lobbypageradapter extends fragmentstatepageradapter { public lobbypageradapter (fragmentmanager fm) { super(fm); } @override public fragment getitem(int pos) { switch(pos) { case 0: return friends.newinstance("friends, instance 1"); // case 1: return photo.newinstance("photo, instance 1"); // case 2

php - Laravel connect to Azure SQL Data warehouse using PDO -

i using laravel 5 , want connect azure data warehouse using implemented pdo database connection laravel provides. using following connection settings. db_connection=sqlsrv db_host=tcp:srv.url.com,1433 db_database=db-name db_username=user db_password=pass when load page "could not find driver" error. how possible? drivers build laravel rigth? thanks in advance! you need install pdo driver sqlsrv manually, configure in php pdo_sqlsrv extension enabled adding appropriate dll file php_pdo_sqlsrv_53_nts.dll , , compatible php running on windows. can refer http://php.net/manual/en/ref.pdo-sqlsrv.php more info. to connect sql server in php in unix, can use odbc extension , microsoft's sql server odbc driver linux .

Heira Puppet erb syntax for collection object -

our yaml. scopeconfigs: - {resource: '/users', scopes: ['demographicprofile','basicprofile']} id know how declare on heira on erb ive tried putting on heira scope_configs: "[{'resource':'/users', 'scopes': {'basicprofile', 'demographicprofile'}},{'resource':'/users2', 'scopes': {'basicprofile', 'demographicprofile'}}]" and erb tried scopeconfigs: <% scope_configs.each |config| %> - {resource: <%= config.resource %>, scopes: <%= config.scopes %>} <% end %> but still no luck, im getting can not deserialize instance of java.util.arraylist out of value_string token

nfc - Android HCE does not support select MF command? -

we developing app based on android hce. found hce uses aid-based mechanism route communication specific apps. means if want trigger app, first command must select name command. this big limitation on transport domain. in transport, many pos won't send select name command first command. instead send select mf ( 00a40000023f00 ) command first command. hce can't work in case. is there plan add default select feature? or have other solution support use case? android uses aid-based routing mechanism dispatch communication in card emulation mode specific application (hce applications or se applets). nfc forum designed primary means support multiple independent card emulation applications on single nfc device. aid-based routing requires first command select (by df name/aid) command: 00 a4 0400 <lc> <aid> [<le>] this necessary in order distinguish between different applications. otherwise, android not able dispatch communication right hce servic

MarkLogic Reindexing Issue -

i changing index configurations on replica cluster in database, re-indexing not getting triggered automatically whereas have set "reindexer enable" "true". any thoughts around this? in database replication setup, necessary apply index changes on replica first , apply them on master. need forced re-indexing on master replica consistent state index changes. there explanation here: http://docs.marklogic.com/guide/concepts/backup-replication#id_27654 also see: http://docs.marklogic.com/guide/database-replication/dbrep_intro#id_27654

Eclipse and MySQL -

Image
this question has answer here: how install jdbc driver in eclipse web project without facing java.lang.classnotfoundexception 13 answers how link eclipse , mysql? have added mysql-connector-java-5.1.38-bin.jar via project>(right-click)>properties>java build path>libraries. however each time run application, still getting caused by: java.lang.classnotfoundexception: com.mysql.jdbc.driver error. hope can advise. thank you. when add mysql-connector jar, available class compilations of project code. drivers loaded using reflection, i.e. through class.forname("driver_class_name_here") . happens during run-time , compiler need not bother class name being provided. usually web-applications packaged war archives , deployed web-containers or servers. when server executes on these archives, expects referred class in classpath. classpath incl

Updated Visual Studio 2015 RTM from Update 1 to Update 2, now Cordova Project is "Incompatible" -

Image
i updated visual studio 2015 rtm update 1 update 2 , cordova project won't open. following error message instead of project files: this project incompatible current edition of visual studio. i've installed following hot fix , rebooted machine , made no difference: https://msdn.microsoft.com/en-us/library/mt695655.aspx the option project edit .jsproj file. haven't clue i'd have change make work. here's version info visual studio: how project work new update visual studio 2015? for ever reason, visual studio seemed remove tools apache cordova , had reinstall them scratch. once i'd reapplied version 8.1 of tools, project loaded fine.

windows 7 - Couldn't open exe.file released by visual studio 2015 -

i had release built application visual studio 2015 in windows 10, copy exe file windows 7 pc, , program couldn't run, framework version latest version. can't figure out problem is, hope can in solving problem. in advance. did try in compability mode? rightclick .exe , troubleshoot compability.

vb.net - Create XMLElement from partial XML -

first off apologies have never coded xml constructs in .net hope question makes sense. let me start defining xml: <msg> <routing> ... ... ... </routing> <payload> <information> <elem1>...</elem1> <elem2>...</elem2> .. .. </information> <history> <hist1>...</hist1> <hist2>...</hist2> </history> </payload> </msg> i entire xml string. i need call function takes custom class argument. custom class has 2 properties: 1 custom class contains routing information , other of type system.xml.xmlelement. signature this: public class message public header headerinfo public payload system.xml.xmlelement end class in essence, need convert within <payload> tags type system.xml.xmlelement, maintaining xml structure under payload (i a

SSL certificate for Website behind a closed sonicwall? -

i'm trying understand if need ssl cert website have on hosted box accessible allowed list setup on our sonicwall. so have client , ip ip address access through our sonicwall on port 80 web server. other ip's blocked @ sonicwall. ip setup within iis in "ip address , domain restrictions". other ip's , set deny. need ssl cert web site? thanks restriction ip address helps restrict can access site not secure data transfer itself. means passive data sniffing still possible.

ruby on rails 3 - path helper for form_for tag with url options generates wrong url -

i using form_for helper url option this: <%= form_for @security_user, url: security_users_manage_securities_path(@security_user), html: { class: 'default', method: :put, id: 'security-default-form' } |f| %> but security_users_manage_securities_path(@security_user) returns me following string: /security_users_manage_securities.105 when need following one: /security_users_manage_securities/105 has un idea why id of @security_user parameter concatenated ' . ' instead ' / '? try use helper in singular mode, e.g. security_users_manage_security_path(@security_user) this should generate /security_users_manage_securities/105 plural used when want url list , shouldn't pass params: security_users_manage_securities_path returns: /security_users_manage_securities

ios - Swift multipeer connectivity chat -

i tried create chat app similar tutorial . the problem have right tutorial coded in swift 1 , writing code in swift 2 . consequently, there errors appearing on screen not mentioned in tutorials documentation. there 2 delegate errors say, "mpcmanager not conform x-delegate , y-delegate". what can fix issue? code of class mpcmanager: // // mpcmanager.swift // mpcrevisited // // created maximilian biegel on 22/04/16. // copyright © 2016 appcoda. rights reserved. // import uikit import multipeerconnectivity protocol mpcmanagerdelegate { func foundpeer() func lostpeer() func invitationwasreceived(frompeer: string) func connectedwithpeer(peerid: mcpeerid) } class mpcmanager: nsobject, mcsessiondelegate, mcnearbyservicebrowserdelegate, mcnearbyserviceadvertiserdelegate { var session: mcsession! var peer: mcpeerid! var browser: mcnearbyservicebrowser! var advertiser: mcnearbyserviceadvertiser! var foundpeers = [mcpeeri

list - Python Merge line with 1 entry with next line -

with output like... ['aaa', 'bbb', 'ccc', 'ddd'] ['aaa'] ['bbb', 'ccc', 'ddd'] ['aaa', 'bbb', 'ccc', 'ddd'] ['aaa', 'bbb', 'ccc', 'ddd'] i want merge single element aaa next line bbb ccc ddd form: aaa bbb ccc ddd. my current code is s in my_input_string.split('\n'): s = ' '.join(s.split()) entries = s.split(" ") if len(entries) < 2: print entries else: print entries[2] and return correct output until exception, first returns single element, wrong entry, , printing wanted output yet again. this want l = [['aaa', 'bbb', 'ccc', 'ddd'],['aaa'],['bbb', 'ccc', 'ddd'],['aaa', 'bbb', 'ccc', 'ddd'],['aaa', 'bbb', 'ccc', 'ddd'

python 3.x - create a dictionary from a csv file -

my csv program studentid,firstname,midterm,final,total,grade 20135447,delta,47.00,37.00,65.00,dc 20144521,jeffrey,36.00,22.00,27.60,ff l tried code with open('marks.csv')as file: line=csv.reader(file) mydict={rows[0]:rows[1:] rows in line} print(mydict) l got following traceback error traceback (most recent call last): file "", line 3, in file "", line 3, in indexerror: list index out of range but desired output {20135447:['delta','47.00','37.00','65.00','dc'], '20144521':['jeffrey','36.00','22.00','27.60','ff']} please me import csv mydic = dict() open('marks.csv') myfile: line = csv.reader(myfile) row in line: mydic[row[0]] = row[1:]

apache - Varnish 4 rewrite URL transparently -

i looking after website running pretty standard varnish/apache set up. client needs add new domain transparently serves path/query string in order create lightweight version of site. example: the user visits mobile.example.com points same server example.com varnish rewrites mobile.example.com request example.com/mobile?theme=mobile user receives page served example.com/mobile?theme=mobile apache, stays on mobile.example.com we need hit both path , add query string here, maintain path user has entered, i.e: mobile.example.com/test should serve content @ example.com/mobile/test?theme=mobile any tips doing varnish 4? possible? got working! if (req.http.host ~ "^mobile\.example\.com") { set req.http.host = "example.com"; set req.url = regsub(req.url, "^/", "/mobile/"); set req.url = regsub(req.url, "$", "?theme=mobile"); }