Posts

Showing posts from May, 2014

models - Django URL Slugs -

i have comment , post model. i want url come out /post//comment// but unsure how set up. my post model has this: @python_2_unicode_compatible class post(models.model): ... slug = models.slugfield(unique=true) @models.permalink def get_absolute_url(self): return 'appname:post', (self.slug,) can comment model have: @python_2_unicode_compatible class comment(models.model): ... slug = models.slugfield(unique=true) @models.permalink def get_absolute_url(self): return 'appname:post:comment', (self.slug,) or how hook get_absolute_url url comes out way mentioned? or there better way? @python_2_unicode_compatible class comment(models.model): title = models.charfield(max_length=100) body = models.charfield(max_length=1000) creation_date = models.datetimefield(auto_now_add=true) last_updated = models.datetimefield() author = models.foreignkey(person, related_name='authors')

sql - Android LoadMore-ListView -

i have internal-database(sqlite) many entries. decided load first 20 entries in listview when user starts activity , when scrolls down can load 20 more each time pressing button if there entries left. edit //oncreate() acceptedlogs = helper.getlogsrange(0, load_amount); loadedentriescounter = load_amount; logadapter = new logadapter(acceptedlogs); logrecyclerview.setadapter(logadapter); logrecyclerview.sethasfixedsize(false); linearlayoutmanager = new linearlayoutmanager(getcontext()); logrecyclerview.setlayoutmanager(linearlayoutmanager); @override public void onscrolled(recyclerview recyclerview, int dx, int dy) { super.onscrolled(recyclerview, dx, dy); visibleitemcount = logrecyclerview.getchildcount(); totalitemcount = logrecyclerview.getlayoutmanager().getitemcount(); int firstvisibleitemposition = linearlayoutmanager.findfirstvisibleitemposition

Creating a jagged array in VBA, writing seems to work but reading fails Type Mismatch -

i'm in sap, trying dump array of guilabel s jagged array. first parse child's id row , column while filtering out non-guilabel objects. this part works. i created variant array represents lines, in each line element put array of strings representing each 'label columns'. this part seems work no errors the problem occurs when try read first variant array. i followed great thread -> how set "jagged array" in vba? and end of it, seems should able read each of elements simple debug.print myrows(0)(0) , type mismatch ! any advice appreciated ! function labeltoarray(lblcollection variant) variant() dim myid string dim mycolumn string dim myrow string dim intlastrow integer dim intlastcol integer dim myrows variant dim mycolumns() string ' create first row redim myrows(0) ' every child object in collection each mychld in lblcollection ' execute labels if mychld.type

python - django-newsletter - no runjobs in manage.py commands? -

hi i'm reading docs using django-newsletter. and says call following admin command send emails: ./manage.py runjob submit in other parts of docs says runjobs instead of runjob . anyways, i'm not seeing either runjob or runjobs in list of commands ./manage.py help , though 'newsletter' app in installed_apps , can access in admin. what missing? i missing django_extensions in installed_apps . actual requirements django-newsletter in installed_apps are: installed_apps = ( ... 'sorl.thumbnail', 'django_extensions', 'newsletter', ... )

for loop - How do I establish multiple random numbers in a single Arduino sketch? -

i have arduino sketch i'm planning control 8 leds blink or fade @ different rates. want set random number 1-8random output pin, random number 30-300 delay() value within loop, , third random number +=x controlling velocity of fade in or out. i'd establish random number dictates whether light blinks or fades (a boolean random work here...). here's i'm fuzzy. documentation, gleaned randomseed() function drive random(x,y) , seems infer random(x,y) values define use same seed within same sketch. there did not seem way define seed drive random , seed b drive random b. reading right? unable find samples want do. pseudocode below: void setup() { pinmode(12, output); pinmode(11, output); pinmode(10, output); pinmode(9, output); pinmode(8, output); pinmode(7, output); pinmode(6, output); pinmode(5, output); pinmode(4, output); } void loop() { # # how can assocaiate pinseed pin, delayseed delay , velseed velocity? # int pi

tabs - Twitter Bootstrap Tabbable Navbar -

i'm using twitter bootstrap create navbar @ top of page. want nav elements work tabs instead of links. see others have been able achieve this , still not able. i'm following this section of documents create navbar, , "tabbable nav" section from here add tab functionality. here's jsfiddle if prefer that, also, here pasted here: <head> <meta charset="utf-8"> <title>course manager</title> <link rel="stylesheet" href="http://netdna.bootstrapcdn.com/bootswatch/2.3.2/cerulean/bootstrap.min.css"/> </head> <body> <div class="container"> <div class="navbar"> <div class="navbar-inner"> <a class="brand" href="#">training courses</a> <ul class="nav nav-tabs"> <li><a href="#courses" data-toggle="tab">manage courses</a

php - Send POST data to iframe and host page -

i have problem sending data form iframe page. have host page called form , form using post method works. trying send same post data in iframe . <iframe src="dirread.php?var=<?php echo urlencode($_post['filename']);?>" width="300px" height="700px" scrolling="yes"> so works 1 want send 2 lots <iframe src="dirread.php?var=<?php echo urlencode($_post['filename'],$_post['site'] );?>" width="300px" height="700px" scrolling="yes"> what correct syntax please? you sending post-parameters get-parameters iframe. send 2 variables have use: <iframe src="dirread.php?var=<?php echo urlencode($_post['filename']); ?>&var2=<?php echo urlencode($_post['site'] );?>" width="300px" height="700px" scrolling="yes"> there no way send post data inside iframe.

scala - Create Range with inclusive end value when stepping -

is there way create range includes end value when using step doesn't align? for instance following yields: scala> range.inclusive(0, 35, 10) res3: scala.collection.immutable.range.inclusive = range(0, 10, 20, 30) but end value (35) included so: scala> range.inclusive(0, 35, 10) res3: scala.collection.immutable.range.inclusive = range(0, 10, 20, 30, 35) no, not current definition/ implementation. strange behaviour have step same intermediate elements different last.

xamarin.android - Xamarin Forms image not showing-Android -

i have xamarin forms android app , when i'm using following code var image = new image { source = "lock.png" }; to show image, image isn't showing though. and try change source icon.png (the default xamarin icon) , working fine. does know how make image show in app? (ps: image path : ".\myapp.droid\resources\drawable\lock.png".) make sure image has build action set "android resource". otherwise, not copied final package , there no image app show. described in guide here: https://developer.xamarin.com/guides/xamarin-forms/working-with/images/#local_images

javascript - What is the difference between Methods and Functions? How to declare a method? -

i learning javascript on codecademy. understanding method function associated objects. think call method should inside object. it? should understand main difference between functions , methods write error free code. confusing me. below codecademy code, on line 2 'setage' method looks function. not related object yet. coz not inside of object. // here define our method using "this", before introduce bob var setage = function (newage) { this.age = newage; }; // make bob var bob = new object(); bob.age = 30; bob.setage = setage; // make susan here, , first give age of 25 var susan = new object(); susan.age = 25; susan.setage = setage; susan.setage(35); // here, update susan's age 35 using method that's question, see how confusing. appears referring method because later modify bob object include function, thereby making "method". var setage = function (newage) { // using "this" indicates // function may instead objec

bash - fail2ban adding hostname to iptables instead of IP -

i need fail2ban adding hostnames (instead of ip) maillog iptables. fail2ban.log shows correct ip being banned, iptables -l shows hostname forged in cases. system details; fedora 24 beta (ver. 4.5.5-300.fc24.x86_64) firewalld. gnu bash, version 4.3.42(1)-release-(x86_64-redhat-linux-gnu). fail2ban v0.9.4, bannedaction=iptables-multiport. iptables -l chain f2b-postfix-rbl (1 references) target prot opt source destination drop -- static.vnpt.vn anywhere fail2ban.log 2016-05-25 02:51:49,360 fail2ban.actions [4181]: notice [postfix-rbl] ban 14.177.53.221 fail2ban.log has correct ip.... thanks. i managed resolve errors; on fedora firewalld use banaction = firewallcmd-new not iptables-multiport. i tried first getting other errors, such as; fail2ban.action [7175]: error firewall-cmd --direct --get-chains ipv4 filter | grep -q 'f2b-postfix$' -- stdout: '' fail2ban.commandaction [7175]: erro

cocoa - How to reference/open a window in Objective-c -

i need reference single window in app. if tick off "visible @ launch" shows up. i keep seeing code following doesn't make sense. how self know window in nib file if not declared anywhere in interface? nswindow *window = [self window]; when run in applicationdidfinishlaunching, error: no visible @interface 'appdelegate' declares selector 'window' that makes sense, because no interface declared. yet how window loading automatically when 'visible @ launch' ticked? my end goal need reference window , change level, i.e. [window setlevel:nsfloatingwindowlevel]; please help? the short answer is: in appdelegate.h, declare "window" property: @property (strong) iboutlet nswindow* window; in mainmenu.nib, connect main window "window" property of "appdelegate": right-click on "appdelegate" object, click on widget next "window" property , drag window. your "appde

javascript - fill in the values of an array using the array.map -

i'm trying understand code uses array.map() var char_set = array.apply(null, array(256)).map(boolean.prototype.valueof, false); the above code creating array indexes 0-255 , each value set false could explain how array being created map method. syntax of map method arr.map(callback[, thisarg]) in case thisarg set false ? array.apply(null, array(256)) : create array of 256 elements value undefined in elements map(…) : used initialize values false the first argument in map takes callback function; boolean.prototype.valueof function act callback. true.valueof() returns true has invoked thisarg.     |     ---------- true thisarg false.valueof() returns false has invoked thisarg.     |     ---------- false thisarg when map(boolean.prototype.valueof, false) invoked each element in array pass false this boolean.prototype.valueof method. invoking false.valueof() hence returns false . thus map(boolean.prototype.valueof, false) equi

javascript - Dynamically setting event listeners (on click) in JQuery in a loop -

i iterate through array of custom objects, , each object in array create button on click event listener, setting results of on click event dynamically. in other words, click on button might result in alert 'foo', , click on button b might result on different behavior - alert 'bar'. my jshint linter says "don't make functions within loop". i hoping community share better design pattern achieving goal (vanilla js or jquery). check out fiddle - extremely simplified version of doing, illustrates point. javascript (es6): class tool { constructor (name, mainfunction) { this.name = name; this.mainfunction = mainfunction; } getname() { return this.name; } getmainfunction() { return this.mainfunction; } } var hammer = new tool('hammer', 'bang on nails'); var saw = new tool('saw', 'cuts heavy wood'); var toolbox = [hammer, saw]; (let in toolbox) { $('.wrapper').append('<div class=\&quo

php - Catchable fatal error Object of class DOMDocument could not be converted to string -

i lost error: catchable fatal error object of class domdocument not converted string this php code: <?php require_once('includes/mysqlconnect.php'); require_once('includes/utility.php'); //calling utility $utility = new utility(); //creating connection $connection= new mysql(); $connection->connect(); $getcontent= file_get_contents('http://www.example.com/'); //echo $getcontent; //create new domdocument object $doc= new domdocument(); //load html domdoc libxml_use_internal_errors(true); $doc->loadhtml($getcontent); $utility->removeelementsbytagname('script', $doc); $utility->removeelementsbytagname('style', $doc); $utility->removeelementsbytagname('link', $doc); echo $doc->savehtml(); //insert html db try { $result=$connection->db_query("call finalaggregator.insert_html('$doc')"); if ($result==0){ echo "<span style='colo

iis - OData queries give 404 error unless I add a trailing slash -

i created dummy project test odata in vs2015 , having same issue described in question, , code largely equivalent described there. web api 2: odata 4: actions returning 404 any query bound function gives 404 error until add trailing slash. example: http://localhost:46092/odata/v1/trips/default.gettripnamebyid - 404 http://localhost:46092/odata/v1/trips/default.gettripnamebyid/ - works expected http://localhost:46092/odata/v1/trips/default.gettripnamebyid(tripid=1) ?$select=name - 404 http://localhost:46092/odata/v1/trips/default.gettripnamebyid(tripid=1)/ ?$select=name - works expected this not supposed happen because microsoft documentation never mentions trailing slash required, examples supposed work without them. also, breaks swagger ui doesn't add trailing slash , gets 404 when trying make query. what reason behaviour? how make work without slash, seems normal expected behaviour? here code snippets: tripscontroller.cs: ... [httpget] public ih

ios - how to render UIView over UIImageView in swift -

i looking way render uiview on uiimageview on camera in swift. problem capture small rectangular portion of image.for tried reducing size of uiimageview in case camera adjusted whole image in small area not objective. finally decided hide camera rendering other component on both side up/down, how can do? uigraphicsbeginimagecontextwithoptions(view.bounds.size, true, 0) view.drawviewhierarchyinrect(view.bounds, afterscreenupdates: true) let image = uigraphicsgetimagefromcurrentimagecontext() uigraphicsendimagecontext()

java - libGDX orthographic camera view size (with Box2D) -

Image
i have next easy class 1 ball , 4 walls around screen: spritebatch batch; box2ddebugrenderer debugrenderer; world world; orthographiccamera camera; public float virtual_width = 720f; public float virtual_height = 1280f; @override public void create () { batch = new spritebatch(); camera = new orthographiccamera(virtual_width, virtual_height); world = new world(new vector2(0, -9), true); debugrenderer = new box2ddebugrenderer(); bodydef bodydef = new bodydef(); bodydef.type = bodydef.bodytype.dynamicbody; circleshape circleshape = new circleshape(); circleshape.setradius(50); fixturedef fixturedef = new fixturedef(); fixturedef.shape = circleshape; fixturedef.restitution = 1; body body = world.createbody(bodydef); body.createfixture(fixturedef); createwall(0f, -virtual_height/2, virtual_width/2, 30f); createwall(0f, virtual_height/2, virtual_width/2, 30f); createwall(-virtual_width/2, 0f, 30f, virtual_heigh

php - DocuSign Embedded returns timed out exception? -

i have been using docusign embed signing in ui using below php code. have given correct credentials, public function sign(){ $username = "sample@sample.com"; $password = "sample"; $integrator_key = "1fsfd0658-zv95-4317-a016-d9f76eaasdff9"; // docusign environment using $host = "https://demo.docusign.net/restapi"; // create new docusign configuration , assign host , header(s) $config = new \docusign\esign\configuration(); $config->sethost($host); $config->adddefaultheader("x-docusign-authentication", "{\"username\":\"" . $username . "\",\"password\":\"" . $password . "\",\"integratorkey\":\"" . $integrator_key . "\"}"); // instantiate new docusign api client $apiclient = new \docusign\esign\apiclient($config);

elisp - concat of parts of list -

what missing? as say: in every program bug. (defun test-test () (interactive) (let ((lll (list "a" "b"))) (message (concat "<" (car lll) ":" (cdar lll) ">")) )) error: concat: wrong type argument: listp, "a" you've misspelled cadr :). (defun test-test () (let ((lll (list "a" "b"))) (message (concat "<" (car lll) ":" (cadr lll) ">")))) also, don't need interactive, if don't plan call m-x

javascript - Dynamically add link with String parameter -

i have rest backend link mywebsite/guests , returns list of guests. in front end, want display guests links. here's code for(guest of guests) { $('#guest_list').append('<a onclick="showguest(' + guest.id + ')">' + guest.name + '</a><br>') } function showguest(id) { console.log(id) ... } i should mention guest.id string. the console print undefined . question, how can add these links string parameters? for(guest of guests) { $('#guest_list').append('<a onclick="showguest(this)" data-id='+guest.id+'>' + guest.name + '</a><br>') } function showguest(this) { console.log($(this).data('id')) }

how to crop face from image in android -

i want crop face image in android . after searching lot in internet , i have come know tutorial . have imageview . iv1 = (imageview) mainactivity.this.findviewbyid(r.id.img1); when tap imageview pick image gallery . code follows : iv1.setonclicklistener(new view.onclicklistener() { @override public void onclick(view arg0) { // todo auto-generated method stub intent photopickerintent = new intent(intent.action_pick); photopickerintent.settype("image/*"); startactivityforresult(photopickerintent, select_photo); imgno = 1; } }); in onactivityresult method , trying crop face image according following code : if (resultcode == result_ok && imgno == 1 ) { selectedimage = imagereturnedintent.getdata(); try { imagestream = getcontentresolver().openinputs

Securely providing external service credentials to Google App Engine? -

i'm getting started google app engine, , i'm having trouble figuring out how securely provide credentials external services deployed app. saw can put environment variables in app.yaml config file, don't want store secret credentials in plain text on local machine, , store deploy agnostic parts of app.yaml in version control. what best practices providing google app engine sensitive deploy specific variables?

c# - rc1-update2 (CS0433) SecureString -

i getting error after last visual studio update rc1-update2, messed me the error getting error cs0433 type 'securestring' exists in both 'system.security.securestring, version=4.0.0.0, culture=neutral, publickeytoken=b03f5f7f11d50a3a' , 'mscorlib, version=4.0.0.0, culture=neutral, publickeytoken=b77a5c561934e089' the dnvm list active version runtime architecture operatingsystem alias ------ ------- ------- ------------ --------------- ----- 1.0.0-rc1-final clr x86 win * 1.0.0-rc1-update1 clr x64 win default apparently using dnvm use 1.0.0-rc1-update1 -r clr -arch x64 -p i not using global.json , not intending project json this { "buildoptions": { "emitentrypoint": true }, "dependencies": { "microsoft.aspnet.iisplatformhandler": "1.0.0-rc1-final", "microsoft.aspnet.

bootstrap modal won't show with offline javascript library -

my bootstrap modal won't show if use offline "bootstrap.min.js" & "jquery.js" here code : <script type="text/javascript" src="jquery/jquery-1.12.4.min.js"></script> <script type="text/javascript" scr="js/bootstrap.min.js"></script> but can work normaly when use online lib : <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js"></script> <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script> what's wrong that? thanks,

httprequest - Invalid argument supplied for foreach() - request? Laravel -

i have problem request. think allready know why i'm getting error don't have idea how fix it... it's form in blade: {!! form::open(['action' => 'trickcontroller@tags', 'class' => 'blog-form']) !!} @foreach($ids $id) {!! form::hidden('id[]', $id) !!} @endforeach {!! form::label('tags', 'tags') !!} {!! form::text('name', null, ['class' => 'form-control', 'placeholder' => 'example, example, example']) !!} <br> {!! form::submit('absenden', ['class' => 'btn btn-primary']) !!} {!! form::close() !!} to more specific, it's because of hidden field inside foreach loop. if i'm doing wrong, request should give me errors, instead gives me error: invalid argument supplied foreach() if correct, multiple id 's passed controller , whole code works. need errors request if user incorrect. does know can agai

java - how to start tomcat debug port in windows while debugging tomcat application -

i'm getting exception while debugging failed connect remote vm. connection refused. connection refused: connect. i have tried command in windows system netstat -n -a -p tcp but port 8787 not there how start port. basic config is: in catalina.bat under tomcat/bin file modify below. catalina_opts="-xdebug -xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n" jpda_opts="-agentlib:jdwp=transport=dt_socket,address=8000,server=y,suspend=n" run tomcat command prompt below: catalina.sh jpda start then in eclipse create debug configuration give name configuration. give project name. give connection type standard(socket attach) host localhost port 8000( or port number , should same in other places also). see: remote debugging tomcat eclipse

jquery - Getting undefined response from ajax call -

this question has answer here: how return response asynchronous call? 24 answers i having issues getting results returned through ajax call. console.log(data) returning [undefined] on ajax call: $.get(root+'hoteles/functions/ean/get-zones.php', { zo: zones_arr }, function(data){ return data; },'json'); the response file returning correctly , json encoded including header tag. after trying googled, thought possibly response not done loading. added addition , worked charm! similar issue of complete , success on $.ajax call. i added .done() after function returned data, , did meant do! $.get(root+'hoteles/functions/ean/get-zones.php',{ zo: zones_arr }, function(data){ },'json').done(function(data){ console.log('it worked!'); console.log(data); return data; }); if ha

Access javascript data from Java (maven application) -

i hope right subforum post this. i'm new maven, vaadin , java applications in general, hoped me i'm not sure what's best way go it. have maven project (java 7) which, using javascript, creates popup window form inside, allows upload file, display content in textarea , send (the content of file string) server via ajax request. easy part. want access data sent through ajax (the string containing data of uploaded file) in java because need run through validation. had around, including book of vaadin, , net in general , considering have never done before, seems 1 way have connector, looks little complicated , appears - understand book of vaadin https://vaadin.com/docs/-/part/framework/gwt/gwt-overview.html - won't able implement in project given structure have - different what's in there. so, question guys is, given project have (just normal maven project) easiest way me access data java? here code project, put things context: import javax.servlet.annotation.webs

c# - GetResponse() Error in the PayPal functionality when trying to checkout -

so i'm following wingtip toy tutorial , , know sort of old error free until got point needed checkout paypal using sandbox developing tool this code error occurs //retrieve response returned nvp api call paypal. httpwebresponse objresponse = (httpwebresponse)objrequest.getresponse(); string result; using (streamreader sr = new streamreader(objresponse.getresponsestream())) { result = sr.readtoend(); } return result; and error im getting when run it [protocolviolationexception: must write contentlength bytes request stream before calling [begin]getresponse.] please note i'm beginner edit: full code here public string httpcall(string nvprequest) { string url = pendpointurl; string strpost = nvprequest + "&" + buildcredentialsnvpstring(); strpost = strpost + "&buttonsource=" + httputility.urlencode(bncode); httpwebrequest objrequest = (ht

xaml - Image source converter with DependencyProperty -

i'm working on wp8 mvvm app , i'm stuck @ binding problem. i have xaml code: <usercontrol.resources> <local:currentcategorysourceconverter x:key="currentcategorysourceconverter"/> </usercontrol.resources> and <image grid.rowspan="2" name="moviethumbnail" stretch="fill" width="130" height="195" horizontalalignment="center" verticalalignment="center"> <image.source> <bitmapimage urisource="{binding path=image120x170,converter={staticresource currentcategorysourceconverter}}" createoptions="backgroundcreation"/> </image.source> </image> my converter: public class currentcategorysourceconverter : dependencyobject, ivalueconverter { public bool iscurrent { { return (bool)getvalue(currentcategoryproperty

Struts2 DOJO anchor tag does not displaying as link, why? -

i trying use struts2 dojo anchor tag on jsp. <%@ page contenttype="text/html; charset=utf-8"%> <%@ taglib prefix="s" uri="/struts-tags"%> <%@ taglib prefix="sx" uri="/struts-dojo-tags"%> <sx:head/> <sx:a href="www.google.com"> email link</sx:a>

java - How easy is it to transform a signed APK back to the source code? -

i priced project in 2 phases: app source code is possible give client (tech-oriented) signed apk without giving him access source code (as source code priced separately)? able transform signed apk (classes.dex) readable classes? if how can upload apk client's play store account without giving him access source? the code can de-compiled signed apk, it's job make obscure people find difficult understand functionality. can use proguard in android obfuscate code. read this answer . read this article know how use proguard.

javascript - Using regular expressions to split on = , == , and === separately -

i having trouble code trying split string input , save different lists splitting on = , ==, , === each list splits on corresponding one var tokenequals = code.split(/[=]/gi); var tokendoubleequals = code.split(/[==]/gi); var tokentrippleequals = code.split(/[===]/gi); so if if code "= == ===" each list should have length of 2 but happening is splitting on every = , of them end same amount of 7 i have refined down var tokenequals = code.split(/\=(?!\=)/); var tokendoubleequals = code.split(/\=\=(?!\=)/gi); var tokentrippleequals = code.split(/\=\=\=/gi); the current output is: equals length 4, double equals length 3, , tripple equals length 2 when should equal 1 so triple 1 working fine other 2 not. wondering solution put in regexp fields split on cause them split on correspond amount of equals. bellow example of code in action returns [3, 2, 1] when want return [1, 1, 1] var lloccounter = function() {}; lloccounter.prototype.count = function(cod

javascript - How to close a Fancybox after gallery is fully played? -

on page images open fancybox (multiple sets of images), autoplay set true. stop fancybox after images shown (number of images vary). tried aftershow: function () { $.fancybox.close(); } this works stops fancybox right after first image. need aftershowgallery. there way achieve this? welcome. i think should try calling close() within onplayend() event handler. event handler gets called after slideshow has stopped. instead of putting close call in aftershow event handler; in onplayend() follows: $(document).ready(function() { $('.imagen').click(function(e){ e.preventdefault(); parent.$.fancybox( [ {href:'img/1a.jpg'}, {href:'img/1b.jpg'}, {href:'img/1c.jpg'} ], { // api options here onplayend: function () { $.fancybox.close(); } } ); }); });

java - Selenium, what exactly is a xpath -

i'm using selenium first time , locate webelement use selenium ide. id or name of webelement dynamicaly loaded xml file, build script use xpath of webelement, seems constant. want know xpath was. have idea i'm not sure. exemple locate specific link have : //li[6]/ul/li[3]/a i understand follow : first "a" tag contained in third li of ul contained in sixth li of page. wrong ? thank you. <li></li> <li></li> <li></li> <li></li> <li></li> <li> <ul> <li></li> <li></li> <li> <a>it find one</a> </li> <li></li> <li></li> </ul> </li> <li></li> <li></li> xpath cheat cheets: http://scraping.pro/res/xpath-cheat/xpath_css_dom_recipes.pdf http://scraping.pro/res/xpath-cheat/xpath_css_dom_ref.pdf

amazon web services - AWS S3 CloudFront - redirect from https://www.domain.com to https://domain.com -

Image
here aws route 53 setup: the domain https://www.migranthire.com doesn't work. how can redirect domain https://migranthire.com your www site pointing directly s3 bucket web site hosting endpoint, taking care of redirect domain name without www prefix. the s3 website endpoints do not support https , works http only. your solution create second cloudfront distribution -- need additional one, because second 1 has different origin. configure distribution ssl certificate, configured expect www hostname alternative name, , set origin www bucket -- however, when setting second cloudfront distribution, do not select name of bucket list . instead, enter website endpoint hostname -- www.migranthire.com.s3-website-eu-west-1.amazonaws.com . set origin protocol http (cloudfront has send request bucket http if viewer protocol https. still green lock.) then, configure route 53 send www requests new cloudfront distribution, instead of directly bucket. cloudfront speak s

database - Cassandra: copy null -

i have problem copy command in cassandra. try move old database on new server when use copy receives error: failed import 1 rows: parseerror - invalid literal int() base 10: 'null', given without retries some fields null , need keep informations. csv created copy to: copy tabel './db.csv' null='null' if try make csv without null='null' receives error: failed import 1 rows: parseerror - invalid literal int() base 10: '', given without retries how can assign null int ? cassandra version: [cqlsh 5.0.1 | cassandra 2.2.6 | cql spec 3.3.1 | native protocol v4] i have found bug description in jira: https://issues.apache.org/jira/browse/cassandra-11549 and patch worked me both on linux , windows. have manually replaced 1 line of code in given file: https://github.com/stef1927/cassandra/commit/6e7664380bb6ddea37efd5f866b7631fdc84bdac does work well?

php - Use domain suffix in url parameter -

i trying have domain suffix .com in url parameter, www.abc.com/store/abc.com . store takes page , abc.com should parameter. when try "url not found".how can that? please try this $url = "www.abc.com/store/abc.com"; $path_parts = pathinfo($url); echo $path_parts['extension'], "\n";

Is it normal to have Symfony\Component\Debug\Exception\FatalErrorException exceptions in production? -

in our production logs can see exceptions symfony\component\debug\exception\fatalerrorexception . have errors , fix them, bothers me "debug" classes. we running in "prod" environment, normal have " debug " exceptions? or did misconfigure something? having exceptions different having debug logging enabled. basically logger service available in container . can use add important information code executed. wise have different logging configurations per environment. prod environment example not have log 404 errors, maybe want log on test environments? can exclude in config_prod.yml . see: http://symfony.com/doc/current/cookbook/logging/monolog_regex_based_excludes.html aside of actual logging, monolog can send emails if threshold has been reached. on prod can let monolog send emails action_level: critical , test can more emails more info action_level: error . setting level can set minimum level log message should included in email. s

pascal - Syntax error when loading lua script -

im trying use lua in application, when trying load script using lua_loadbuffer, error message. luacontext := lua_newstate(@alloc, nil); try lual_openlibs(luacontext); s := 'print("hi")'; lua_register(luacontext, 'print', @print_func); if lual_loadbuffer(luacontext, pchar(s), length(s), pchar('sample1')) <> 0 begin raise exception.create(lua_tostring(luacontext, -1)); //<- following error message here: [string "sample1"]:1: syntax error end; if lua_pcall(luacontext, 0, 0, 0) <> 0 exception.create(''); except debugln('error: ' + lua_tostring(luacontext, -1)); end; afaik lua code valid, right? "syntax error" isn't descriptive, , me not having expierience lua, don't know mistakes. lua not work utf-16 strings. ensure data encoded 1-byte codepage, use ansistring , pansichar instead of string , pchar.

windows - Decimal separator and CComVariant -

can specify decimal separator used / used ccomvariant ? context: msmxml (ixmldomelementptr.getattribute) returns ccomvariant initialized vt_bstr regardless attribute type. therefore end decimal values stored in bstr '.' decimal separator. when windows configured coma ',' decimal separator, ccomvariant unable make conversion double or float. example: ccomvariant dummy = "1.2345"; dummy.changetype(vt_r8); if(dummy.vt != vt_r8) { cout << "failed convert" << endl; } else { cout << dummy.dblval << endl; } when windows' decimal separator coma, fall in "failed convert". tried set std::locale::global(std::locale("english_united states.1252")) nothing changed.

html - JavaScript Unicode's length (astral symbols) -

i have < input type="text" > (in html) , everytime add character if text.length < x {...} (in javascript). the problem unicode special characters/astral symbols (\u{.....}, ones more 4 hex/ non-bmp characters) "are stored 2 code units , length property return 2 instead of 1." ( https://mixmax.com/blog/unicode-woes-in-javascript ) i wanna able 1 symbols or 2, long doesn't mix 1 , 2 because have have working limit on size of visual text. i think solutions here: https://mathiasbynens.be/notes/javascript-unicode#accounting-for-astral-symbols i'm not sure how use that. my if this: if(document.getelementbyid("1").value.length<16){ edit (it's working!): <html> <head> <style> input{background:white;border:1px solid;height:30;outline-color:black;position:absolute;top:389;width:30} </style> <script> <!-- function add(sym