Posts

Showing posts from June, 2013

javascript - SyntaxError: Use of const in strict mode -

i'm working node.js, , in 1 of js files i'm using const in "strict mode" . when trying run it, i'm getting error: syntaxerror: use of const in strict mode. what best practice this? edit: 'use strict' const max_image_size = 1024*1024; // 1 mb the const , let part of ecmascript 2015 (a.k.a. es6 , harmony), , not enabled default in node.js 0.10 or 0.12. since node.js 4.x, “all shipping [es2015] features, v8 considers stable, turned on default on node.js , not require kind of runtime flag.”. node.js docs has overview of es2015 features enabled default, , require runtime flag . upgrading node.js 4.x or newer error should disappear. to enable of ecmascript 2015 features (including const , let ) in node.js 0.10 , 0.12; start node program harmony flag, otherwise syntax error. example: node --harmony app.js it depends on side strict js located. recommend using strict mode const declarations on server side , start server harmony flag....

php - Mysql - get 6 results before and after the desired value to make comparison chart -

today facing challenge me, solve multiple queries, little bit of php , other funny things, wondering whether mean can achieved single query and/or stored fn/procedure. i explain myself better: in list of cities, need pick value (say "general expenses") of named city (say "rome"). pretty simple. what is: have 6 records same value before , 6 after rome one. see something: | position | city | expenses | | 35 | paris | 1364775 | | 36 | milan | 1378499 | | 37 | new york | 1385759 | | 38 | london | 1398594 | | 39 | oslo | 1404648 | | 40 | munchen | 1414857 | | 41 | rome | 1425773 | *** <--this value need | 42 | dublin | 1437588 | | 43 | athen | 1447758 | | 44 | stockholm | 1458593 | | 46 | helsinki | 1467489 | | 47 | moscow | 1477484 | | 48 | kiev | 1485665 | these values populate bars chart. as can see there complexit...

python - numpy broadcast from first dimension -

in numpy, there easy way broadcast 2 arrays of dimensions e.g. (x,y) , (x,y,z) ? numpy broadcasting typically matches dimensions last dimension, usual broadcasting not work (it require first array have dimension (y,z) ). background: i'm working images, of rgb (shape (h,w,3) ) , of grayscale (shape (h,w) ). generate alpha masks of shape (h,w) , , want apply mask image via mask * im . doesn't work because of above-mentioned problem, end having e.g. mask = mask.reshape(mask.shape + (1,) * (len(im.shape) - len(mask.shape))) which ugly. other parts of code operations vectors , matrices, run same issue: fails trying execute m + v m has shape (x,y) , v has shape (x,) . it's possible use e.g. atleast_3d , have remember how many dimensions wanted. how use transpose: (a.t + c.t).t

ios7 - iOS 7 change tabBar selected icon -

i've created tabbar in storyboard , set custom image. want use different image "selected" state, know can't set image using storyboard how do programmatically? i want change icon tint colour in code can't make happen either. i appreciate please. try in appdelegate.m file [tbc.tabbar setselectionindicatorimage:[uiimage imagenamed:@"your_image_name.png"]]; where tbc - tabbarcontroller uistoryboard *iphonesb = [uistoryboard storyboardwithname:@"main_iphone" bundle:nil]; customtabbarcontroller *tbc = [iphonesb instantiateinitialviewcontroller];

jquery - Detect if the select box scroll bar has reached to bottom -

i have select dropdown , want load more options in when scroll bar reaches @ bottom not do. used following code did not work me $(function () { var $win = $('#couponproduct_0_id_brand'); $win.scroll(function () { if ($win.scrolltop() == 0) alert('scrolled page top'); else if ($win.height() + $win.scrolltop() == $(document).height()) { alert('scrolled page bottom'); } }); }); found answer here instead of automatically loading more list-items, suggest placing button users can tap load more (but that's suggestion). reference check out pulgin

c++ - push_back object reference -

as saw code, wondering run without problems. the object passed reference isn't copy of it. if put reference vector , object out of scope, shouldn't accessible anymore. but does. reason why works push_back() creates copy of referenced object. answer of behavior? struct struct1 { int value; }; std::vector<struct1> testvect; void pushvect(struct1 & element) { testvect.push_back(element); } void fillvect() { struct1 s1; (int = 0; < 10; i++) { s1.value = i; pushvect(s1); } } the push_back methods of vector taking care of making copy itself: c++ reference adds new element @ end of vector, after current last element. content of val copied (or moved) new element. so during call estvect.push_back(element); the vector works copy. therefore there no problem.

ruby on rails - How to generate reset password token -

i using devise gem authentication. in application admin create users, want user's reset password link when admin creates users. this action:- def create @user = user.new(user_params) @user.password = '123123123' @user.password_confirmation = '123123123' if @user.save @user.update_attributes(:confirmation_token => nil,:confirmed_at => time.now,:reset_password_token => (0...16).map{(65+rand(26)).chr}.join,:reset_password_sent_at => time.now) usermailer.user_link(@user).deliver redirect_to users_path else render :action => "new" end end this link reset user's password but getting reset password token invalid when open link , update password. you can use user.send_reset_password_instructions that.

html - Changing CSS Style Using Javascript -

i trying change width of bar when click on button; it's not working. have tried copying code, replacing ids , rewriting code, don't know why it's not working. <!doctype html> <html> <head> <meta http-equiv="x-ua-compatible" content="ie=8,ie=9" /> <title>page title</title> <script type="text/javascript"> var bar = document.getelementbyid("bar"); function load(){ bar.style.width = "500px;"; } </script> <link rel="stylesheet" type"text/css" href="style.css"> </head> <body> <div id="mainwrapper"> citadel goal <div id="shell"> <div id="bar"></div> </div> <form><input type="button...

submit a form values to another page in php and inserting values from the new page -

i have user registration form usertype in php . after submitting want form take value page user_med.php , page need enter values table here code <html> <body> <form id="usertype" action="user_med.php " method="get" > <center> <h1> user registration page </h1> <div id="content"> <input type="hidden" id="userreg" name="userreg" value="type" /> <ul class="user"> <li class="label">user id </li> <li class="field"> <input type="text" id="userid" name="userid" class="required error"/> </li> </ul> .......... <input type="submit" name="submit" value="submit"/> </div> </center> </form> </body> </html> ...

sql - Creating Event in MySQL does not work -

i creating event (like crone job) in mysql execute query every 3 seconds not work. tried best. here code please see if doing wrong create event `cronejob` on schedule every 3 second starts '2014-03-24 13:45:57' on completion preserve enable insert ranktable values (1,2,3); it creates not execute every 3 seconds you have start mysql server events scheduler: set global event_scheduler = on; loot at: https://dev.mysql.com/doc/refman/5.1/en/events-configuration.html

java - Restart MainActivity or application with singleTop. -

how can restart application or mainactivity when activity have: android:launchmode="singletop" i have tried: intent = getbasecontext().getpackagemanager().getlaunchintentforpackage( getbasecontext().getpackagename() ); i.addflags(intent.flag_activity_clear_top); startactivity(i); but because of singletop not working, there other way this? try restart may u intent = cntxt.getpackagemanager().getlaunchintentforpackage(cntxt.getpackagename() ); i.addflags(intent.flag_activity_clear_top); i.addcategory(intent.category_home); i.addflags(intent.flag_activity_clear_task); i.addflags(intent.flag_activity_new_task); cntxt.startactivity(i);

java - Can Guice assert that a singleton is not directly instantiated? -

is possible guice throw exception if try construct new instance of singleton? for example: public class mymodule extends abstractmodule { @override protected void configure() { bind(mysingleton.class).in(singleton.class); } } @singleton public class mysingleton { mysingleton() { /* ... */ } } public class rightway { public void withinjector() { injector injector = guice.createinjector(new mymodule()); mysingleton mysingleton = injector.getinstance(mysingleton.class); } } public class anotherrightway { private final mysingleton mysingleton; @inject public anotherrightway(mysingleton mysingleton) { this.mysingleton = mysingleton; } } public class thewrongway { public void directinstantiation() { mysingleton mysingleton = new mysingleton(); // want exception here! } } by making mysingleton 's constructor package private, can limit scope mistakes, of course classes in same package can...

How I get the rating score from Facebook pages? -

like this http://postimg.org/image/l6bq0bf5l/ it's show @ popup. i know feature has arrived less half yearand feature don't have every pages. how 4.2 score using in php? thanks. ps. try use review table don't know how use it. place , page table, review , rating don't included. you can use the /{page_id}/ratings endpoint. see docs here: https://developers.facebook.com/docs/graph-api/reference/page/ratings/ note need page access token this.

database - Oracle primary key affecting indexes -

i had index working nicely last night, low i/o stuff. morning added primary key table , performance has dropped , optimizer ignores index hints.. advice? thankyou schema structure.. product id pk name price order_line order_id fk product_id fk qty orders id pk o_date date custid query... select sum(ol.qty) product p,orders o, order_line ol p.name = 'apricot jam' , p.id = ol.product_id , o.o_date = '03-mar-2014' , ol.order_id= o.id ; the index isn't using composite index on product (name,id), instead using products primary key index range scan thanks! product table id pk name index01 price i structure table way. query going range scan because going scan table p.name = 'apricot jam' clause in query.

eclipse - How to move jar file in Maven Library -

Image
i using eclipse indigo maven. have created maven project , selected artifactid webapp-archetype 1.5.1 shown in screen shot below. when done completing project, list of libraries appears under maven library . now, want add few external jars maven library going build-path , add external jar, adds jar file not under maven library . can't manually move under maven library, neither can paste it. p.s , want remove few jar files maven library well. you need add dependencies in pom.xml not adding external jars manually build path. so remove jar added hand end add: <dependency> <groupid>javax.servlet</groupid> <artifactid>servlet-api</artifactid> <version>2.4</version> </dependency> edit if have m2eclipse plugin installed on eclipse, right click on project, , under maven menu "update project configuration". new jar should displayed under maven dependencies or if not, run mvn eclipse:c...

javascript - Remove comma to the last string -

i have code: $(".value").append($("#txtvalue").val()).attr("class", "values"); example: if #txtvalue value 'apple, banana,' how can remove comma (, ) last last value using code have in above or if detected value has last string of comma (,). want have value this: 'apple, banana' another solution regexp method think. <html> <head></head> <body> <script> //make .trim() before var stuff = "apple, banana,"; var result = (stuff.substr(stuff.length-1, 1) == ",")? stuff.substr(0, stuff.length-1):stuff; alert(result); </script> </body> </html>

android - Is Google Account required for GCM (Google Cloud Messaging)? -

i need write simple app push notifications. used gcm uses google play services information. my questions - access gcm, google account required or not? can use email account identify device? there other way push notification email account or device? quoting gcm characteristics it uses existing connection google services. pre-3.0 devices, requires users set google account on mobile devices. google account not requirement on devices running android 4.0.4 or higher. if app supporting pre-3.0 devices, yes , google account required , need add permission manifest <uses-permission android:name="android.permission.get_accounts" />

vba - How to export email addresses from outlook meeting request -

i sent outlook (2010) meeting request company (4000+) , send additional email accepted request or accepted tentatively. how do that? when hit contact atendees --> new email atendees in ribbon send response company , not accepted. tried export contacts can export name alias , not entire email addresses. any suggestions? thanks the basis of solution found here get meeting attendee list macro here minor changes. option explicit sub getattendeelist() dim objapp outlook.application dim objitem object dim objattendees outlook.recipients dim objattendeereq string dim objattendeeopt string dim objorganizer string dim dtstart date dim dtend date dim strsubject string dim strlocation string dim strnotes string dim strmeetstatus string dim strcopydata string dim strcount string dim ino, it, ia, ide dim x long dim listattendees mailitem 'on error resume next set objapp = createobject("outlook.application") set objitem = getcurrentitem() set objattend...

c++ - Is this warning related to enum class size wrong? -

warning: src/boardrep.h:49:12: warning: ‘boardrep::boardrep::row::<anonymous struct>::a’ small hold values of ‘enum class boardrep::piece’ [enabled default] piece a:2; ^ enum: enum class piece: unsigned char { empty, white, black }; use: union row { struct { piece a:2; piece b:2; piece c:2; piece d:2; piece e:2; piece f:2; piece g:2; piece h:2; }; unsigned short raw; }; with enum i'd agree gcc, may have truncate that's because enum s not separate integers , pre-processor definitions. enum class stronger. if not strong enough assume piece values taken integers between 0 , 2 inclusive warning makes sense. otherwise gcc being needlessly picky , might worth mailing list "look, silly warning" incase cannot see point you can store 4 distinct values in 2 bits of data, need 3 distinct values, enum of length 4 or less should fit nicely in 2 bits given ...

javascript delete item from array -

i have js object var myclass = class.extend({ _innerarr: [], add: function( id, url ){ this._innerarr.push([id, url]); }, delete: function( id ){ $( this._innerarr ).each(function( index ){ if ( $( )[0]==id ){ this._innerarr.splice( index, 1); // doesn't work!!! uncaught typeerror: cannot call method 'splice' of undefined } }); } }); but, if code change on: var globalarr; var myclass = class.extend({ _innerarr: [], add: function( id, url ){ this._innerarr.push([id, url]); }, delete: function( id ){ globalarr = this._innerarr; $( this._innerarr ).each(function( index ){ if ( $( )[0]==id ){ globalarr.splice( index, 1); // work!!! } }); } }); why this._innerarr not work? don't want using adding variable in project. thinks, other way is... when using jquery's .each() ...

image - Java - What is the explanation of this code? -

i have following code: for (int = 0; < height1; i++) { (int j = 0; j < width1; j++) { int rgb1 = img1.getrgb(i, j); int rgb2 = img2.getrgb(i, j); int r1 = (rgb1 >> 16) & 0xff; int g1 = (rgb1 >> 8) & 0xff; int b1 = (rgb1 ) & 0xff; int r2 = (rgb2 >> 16) & 0xff; int g2 = (rgb2 >> 8) & 0xff; int b2 = (rgb2 ) & 0xff; diff += math.abs(r1 - r2); diff += math.abs(g1 - g2); diff += math.abs(b1 - b2); } } double n = width1 * height1 * 3; double p = diff / n / 255.0; system.out.println("diff percent: " + (p * 100.0)); the code used find percentage of difference between images, don’t know why percentage divided “n” , “255.0” thanks each pixel consists of 3 color components: r - red color component g - green color component b - blue color component each of these color components represented single byte - is, 8 bits. maximum value can represented byte...

add contant to XML through JDOM -

i have been starting @ jdom. until have created file has name file.xml. add content in xml file, little bit insecure how that? fx be: - name - lastname - age hope can me? best regards julie ppackage examplepackage; import java.io.file; import java.io.filenotfoundexception; import java.io.ioexception; import org.jdom2.document; import org.jdom2.element; import org.jdom2.jdomexception; import org.jdom2.input.saxbuilder; import org.jdom2.output.format; import org.jdom2.output.xmloutputter; public class readxmlfile { public static void main(string[] args) { try { write(); read(); } catch (filenotfoundexception e){ e.printstacktrace(); } catch(ioexception e) { e.printstacktrace(); } catch(jdomexception e) { e.printstacktrace(); } } public static void read() throws jdomexception, ioexception { saxbuilder reader = ...

c# - Datatable.select doesn't return all columns in the main data table -

i working datatable.select, in order data. code following: for (int j=0; j<nstations.count();j++) { var result= dailyweatherdata.select("stationname ='" + nstations[j]["stationname"] + "' , monthh>='" + sp_biofix.month + "' , monthh<='" + sp_date.month + "'").copytodatatable(); foreach (datarow row in result.rows) { weatherdata.importrow(row); } } then ordered using following code : weatherdata = weatherdata.asenumerable() .orderby(r => r.field<string>("stationname")) .copytodatatable(); that gave me following error: the column "stationname" not belong datatable. does mean need work datatable.where ? wrong in somewhere else? i question replacing following loop: foreach (datarow row in result.rows) { weatherdata.importrow(row); } with following code : weathe...

java - Android change imageView resource onItemClick in Listview -

i got listview 3 textviews , 1 imageview -using simpleadapter specific xml layout layout: <?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/relativelayout1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical" > <textview android:id="@+id/tvsongname" android:layout_width="200dp" android:layout_height="50dp" android:layout_alignparentleft="true" android:layout_alignparenttop="true" android:background="@drawable/plank1" android:gravity="center" android:text="textview" android:textsize="14sp" android:textstyle="bold" /> <imageview android:id="@+...

android - Print PDF as byte array in JAVA -

i need print pdf file printer. code have converted pdf bytearray, stuck , not know how send printer. can me? file file = new file("java.pdf"); fileinputstream fis = new fileinputstream(file); bytearrayoutputstream bos = new bytearrayoutputstream(); byte[] buf = new byte[1024]; try { (int readnum; (readnum = fis.read(buf)) != -1;) { bos.write(buf, 0, readnum); //no doubt here 0 //writes len bytes specified byte array starting @ offset off byte array output stream. system.out.println("read " + readnum + " bytes,"); } } catch (ioexception ex) { system.out.println("error!"); } byte[] bytes = bos.tobytearray(); thank in advance. another approach send pdf file using intent , here example sample code : intent prnintent = new intent(intent.action_send); prnintent.putextra(intent.extra_stream, uri); prnintent.settype("application/pdf...

co-existence of Symfony and wordpress in single webserver -

i have implemented website in symfony2.4, blog in configured , installed in wordpress instance. my wesite under /var/www/html/website/ , documentroot in httpd.cont set /var/www/html/website/web folder of symfony. my wordpress installed in /var/www/html/blog - have created soft link of same in symfony's web folder. wordpress site not seem work. is there else need configure? my .htaccess file sumfony's web folder looks this: enter code here <ifmodule mod_rewrite.c> rewriteengine on # determine rewritebase automatically , set environment variable. # if using apache aliases mass virtual hosting or installed # project in subdirectory, base path prepended allow proper # resolution of app.php file , redirect correct uri. # work in environments without path prefix well, providing safe, one-size # fits solution. not need in case, can comment # following 2 lines eliminate overhead. # rewritecond %{request_uri}::$1 ^(/.+)/(.*)::\...

test cases for login page using selenium ; java and Eclipse IDE -

i new selenium webdriver, java (junit) , eclipse ide. please me provide test cases login page. i have managed write 1 test case in test suite in eclipse ide using selenium , junit. for reference 2 classes are: import junit.framework.test; import junit.framework.testcase; import junit.framework.testsuite; import junit.textui.testrunner; public class testsuite1 extends testcase { public static test suite() { testsuite suite = new testsuite(); suite.addtestsuite(testcase1.class); //suite.addtestsuite((case1) testcase1.newinstance()); //suite.addtestsuite(testcase1.newinstance()); return suite; } public static void main(string arg[]) { testrunner.run(suite()); } } import org.openqa.selenium.by; import org.openqa.selenium.webdriver; import org.openqa.selenium.firefox.firefoxdriver; import org.openqa.selenium.webelement; import com.thoughtworks.selenium.selenesetestcase; public c...

Kivy launcher and dependencies/third party libraries -

i'm developing kivy aplication depends on third party library. how can set/install library in android able test app in kivy launcher? possible or have compile app buildozer? regards, you can copy whole library project directory it's locally available imported. i use buildozer though, once it's set it's easy mucking around kivy launcher (i better). if module available via pip, can put name in buildozer.spec requirements field. as point of interest, can in principle compile own kivy launcher module, think there python-for-android command line option doing so. isn't nice solution though, compared other 2 options.

node.js - Angularjs passing variables from controller to dao service -

i trying pass variable controller dao service in angularjs application (frontend) , nodejs backend. here controller : $scope.afficherprofils = function() { $http.get(configuration.url_request + '/profile') .success(function(data) { $scope.owner = data._id; console.log('$scope.owner =========>'); console.log($scope.owner); $http.get(configuration.url_request + '/listerprofil', { owner: $scope.owner }) .success(function(data) { console.log('$scope.listeprofils =========>'); console.log(data); $scope.listeprofils = data; }); }); }; i calling /profile _id of account has added profile, after call /listerprofil inside success , pass owner parameter. and in dao service code following : exports.all = function(req, res) { console.log('req.body ====...

c# - Deserialization NOT from a file -

i have problem deserialization. deserialize method takes stream or text reader argument, , xml not stored file, can't read (or, don't know how read it). in fact, receive xml web services method returns dataset. can have xml use of "getxml" method, cant use deserialize() of course, use xmlwriter create xml file data , read file after deserialize, doesn't method me. a little appreciated ! use stringreader class. using(var reader = new stringreader(dataset.getxml())) { ..... }

javascript - Creating a join site link for share site in alfresco -

Image
i need sent email notification whenever new site created. created rule in site , made java script execute. here javascript var parent = space.getparent(); var siteshortname = space.getsiteshortname(); var sitegroup = "group_email_contributors"; var mail = actions.create("mail"); mail.parameters.to_many = sitegroup; mail.parameters.subject=" new site called" +siteshortname +"is created"; mail.parameters.text="login share join site; //execute action against document mail.execute(document); but getting mail a new site callednullis created‏ in subject. not saying name of site. how add site name? how add link join site? sending 4 mails instead of one here rule: i think javascript site services api may you.

css - Group addon taking up too much space in bootstrap table -

Image
when add .group-addon element inside bootstrap .table , other elements not given enough space, , group-addon input takes far room. <h2>only 1 bully, group-addon</h2> <table class="table"> <tbody> <tr> <td> <div class="input-group"> <input id="cool" class="form-control"> </div> </td> <td> <div class="input-group"> <input id="cool" class="form-control"> <div class="input-group-addon">x</div> </div> </td> <td>pushed around...</td> <td>being bullied...</td> <td>by group addons...</td> </tr> </tbody> </table> <h2>two...

openssl - openssl_sign(): supplied key param cannot be coerced into a private key -

i have googled search answer these problem.but i'm not able find proper solution question many answer specific problem related. when tried create digital signature of content using xmlsecuritykey , openssl_sign i'm getting warning , signature not created. openssl_sign throwing error : warning: openssl_sign(): supplied key param cannot coerced private key in /var/www/git/ta_client/accessservice.php on line 105 and code is: public function _signmessage($encdata, $configvalues) { $decode = 'decode'; $token = $encdata['token']; $ciphervalue = $encdata['ciphervalue']; $clientid = $encdata['clientid']; $grpcustnum = $encdata['grpcustnum']; // sign concatenated string $tosign = $token . $ciphervalue . $clientid . $grpcustnum; // encrypt token public key vendor $cipher = new xmlsecuritykey(xmlsecuritykey::rsa_sha1, array('type'=>'private')); // reference xmlseclibs $ciph...

Access js function outside a frame from a different domain -

i have several frames ( not iframe ) inside page. 1 of frames different domain main website. if website example.com, there frame source example2.com. have function on main page. call function frame. window.parent.swapframe() shows obvious security error.

How to upgrade php from using a tar.gz file in ubuntu 12.04 -

all, have problem related php upgrade. use 5.3.x, , upgrade latest 5.4.26, using "sudo add-apt-repository ppa:ondrej/php5" can upgrade version 5.4.25 , latest version should 5.4.26 . tried upgrade using tar.gz file. after installation, have problem use curl module. , re-install curl, seems can not connected current installed php version. may know how can tar.gz upgrade correctly, other installed modules correctly connected? it seems impossible upgrade php installed using "apt-get install" tat.gz installation. php.ini , other extensions files totally messed up, , easy have 2 versions of php installed. so, if tar.gz installation needed, installed php must uninstalled first. quick answers. the latest version php 5.5.3. if you, wait until april 17th, , upgrade 14.04. upgrade include latest version of php. otherwise, best bet run do-release-upgrade few times , 13.10

java - null==instance instead of instance==null -

this question has answer here: what difference between null != object , object!=null [duplicate] 2 answers i have seen @ many 3rd party code fragments in condition null==instance in used instead of instance==null if(null== connection) . just curious, approach makes impact on conditional statements or people cool use it? the common reasons hear quoted using are: it's clever , cool. it helps protect against assignment vs. comparison errors, since can't assign null . i vehemently argue against former, since "clever" becomes "difficult maintain" in codebase. latter has validity, though think decent test coverage can accomplish same task more added value. personally don't care style because doesn't read correctly me. code "read prose" make easy follow. , consider 2 prose statements: the object empty...

javascript - Allowing more than three items in jCarousel -

i have same problem following question: setting number of visible images in jcarousel the answer seems in css file, website has been dropped on me not seem follow norm. here .js code: /*! * jcarousel - riding carousels jquery * http://sorgalla.com/jcarousel/ * * copyright (c) 2006 jan sorgalla (http://sorgalla.com) * dual licensed under mit (http://www.opensource.org/licenses/mit-license.php) * , gpl (http://www.opensource.org/licenses/gpl-license.php) licenses. * * built on top of jquery library * http://jquery.com * * inspired "carousel component" bill scott * http://billwscott.com/carousel/ */ (function (g) { var q = { vertical: !1, rtl: !1, start: 1, offset: 1, size: null, scroll: 6, visible: 6, animation: "normal", easing: "swing", auto: 0, wrap: null, initcallback: null, setupcallback: null, reloadcallback: null, itemloadcallback: null, itemfirstincallback: null, itemfirstoutcallback: null, itemlastincallback: null, it...

python - Shift particular range of elements in list -

i want this: mylist[n]. shift mylist[k:l] left s. example : let n 5, s = 1 , k , l 3rd , 4th element in list. before: [a,a,b,b,a] after: [a,b,b,a,a] to clear: don't want loose 'b' items in list, 'a' can overwritten. what time , space efficient way achieve in python? edit: no rotation! using list slice: >>> lst = [1, 2, 3, 4, 5] >>> s, k, l = 1, 2, 4 # 4 = 3 + 1 >>> x = lst[k:l] >>> del lst[k:l] >>> lst[k-s:k-s] = x >>> lst [1, 3, 4, 2, 5]

c# - Antlr4 solving boolean function -

i want solve boolean functions like: (2and2)or0 (true , false) , true etc. i did tutorial simple calculator: http://programming-pages.com/2013/12/14/antlr-4-with-c-and-visual-studio-2012/ when try solve functions " true , false", right result out of it. project need solve functions integer numbers " 2 , 0 ". , result want have " true or false !". so tried convert integer numbers of input boolean ( 0 = false, , everyting else true) , compare expressions && or || . can tell me why ist not working this: public override bool visitint(combined2parser.intcontext context) { return bool.parse(context.int().gettext()); } in opinion shall convert integers found in inputstring bool, not working this. ( whole code please have on tutorial , code same ) thanks help. my next step is, whenever parser finds letter, shall transform float variable, , replace p/t input value. but need separation if expr number or letter. like...

How to add values into routing table so that i can see those in netstat -p -

when use netstat -pn server got following result: device ip address mask flags phys addr ------ -------------------- --------------- -------- --------------- asd0 10.213.213.121 255.255.255.255 00:00:00:00:01:04 dsa0 10.213.222.111 255.255.255.255 o 00:00:11:07:a0:19` i want add 1 ip address dsa0 device. command should use add value?

jquery - Can't modify tab index for kendo dropdown inside kendo grid -

i using asp.net mvc's editor template bind kendo dropdownlist inside kendo grid the navigatable property( .navaigatable(o=>o.enabled(true)) ) of grid set true unable focus on dropdownlist when press tab i.e, focus lost particular cell . i behavior can focus on dropdownlist , can change value up , down arrow keys. thank you. appreciate help! :) in editor template code below: @(html.kendo().dropdownlistfor(m => m) .autobind(false) .datatextfield("text") .datavaluefield("value") .optionlabel("selecttype") .htmlattributes(new { @id = "seconddropdownname"}) .datasource(datasource => { datasource.read(read => read.action("actionname", "controllername") .data("filter...

python - In Django how to avoid boilerplate code for getting model instance by pk in a view -

here example code: def someview(request): try: instance = somemodel.objects.get(id=request.get.get('id')) except somemodel.doesnotexist: instance = none except valueerror: # error may occur if user manually enter invalid (non-integer) # id value (intentionally or not) in browser address bar, e.g. # http://example.com/?id=2_foo instead of http://example.com/?id=2 # raises valueerror: invalid literal int() base 10: '2_' instance = none ... is there best practice model instance pk without writing boilerplate code on , over? should use predefined shortcut in django or roll own? i sure should use django's detailview or singleobjectmixin curiously enough doesn't handle valueerror exception example https://github.com/django/django/blob/master/django/views/generic/detail.py#l50 implied have specify correct integer regexp pk kwarg in urlconf? ok, likely. if pk request querystring? upd ...

concat condition not working in php pdo but running in mySQL -

running following query works in user search, within mysql on phpmyadmin. select user_id, fname, lname, email users fname '%scott james%' or lname '%scott james%' or concat(fname,' ',lname) '%scott james%' however, if try , run through php on production environment, seems fall over. got ideas? $word = $_request['search']; $search_query='select user_id, fname, lname, email users fname :search or lname :search or concat(fname,' ',lname) :search'; $stmt= $conn->prepare($search_query); $stmt->execute(array( ':search' => '%'.$word.'%', ':user_id' => $user_id )); make sure pdo in emulation mode allow multiple parameters same name get rid of ':user_id' => $user_id stuff. make sure pdo in exception mode , can see php errors

ios - Is the XCode Build (CFBundleVersion) value ever treated as a number? -

in answer https://stackoverflow.com/a/22109738/448734 , leo speaks of needing higher build number force update. there many descriptions such https://stackoverflow.com/questions/10091310/heres-how-to-auto-increment-the-build-number-in-xcode people use field number. however, field string, , empirically there seems no problem putting "3.8.3 beta 4c" in there. so question is: field ever treated number, , compared 1 considered higher another? if so, how comparison done when string contains non-numeric characters, or multiple decimal points? documented? the value of string not important. important new build appears in itunesconnect, , appstore. said "higher build number" people do. can go "5.6.1" "1.0.561" , considered new build. regarding script, can create post-build or pre-archive script logic increment build. it's shell code, can convert part of string number, increase it, , convert string again.

c# - Need to use ConcurrentQueue and ConcurrentDictionary side by side -

i have requirement messages can added concurrentqueue in parallel. , have thread reads messages , logs them @ frequent intervals. don't want repeat same message logged multiples times in interval, instead want log message x repeated y times in z amount of time. want keep order of occurrence of messages. keeping count using concurrentdictionary tried few ways getting bit complicated lock. can fulfill requirement without needing lock.