Posts

Showing posts from February, 2013

python - Optimized way for finding the number which satisfies specific conditions -

i saw question somewhere. there 8 digit number. first digit left right tells how many zeroes in number. second digit tells how many 1s in number, third digit tells u how many 2 in number , on till 8th digit tells u how many 7 in number. find number. wrote piece of code in python find out digit. apart conditions mentioned above, have few additional checks 'sum of digits should 8' , 'no 8 or 9 should present in number'. i've pasted code below. brute force since take every number , check conditions. curious know if there better way of solving problem def returnstat(number, digit, count): number = str(number) digit = str(digit) print "analysing ",digit," see if appears ",count, " times in ",number,"." actcnt = number.count(digit) count = str(count) actcnt = str(actcnt) if (actcnt == count): return 1 else: return 0 def validatenum(number): numlist = str(number...

procedure - SAS Proc-Tabulate to Produce Summary statistics from multiple variables -

i have person level dataset 3 categorical variables v1, v2 , v3. want use proc tabulate calculate means of variable x1, x2, , x3 3 categories listed above count of persons , percentage out of v1 , v2 (i.e when v3 all). here first attempt. proc tabulate date = in_data out = out_data; var x1 x2 x3; class v1 v2 v3; table (v1 all) * (v2 all) * (v3 all), n mean pctn<v1 v2>; run; this gives me error message “statistics other n requested without analysis variable in following nesting v1*v2*v3*mean”. don’t think have syntax quite right. ideas on how can fix it? thanks. you need include variables in table statement. think should work: proc tabulate date = in_data out = out_data; var x1 x2 x3; class v1 v2 v3; table (v1 all) * (v2 all) * (v3 all), (x1 x2 x3)*(n mean); run; this works me: proc tabulate data = sashelp.class out = out_data; var age weight height; class sex; table (sex all), (age weight height)*( ...

c# - Is there a word for the number of dimensions of a data set? -

i have code generates code, , want store number of dimensions of resulting data structure in variable. i'm looking right name variable. example, int should have value 0, list<int> should have value 1, list<list<int>> should have value 2, , on. is there word set theory or otherwise describes number? (at first thought cardinality apparently that's size of set, not nested-ness of set....) the word looking for, seem rank in computer programming, rank no further specifications synonym (or refers to) "number of dimensions"; thus, bi-dimensional array has rank two, three-dimensional array has rank 3 , on. strictly, no formal definition can provided applies every programming language, since each of them has own concepts, semantics , terminology; term may not applicable or, contrary, applied specific meaning in context of given language. the same term used in linear algebra : in linear algebra, rank of matrix size ...

c# - IsMouseOver trigger not working for GridViewColumn WPF XAML -

here code of xaml: <page.resources> <style x:key="cells" targettype="gridviewcolumnheader"> <style.triggers> <trigger property="isenabled" value="true"> <setter property="background" value="#ff00b9ff"></setter> <setter property="foreground" value="white"></setter> <setter property="borderbrush" value="#ff00b9ff"></setter> <setter property="padding" value="8"></setter> <setter property="minwidth" value="100"></setter> </trigger> <trigger property="ismouseover" value="true"> <setter property="background" value="#ff00b9ff"...

python - Pygame with Multiple Windows -

i need to build application has multiple windows. in 1 of these windows, need able play simple game , window has display questions , response user influences game. (1) wanting use pygame in order make game. there simple way have pygame operate multiple windows? (2) if there no easy way solve (1), there simple way use other python gui structure allow me run pygame , window simultaneously? the short answer no, creating 2 pygame windows in same process not possible. if want run 2 windows 1 process, should pyglet or cocos2d . an alternative, if must use pygame, use inter-process communication. can have 2 processes, each window. relay messages each other using sockets. if want go route, check out socket tutorial here .

function - Can't pass nil to two optional parameters -

Image
i'm in process of converting objective-c category swift extension provide simplified methods adding constraints. 1 method equally spacing views has following signature, func addandequallyspaceviews(views: [uiview], leftortopspace: cgfloat?, rightorbottomspace: cgfloat?, options: nslayoutformatoptions?) i call this, self.view.addandequallyspaceviews([view1, view2], leftortopspace: nil, rightorbottomspace: nil, options: .alignallbottom) i want able pass nil leftortopspace , rightorbottomspace parameters, when pass nil both of them, series of compile time errors. can pass nil either of them alone, not both. why can't pass nil both optional parameters? the errors i'm getting seem non-specific, , not related line in question, it's not nil cgfloats. it's implicit enumeration type. here's workaround: self.view.addandequallyspaceviews([view1, view2], leftortopspace: nil, rightorbottomspace: nil, options: nslayoutformatoptions.alignal...

c++ - Specifying correct library to link in Xcode when multiple copies exist on search path -

i trying compile c++ file depends on ffmpeg. have spent long time trying fix link errors. found on mac needs: libbz2.dylib libiconv.dylib libz.dylib libavcodec.a libavformat.a libswscale.a libswresample.a videodecodeacceleration.framework codevideo.framework corefoundation.framework the problem have still symbol link errors libiconv though library present in /usr/lib , other libraries in directory being found there. compile line includes -liconv.2 on searching around found problem comes there being 2 version of libiconv on system. 1 in /usr/lib , other in /opt/local/lib . 1 in /usr/lib exports symbols ffmpeg uses named " _iconv_open ", whereas 1 in /opt/local/lib exports same symbols " lib " added, e.g. " _libiconv_open ". seems compiler picking /opt/local/lib library. how can xcode pick correct lib?

c++ - Inputting data into and sorting a struct -

Image
i created struct , created functions perform several things on it. having trouble sortlength function, because when run program, data in length gets sorted. every thing else works fine although wondering if okay order off bit since using arrays start count @ 0. asked professor clarification , told me if have these (length , widths) in array , using comma separate them 10,8 4,3 6,5 5,1 2,1 3, 2 then sorted on length, array be: 2 ,1 3,2 4, 3 5,1 6,5 10,8 however, not getting output. here output getting. here instructions sortlength function. note function sort using value length of each rectangle (in ascending order). you pick algorithm use; bubble, selection or insertion. remember sorting array! #include "stdafx.h" #include <iostream> using namespace std; struct rectangle { int length; int width; int area; }; const int size = 4; // function prototypes void getvalues(rectangle[])...

java - Rotate a given String layout clockwise -

given string layout of following form: x......x ....x..x ....x..x rotate above layout 90 degrees clockwise should be: ..x ... ... ... xx. ... ... xxx what's easiest way rotate string characters clockwise 90 degrees? string layout can of form , size. if have 100000x100000 size string layout? public string rotate(string layout) or public void rotate(string layout) edit i fixed mistake pointed out op in comments below. should produce required in original question above. public static string rotatestringmatrixby90(string matrix) { int numberofrows = 3; // leave exercise int numberofcolumns = 8; // same 1 string newmatrix = ""; int count = 0; string[] newmatrixcolumns= matrix.split("\n"); while (count < matrix.split("\n")[0].length()) { (int = newmatrixcolumns.length - 1; > -1; i--) { newmatrix = newmatrix + newmatrixcolumns[i].charat(count); } newmatrix = ...

SWI-prolog to C# assert not working -

i'm working on solution using sbssw.swiplcs dll integration between c# application , prolog .pl source file, i'm facing problem assert(atom) command. my prolog file set of airports , flights between airports, during running time assert new airports , flights this: internal void alta(flight new) { try { plengine.initialize(new string[] { "" }); //plengine.initialize(param); plquery.plcall("consult(vuelos)"); //comando //flight(v01,bra,ams,1000) plquery q = new plquery("assert(fligth(" + new.id + "," + new.airportfrom.id + "," + new.airportto.id + "," + new.price + "))"); } catch (plexception e) { console.writeline(e.messagepl); console.writeline(e.message); } { plengine.plcleanup(); } } this runs fine, ...

c# - The type is defined in an assembly that is not referenced, how to find the cause? -

i know error message common , there plenty of questions on error, no solutions have helped me far, decided ask question. difference of similar questions me using app_code directory. error message: cs0012: type 'project.rights.operationsprovider' defined in assembly not referenced. must add reference assembly 'project.rights, version=1.0.0.0, culture=neutral, publickeytoken=null'. source file: c:\inetpub\wwwroot\test\website\app_code\company\project\businesslogic\manager.cs following suggestions here , here , have deleted instances of project.rights.dll inside c:\windows\microsoft.net/*.* according this , checked if .cs files in question have build action set "compile". do. have double checked .cs file containing "project.rights.operationsprovider" type deployed app_code directory. for reason, application not looking type in app_code directory. since i've deleted instances of project.rights.dll (that know of), don't know assem...

sql - Select minimum number in a range -

i have table data like. itemcode 1000 1002 1003 1020 1060 i'm trying write sql statement minimum number (itemcode) not in table , should able next lowest number once previous minimum order id has been inserted in table skip numbers in db. want 1 result each time query run. so, should 1001 first result based on table above. once itemcode = 1001 has been inserted table, next result should should 1004 because 1000 1003 exist in table. based on have seen online, think, have use while loop this. here code i'm still working on. declare @count int set @count= 0 while exists (select itemcode oitm itemcode '10%' , convert(int,itemcode) >= '1000' , convert(int,itemcode) <= '1060') begin set @count = @count + 1 select min(itemcode) + @count oitm itemcode '10%' , convert(int,itemcode) >= '1000...

how to set value in text field in angularjs on row click -

i trying set value on text field when row click got value of row text not able set value on text field . here concept <li ng-click="rowclick(station)" class="item" ng-repeat="station in data.data | filter:stationcode :startswith">{{station.stationname+"-("+station.stationcode+")"}}</li> i right ng-click="rowclick(station)" event when row click .but need set value whatever selected ..so first type "b" character in text field here code http://codepen.io/anon/pen/kpkyzw $scope.rowclick=function(station){ $scope.stationcode=station.stationcode; // $scope.$apply(); } thannks instead of giving stationcode, give search.stationcode model. problem scoping. stationcode setting in rowclick function not in same scope 1 expecting see modified code: http://codepen.io/anon/pen/zgypwj $scope.search.stationcode change made. initialised $scope.search = {};

javascript - Emoji's cause Express server to crash -

i trying create post emoji express endpoint: curl --data '{"x": 10, "y":10, "z":10, "message": "😋", "usertoken": "marine"}' --header "content-type:application/json" localhost:3000/api/messages for reason crashes server: syntaxerror: unexpected token @ object.parse (native) @ parse (/users/user/documents/uncovery/node_modules/body-parser/lib/types/json.js:84:17) @ /users/user/documents/uncovery/node_modules/body-parser/lib/read.js:102:18 @ incomingmessage.onend (/users/user/documents/uncovery/node_modules/body-parser/node_modules/raw-body/index.js:149:7) @ incomingmessage.g (events.js:199:16) @ incomingmessage.emit (events.js:104:17) @ _stream_readable.js:908:16 @ process._tickcallback (node.js:355:11) i went router , put console.log's in /messages endpoint see being received when express crashes result of sending emoji console.log never activated. ...

ios - How can I programmatically unwind 5 controllerViews without a navigation controller? -

i 5 views deep, there no navigation controller binding them. cannot use poptorootviewcontrolleranimated because have no navigation controller. go initial view controller of storyboard, , callback method available after dismiss complete? objective-c implementation implement function in appdelegate or in other util class - (void)custompoptorootviewcontroller { uiviewcontroller *topcontroller = [uiapplication sharedapplication].keywindow.rootviewcontroller; //if using method inside appdelegate write self.window.rootviewcontroller nsmutablearray *presentedviewcontrollers = [nsmutablearray array]; while (topcontroller.presentedviewcontroller) { [presentedviewcontrollers addobject:topcontroller.presentedviewcontroller]; topcontroller = topcontroller.presentedviewcontroller; } (uiviewcontroller *vc in presentedviewcontroller) { [vc dismissviewcontrolleranimated:yes completion:nil]; } } and in current view control...

c# - Reverse Bitwise operator -

i've had search, spent few hours of wasted time , can't simple bit shift in reverse :( dim result = value >> 8 , &hff i have existing code reads value (an uint16) file, bit shift it. trying reverse of can saved , read using existing code above. i've read in bit shifting , read great code project article may in latin. uint16 tt = 12123; //10111101011011 int aa = tt >> 8 & 0xff; //101111 = 47 8 bits disappeared. can never back.

javascript - pass imageURI to another html page -

i use phonegap create mobile app can select image album, , want pass image , show in html page. have idea how that? here code selectimage.html <!doctype html> <html> <head lang="en"> <meta charset="utf-8"> <title></title> <script type="text/javascript" src="cordova.js"></script> <script type="text/javascript" charset="utf-8"> var picturesource; var destinationtype; document.addeventlistener("deviceready", ondeviceready, false); function ondeviceready(){ picturesource=navigator.camera.picturesourcetype; destinationtype=navigator.camera.destinationtype; } function onphotourisuccess(imageuri){ window.location.href = "review.html"; var image = document.getelementbyid('image'); image.style.display = 'block';...

jquery - Slick Slider: How to set arrows inside and not outside? -

hi found slick slider easy use , decided use on website i've been working on: http://smallbuildersdev.esy.es/ you can see slider on bottom of page. have 1 problem. want arrows inside slider , not outside of (that means when content slides in, slides invisible hard edge). there way put arrows inside can occupy full width of page (so no hard edges when sliding visible)? here link slick slider: http://kenwheeler.github.io/slick/ if @ slick slider webpage left/right arrows outside slider. i think can change css style. .slick-prev { left: 100px; background: red; /*to notice it, white*/ } .slick-next { right: 100px; background: red; /*to notice it, white*/ }

performance - Very slow R loop -

i trying populate column follows: at t-1 : if nav(t-1) - hwm(t-1) >0 then @ t : hwm(t) = nav(t) otherwise: hwm(t) = hwm(t-1) my r skills quite elementary , following loop, though works, excruciatingly slow (150,000 observations) for (i in 1:length(e$hwm)) { print(i) hwm[e$t>2][i] <- ifelse( nav_lag1[e$t>2][i] - hwm_lag1[e$t>2][i] > 0 , nav_lag1[e$t>2][i] , hwm_lag1[t>2[i] ) hwm_lag1[i] <-lag(hwm,1)[i] } any suggestions make process more efficient? thank much. here have: zz <- "t nav hwm nav_lag1 hwm_lag1 1 1000 na na na 2 1200 1000 1000 na 3 1400 na 1200 na 4 1200 na 1400 na 5 1100 na 1200 na 5 1000 na 1100 na " here get: zz <- "t ...

php - CodeIgniter function not show? -

helper.website.php public function load_top_players() { $this->load->lib(array('rank_db', 'db'), array(host, user, pass,characters)); $query = $this->rank_db->query('select name, access users order access desc limit 5'); while($row = $query->fetch()) { $this->rank[] = array( 'name' => htmlspecialchars($row['name']), 'level' => (int)$row['access'] ); } return $this->rank; } view.header.php <?php $rank = load::get('website'); $i = 1; foreach ($rank $pos => $player) { $first = (in_array($i, array(1))) ? '' : ''; $second = (in_array($i, array(2))) ? '' : ''; echo '<tr style="'.$first.' '.$second.' '.$third.'"> <td >'.$i.'</td> <td>'.$player['name'].'</td> <td>...

angularjs - Modal Instance not resolving input -

i trying use angularui modal's , cannot seem figure out why not resolving variables. function opens modal , modal instance $scope.openmodal = function (size, cert) { var modalinstance = $modal.open({ template: 'modalcontent.html', controller: 'modalinstancectrl', size: size, resolve: { certs: function () { return $scope.certification; } } }); modalinstance.result.then(function () {}); }; modal controller stuff in here leftover debugging angular.module('myapp').controller('modalinstancectrl', ['$scope', '$filter', '$modalinstance', function ($scope, $filter, $modalinstance, certs) { console.log(certs); var results = $filter('filter')(certs, {id: id})[0]; $scope.cert = results; $scope.ok = function () { $modalinstance.close(); }; }]); the main issue when gets controller getting und...

parsing - Trying to run beautifulsoup4, nead help or suggest another way to parse website data -

i intalled python requests correctly (just dragged folder lib folder), went install beautifulsoup , kept getting error below. tried doing pip install, thought successful novice , bit confusing. *traceback (most recent call last): file "c:\python34\test.py", line 1, in <module> import bs4 file "c:\python34\lib\bs4\__init__.py", line 175 except exception, e: ^ syntaxerror: invalid syntax >>>* can simplify process or suggest better way gather data website. many thanks. the above code have python 2.x syntax , working python 3. either make mistake in installation or beautifulsoup setup have bug. i suggest uninstall , reinstall again using pip. make sure using pip version of python 3.

Setting up SSL in Java 6 (GlassFish 3 server) -

we have java web application running inside glassfish 3 web server. our application connects ldap server authentication. customer running ldap on ssl i.e ldaps . so fetched certificate ldap server , added our trusted certificate. still sometime gets: exception javax.net.ssl.sslhandshakeexception: sun.security.validator.validatorexception: pkix path building failed: sun.security.provider.certpath.suncertpathbuilderexception: unable find valid certification path requested target] further investigation ldap admin, words: "we added additional servers behind load balancer. if trust server cert instead of ca experiencing problem. should trust ca or should not perform certificate validation" which means there many ldap server running behind load balancer , each server has different certificate, , trust on 1 particular certificate. now resolution trust on ca , not on individual certificate. now @ point confused! is case can ca certificate , t...

xslt - delete consecutive nodes with same name -

i trying use xslt transform following xml: <level> <nextlevel> <note> text text text </note> </nextlevel> <nextlevel> <abc> </abc> <note>bla bla bla </note> <note>bla bla bla bla bla</note> <xyz> </xyz> </nextlevel> <nextlevel> <note> text text text </note> </nextlevel> </level> i want remove duplicate nodes "note" when appears twice consecutively. output should like: <level> <nextlevel> <note> text text text </note> </nextlevel> <nextlevel> <abc> </abc> <xyz> </xyz> </nextlevel> <nextlevel> <note> text text text </note> </nextlevel> </level> i using following xslt: <xsl:key name="dup" match="note" use=...

Java Word doc docx font -

i trying read font size of words in docx file in java. have used apache poi library convert file try read txt file. first of all, .docx documents, you'll need xwpf-library, , .doc hwpf - can't use 1 library both of them. here's code, reads .docx fontsize: public void readfontsizefromdocx() throws ioexception { inputstream = this.getclass().getclassloader().getresourceasstream("templates/examplefontsize.docx"); xwpfdocument doc = new xwpfdocument(is); (xwpfparagraph paragraph : doc.getparagraphs()) { (xwpfrun run : paragraph.getruns()) { system.out.println(run.getfontsize()); } } } also, take @ apache documentation - there many useful examples explain, how use it.

java - Getting error on files.readAllLines -

i working in android. reading file content, using method list<string> lines = files.readalllines(wiki_path); but whem using method getting error: the method readalllines(path) undefined type mediastore.files. why can compiler not find method? path wiki_path = paths.get("c:/tutorial/wiki", "wiki.txt"); try { list<string> lines = files.readalllines(wiki_path); (string line : lines) { if(url.contains(line)) { other.put(tag_title, name); other.put(tag_url, url); otherlist.add(other); break; } } } the method you're trying use member of java.nio.file.files - class (and indeed package) doesn't exist on android. if java 7 version existed, you're trying use method introduced in java 8. files class you've imported android.provider.mediastore.files entirely different class. even if compiled, path you're providing looks ever wind...

Finding values of A and B from an array so that addition or subtraction equals to 40 -

recently in interview asked question. given: a + or - b = 40 // can choose 1 operator + or - [list of numbers in array] explain how choose numbers , b given array make result 40 ? my answer: consider 1st element of array a, iterate through array start find possible values of b while process fetch each element array, sum , compare 40. but not happy. any other approaches ?

Chutzpah - is it possible to integrate chutzapah test running with visual studio build -

is possible integrate chutzapah test running visual studio build? mean here - if test fails build fails.. .that way.. i think have 2 ways of doing this: install chutzpah test adapter on each build machine , running tests in test explorer. then customize msbuild scripts run tests. use command line + custom msbuild task it looks chutzpah has command-line runner, can create powershell script gets called build server run tests. see chutzpah documentation more information, should chutzpah.console.exe under: chutzpah.3.2.4\tools next if want integrate visual studio build means msbuild integration. take @ exec task on how run custom commands , react based on results

java - Image not showing up in Swing? -

i don't know i'm doing wrong. (although i'm sure it's quite bit.) i've been trying adjust code hours no avail. i'm attempting cut pieces of picture , display them. later, randomize located , try place them in correct positions. now, however, i'm having issues having show on jpanel @ all. @ 1 point, test code displayed image. now, however, same test code doesn't work. if can see i'm doing wrong/where issue is, please let me know. it's simple , stupid. import java.awt.*; import java.awt.event.mouseadapter; import java.awt.event.mouseevent; import java.awt.geom.*; import java.awt.image.bufferedimage; import java.io.*; import java.util.*; import javax.imageio.*; import javax.swing.*; public class lab10 { /** * @param args command line arguments */ public static void main(string[] args) { myframe frame = new myframe(); mypanel panel = new mypanel(); frame.add(panel); panel.setfocusa...

c# - Entity Framework backup database - Operating system error 53 (The network path was not found.) -

i trying create backup using following code: public bool backupdatabase(string filename) { ministeriodeportesentitydatamodel modeloministerio = new ministeriodeportesentitydatamodel(); modeloministerio.database.executesqlcommand(transactionalbehavior.donotensuretransaction, @"backup database [db9ce858d6b9cb47658934a46901350226] disk = 'd:\users\octa8_000\documents\isw\backup' "); return true; } but returns following message: operating system error 53 (the network path not found) any ideas doing wrong?

widget - A simple way to show my hostname/ip in Gnome Panel or on my Desktop Background? -

hi searching while how can add app or widget show me output script or command "hostname --fqdn" on gnome panel or on desktop background... conky that, think simple shell output giplet ip , gnome panel , has no packages debian wheezy. i've many displays around 2000 in bigger area , running application, if application goes down normal desktop on top :) in case nice show hostname/ip adress engineering. you work out gnome shell extension. i wrote simple extension out on that. the extension.js file: const clutter = imports.gi.clutter; const main = imports.ui.main; const glib = imports.gi.glib; const command = "hostname --fqdn"; const font_size = 48; let stage_bg_color = clutter.color.get_static(clutter.staticcolor.chocolate_dark); let myactor = null; function run_command() { let output = ""; try { output = glib.spawn_command_line_sync(command, null, null, null, null); } catch(e) { throw e; } ret...

java - Creating a file download link using Spring Boot and Thymeleaf -

this might sound trivial question, after hours of searching yet find answer this. problem, far understand, trying return filesystemresource controller , thymeleaf expects me supply string resource using render next page. since returning filesystemresource , following error: org.thymeleaf.exceptions.templateinputexception: error resolving template "products/download", template might not exist or might not accessible of configured template resolvers the controller mapping have used is: @requestmapping(value="/products/download", method=requestmethod.get) public filesystemresource downloadfile(@param(value="id") long id) { product product = productrepo.findone(id); return new filesystemresource(new file(product.getfileurl())); } my html link looks this: <a th:href="${'products/download?id=' + product.id}"><span th:text="${product.name}"></span></a> i don't want redirected anywhe...

ibm - How to create Database connection in DataStage 8.5? -

i have simple datastage parallel job following: extract data source db transform 1 of columns specific format load target db my question: how establish db connection both source db , target db in datastage version 8.5? and need create new parameter sets? the basic information db name, instanace, user name, password, table name, insert method more sufficient. parameter sets keyed in when project / job explicitly defines use of it.

comparing two string arrays using java -

we trying compare 2 string arrays( as[ ] , bs[ ]) , update array string as[ ] new strings present in bs[ ] .we not able update as[ ].pls following codes.thank u;) public class aa { /** * @param args command line arguments */ public static void main(string[] args) { // create array of 4 strings (indexes 0 - 3) string as[] = new string[5]; string bs[] = new string[16]; int i; try { // create bufferreader object read our file with. bufferedreader reader = new bufferedreader(new filereader("input.txt")); bufferedreader reader1; reader1 = new bufferedreader(new filereader("a1.txt")); // line hold our line read file string line = ""; string line1 = ""; // counter keep track of how many lines have read int counter = 0; int counter1 = 0; // read in line file , store in "line". while don't hit null or while counter ...

validation - check for validity of URL in java. so as not to crash on 404 error -

essentially, bulletproof tank, want program absord 404 errors , keep on rolling, crushing interwebs , leaving corpses dead , bludied in wake, or, w/e. i keep getting error: exception in thread "main" org.jsoup.httpstatusexception: http error fetching url. status=404, url=https://en.wikipedia.org/wiki/hudson+township+%28disambiguation%29 @ org.jsoup.helper.httpconnection$response.execute(httpconnection.java:537) @ org.jsoup.helper.httpconnection$response.execute(httpconnection.java:493) @ org.jsoup.helper.httpconnection.execute(httpconnection.java:205) @ org.jsoup.helper.httpconnection.get(httpconnection.java:194) @ q.wikipedia_disambig_fetcher.all_possibilities(wikipedia_disambig_fetcher.java:29) @ q.wikidata_q_reader.getq(wikidata_q_reader.java:54) @ q.wikipedia_disambig_fetcher.all_possibilities(wikipedia_disambig_fetcher.java:38) @ q.wikidata_q_reader.getq(wikidata_q_reader.java:54) @ q.runner.main(runner.java:35) but can't understand why because am checking...

ios - Is it possible to disable infinite scrolling in UIDatePicker? -

i need create uidatepicker in date mode user cannot scroll uidatepicker infinitely. have tried set min , max date in link how disable infinite scrolling in uidatepicker? here code: nscalendar *calendar = [[nscalendar alloc] initwithcalendaridentifier:nscalendaridentifiergregorian]; nsdate *currentdate = [nsdate date]; nsdatecomponents *comps = [[nsdatecomponents alloc] init]; [comps setyear:2015]; nsdate *maxdate = [calendar datefromcomponents:comps]; [comps setyear:1914]; nsdate *mindate = [calendar datefromcomponents:comps]; [datepicker setmaximumdate:maxdate]; [datepicker setminimumdate:mindate]; but uidatepicker still infinite scrolling, avoid date out of min-max date. possible disable infinite scrolling in uidatepicker? setting maximumdate , minimumdate possibility customize behavior of uidatepicker . if not suits requirements, can create own custom date picker, based on uipickerview or find 3d party, example that @ github

opencv - Dense SIFT Bag of Features -

i trying dense sift feature extraction bag of features (bof) using opencv. idea follow this tutorial little change use dense sift features instead. as know, first part in bof paradigm, create visual dictionary. code modification goes this: #include<iostream> #include<vector> #include<dirent.h> #include <opencv2/imgproc/imgproc.hpp> #include <opencv2/core/core.hpp> #include <opencv2/features2d/features2d.hpp> #include <opencv2/nonfree/features2d.hpp> #include <opencv2/highgui/highgui.hpp> #include <opencv2/nonfree/nonfree.hpp> // dense sampling of sift descriptors. using namespace std; using namespace cv; void dense_sift_bow(mat img_raw, mat &featuresunclustered); void sift_matcher(mat img_raw, mat &dictionary, mat &bowtry, ptr<descriptormatcher> &matcher); #define dictionary_build 0 int main() { #if dictionary_build == 1 initmodule_nonfree(); // store detected image key points. ...

Android writing file issue while setting song as Ringtone -

Image
i have written program set song ringtone, facing small issue when tap on button first time set song ringtone, getting this: but when click on button again (second time), getting this: so reason ? why never success in first time... here complete code of ringtoneactivity.java : public class ringtoneactivity extends activity { private final context context = this; private static final string tag = "meri desi look"; private file sound; private final file folder = environment.getexternalstoragepublicdirectory(environment.directory_ringtones); private mediaplayer mediaplayer; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); button buttonringtone = (button) findviewbyid(r.id.btnringtone); buttonringtone.setonclicklistener(new onclicklistener() { @override public void onclick(view v) { ...

windows - Problems writing a WSUS-Program in AutoIt using Powershell -

i new wsus, powershell , autoit. writing program approve multiple updates few clicks (instead of 5 clicks per update , group). therefore have powershell-script searches computer-groups , available updates. the scripts aher working, have problems calling them in autoit (as found out, have import module updateservices can´t working). here 1 part of autoit-program: $scomsend = '-executionpolicy bypass import-module updateservices; ' & $sscript & '\search_updates.ps1 -filepath ' & $supdateoutput shellexecutewait("powershell.exe", $scomsend) but doesn´t work. try this: $scomsend = 'powershell.exe import-module updateservices; "-executionpolicy bypass ' & $sscript & '\search_updates.ps1 -filepath ' & $supdateoutput & '"' runwait(@comspec & " /c " & $scomsend, "", @sw_show , $stdout_child) but didn´t work. honest, in second one, don´t know of these parameters mea...

php - Syntax error, concatenate string inside array -

in user model file want define rules validation. public function getuserid(){ return auth::id(); } private $rules = array( 'name' => 'required|alpha|max:255', 'email' => 'required|email|max:255|unique:users,email,' . $this->getuserid(), ); i fatalerrorexception in user.php line 162: syntax error, unexpected '.', expecting ')' i have included: use auth; you should fill $rules in method __construct. dangerous use $this in declaration, since object may not exist...

php - How to get values from two table with subqueries? -

i have 2 tables names feed, , friendship.... friendship table has these fields..toid session user id, fromid friend id, , status may 0 or 1, , feed table contains id,post_user_id feed poster id, , contents. want feed feed table friends able feeds friends can't own feed , when put own id in condition query executed result empty. tried these select * feed `post_user_id` in (select fromid gr_user_friendships toid = 47) order post_date_time desc /****this query giving friends records not mine records put own id in condition agains****/ select * feed `post_user_id` in (select fromid gr_user_friendships toid = 47) , `post_user_id` = 47 order post_date_time desc /*this time results empty**/ i tried inner join no success @ all try: select * feed post_user_id = 47 or 'post_user_id' in (select fromid gr_user_friendships toid = 47) order post_date_time desc

jquery - Datepicker trouble -

hi cant datepicker work? can me work, dosent when click on it! and site i'm trying make example. link: http://jsfiddle.net/jasenhk/4g9u5/ head: <head> <!--bootstrap stylesheet--> <link rel="stylesheet" href="css/bootstrap.min.css"> <!--bootstrap scripts--> <script src="js/bootstrap.min.js" type="text/javascript"></script> <!--custom stylesheets--> <link rel="stylesheet" type="text/css" href="css/style.css"> <!--custom scripts--> <script src="http://code.jquery.com/jquery-latest.min.js"</script> <script> $(document).ready(function() { $(".date-picker").datepicker(); $(".date-picker").on("change", function () { var id = $(this).attr("id"); var val = $("label[for='" + id + "']").text(); $("#msg").text(val + ...

sorting - Filter by array of values on Excel -

Image
i have question filtering rows in excel. i have large table, on 10 000 rows. each row has unique id . duplicated table , made modifications on rows , highlighted them. the thing need select rows based on array of values of unique id . (the id field this: 1, 2, 3, 4, 5,.., 10500 ) form unmodified copy of first excel table. i demonstrating following sample data.      the predominantly blue table in a1:d16 listobject named mytable . predominantly green table in f3:i13 listobject named mytable_copy . to filter mytable listobject based on id 's found in id column of mytable_copy , need construct array of id numbers strings. function can used that. remember filter expecting array of strings integers, not true integers. if have special number formatting leading zeroes, function have changed accommodate that. tap alt + f11 , when vbe opens, use pull-down menus insert ► module ( alt + i , m ). paste following new module code sheet named book1 - module1 (code) . ...

javascript - Angularjs: Load tabs based on active tabs but prevent rendering on visited tabs -

i have page having 8 tabs , each tab has lot of html controllers(data bindings).so data rendering becomes slow. used ng-if condition based on active tab found using ng-click on tab. active tab made visisble using css class. after using ng-if condition default tab gets loaded fast , on subsequent click on tab each tab gets loaded.but if again click on tab loaded again reloaded due ng-if condition. if dont use ng-if condition based on active tabs intial load of page slow navigating between tabs faster due entire tabs loaded @ begining.but method not efficient page load slow @ begining. want load tabs based on active tabs shown below.but dont want reload or render tab again tabs loaded once. how can done? <div class="claimant-data-nav " ng-controller="mycontroller"> <ul class="nav nav-tabs "> <li ng-repeat="tabname in mylist | unique:'tabname'" ng-class="{'active':tabname.tabname == 'tab1...

zsh: command not found: gulp -

i've installed zsh homebrew , changed shell it. i'm having problem when trying run gulp command, worked before changed shell zsh. zsh: command not found: gulp a bit of research leaves me believe has path. path looks .zshrc file. export path="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin" i want installed node brew. how can use gulp zsh without changing default shell? any appreciated. in advance! there no need - , bad idea - set path literal value in ~/.zshrc . in doing so, may remove directories have been added path . in case, worked shell, first try remove line set path zsh should inherit path own parent environment. if not add path containing gulp (probably because added in configuration of old shell), can add path=$home/.node/bin:$path to ~/.zshrc . note: path part of environment, there no need export again. generally, if want add path can use: path="/something/new/bin:$path" this prepends /something/new/bin...

dataframe - r data.table summarizing using more than one factor -

i have below data.table 'data.frame': 66977 obs. of 16 variables: $ subs : int $ city : factor w/ 18 levels $ value_seg : factor w/ 7 levels $ region : factor w/ 5 levels $ sum.data_ppu_rev_dec. : num $ sum.data_bundle_rev_dec. : int $ sum.data_usage_total_kb_dec. : num $ sum.this_month_rev_dec. : num $ sum.voice_onnet_duration_dec.: num $ sum.voice_onnet_rev_dec. : num $ sum.voice_offnet_rev_dec. : num $ sum.sms_onnet_rev_dec. : num $ sum.sms_offnet_rev_dec. : int $ sum.recharge_dec. : int $ status_dec : factor w/ 5 levels $ type_dec_2 : factor w/ 6 levels i want group 2 of factor variables let's value_seg & region, sum number , create new coulm each factor variable count of observations. tryied aggregate, ddply , others varians type of errors :( in...