Posts

Showing posts from March, 2010

Python - getting multiple URLs -

i'm coding api endpoint, can think aggregator of other apis. send parameters , translate parameters underlying api's parameters , makes calls. ideally wouldn't want make these calls in serial manner. what best way this? edit: suspected, threads or processes isn't way go when thing you're trying getting urls. because of time spent waiting network reply, want change manage changing between tasks waiting tasks doing requests. because of this, think answers exist similar question bad answers. after research, far can tell single-threaded asynchronous code better answer threads specific case of getting several urls, , case of many many urls: there's twisted, framework: http://twistedmatrix.com/documents/14.0.1/web/howto/client.html and gevent, library: http://sdiehl.github.io/gevent-tutorial/ simple example http://mauveweb.co.uk/posts/2014/07/gevent-asynchronous-io-made-easy.html , doing 100 calls using pool of 20: from gevent import monkey mo...

c# - How do I stop the rotation of my gameobject when it reaches a certain point on its y-axis? -

i'm working on simple baseball game. i'm trying have player able swing bat backwards "charge up" power, speak, , when button released swing bat forward @ speed equal amount of power stored up. this , good, problem need stop motion of bat when reach point on y-axis, , i'm bit unsure how go doing cannot tell stop rotating after set time bat won't reach front point @ same time every time due difference in speed each swing might have. what i'm trying if(reached 266 on y-axis stop rotating) , i'm unsure of how this. anyway here code i've written far: public int rotatespeed = 50; public float amountofpowerchargedup = 0; void update() { if (input.getmousebutton(0)) { amountofpowerchargedup += 5f; transform.rotate(vector3.up * rotatespeed * time.deltatime); debug.log(amountofpowerchargedup); } if (!input.getmousebutton (0)) { transform.rotate(vector3.down * amountofpowerchargedup * t...

Recursive Depth First Search (DFS) algorithm in C++ -

Image
i've implemented graph in class graph adjacency matrix required functions access , modify it, ones needed in dfs algorithm // graph x, node v string x.get_node_value(v) //returns the label of node queue x.neighbors(v) //returns queue adjacent nodes node v (nodes index on graph starts 1) now tried implement recursive dfs stuck @ point, never recurse after calls again, works , finds goal if exists on path before reaches leaf node, stops after reaching leaf node it keeps track of nodes indicating colors, unvisited node white, node in progress grey, node done (visited , children visited) black. here's kickoff function: int search::dfsr(const std::string search_key, graph& x, int starting_node){ color * visited_nodes = new color[x.size()]; for(int i=0; i<x.size(); i++){visited_nodes[i] = white;} bool goal_f = 0; int goal = dfsutil(search_key, x, starting_node, visited_nodes, goal_f); if(goal_f) return goal; else return -1; } and here...

Formatting Excel cell from number to text in rails -

i have made application on have provide feature import records csv , excel file. using roo gem it. record added problem @ time of importing records excel, adds .0 every field number. don't want because have fields enrollment_no, roll_no, contact_no , adds .0 every filed made 23 23.0. had converted these filed varchar in database , want format excel cell number text. solve problem. tell me how format excel cell number string using rails. here code importing file: student.rb : def self.import(file, current_organization_id) spreadsheet = open_spreadsheet(file) header = spreadsheet.row(1) (2..spreadsheet.last_row).each |i| row = hash[[header, spreadsheet.row(i)].transpose] record = student.find_by(:organization_id => current_organization_id,:enrollment_no => row["enrollment_no"]) || new record.organization_id= current_organization_id record.attributes = row.to_hash.slice(*row.to_hash.keys) record.save! end end def self.open_spread...

linux - Find fails to find files below 1M but works fine with 'k' units -

i have created file named 1.txt , 9kb in size: stat 1.txt file: `1.txt' size: 9322 blocks: 24 io block: 4096 regular file access: (0600/-rw-------) uid: ( 0/ root) gid: ( 0/ root) access: 2015-06-26 10:12:47.000000000 +0100 modify: 2015-06-26 10:12:47.000000000 +0100 change: 2015-06-26 10:12:47.000000000 +0100 when run find command option -size -100k k units, file found: #find . -type f -size -100k #./1.txt when use m units , -size -10m file still found: #find . -type f -size -10m #./1.txt but when try find files less 1m in size, find doesnt find file: #find . -type f -size -1m # and yes, version of find ( find (gnu findutils) 4.4.0 ) supports m unit. i believe because units represented integers, , "less 1" 0, searches files 0megs in size. counter intuitive sure, retained backward compatibility distant past.

javascript - JQuery basic questions -

i'm making dropdown menu using code this site . provides jquery code. presume added html file, before closing body tag. i've test in browser on computer, doesn't work – hamburger icon isn't clickable i've created js fiddle here http://jsfiddle.net/2jp93xo5/ this html file <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel=stylesheet href="css/master.css"> </head> <body> <div class="mobile-nav"> <div class="menu-btn" id="menu-btn"> <div></div> <span></span> <span></span> <span></span> </div> <div class="responsive-menu"> <ul> ...

c++ - std::u32string conversion to/from std::string and std::u16string -

Image
i need convert between utf-8, utf-16 , utf-32 different api's/modules , since know have option use c++11 looking @ new string types. it looks can use string , u16string , u32string utf-8, utf-16 , utf-32. found codecvt_utf8 , codecvt_utf16 able conversion between char or char16_t , char32_t , looks higher level wstring_convert appears work bytes/ std::string , not great deal of documentation. am meant use wstring_convert somehow utf-16 ↔ utf-32 , utf-8 ↔ utf-32 case? found examples utf-8 utf-16, not sure correct on linux wchar_t considered utf-32... or more complex codecvt things directly? or still not in usable state , should stick own existing small routines using 8, 16 , 32bit unsigned integers? if read documentation @ cppreference.com wstring_convert , codecvt_utf8 , codecvt_utf16 , , codecvt_utf8_utf16 , pages include table tells can use various utf conversions. and yes, use std::wstring_convert facilitate conversion between various utfs. de...

How to convert .docx file into .doc file with PHP? -

i want read text .docx file line line , keep each line data in array, since .docx zipped file want convert .doc file can read file using @fopen($filename, 'r'); . below code tried using phpword conver .docx .doc , <?php require_once 'phpword/phpword.php'; $phpword = new phpword(); $document = $phpword->loadtemplate('basictable.docx'); // save file $objwriter = phpword_iofactory::createwriter($phpword, 'word2007'); $objwriter->save('basictable4.doc'); ?> and creates erroneous .doc file. if want text out of .docx file , save text file can use library docx2text after converting text file can read text file line line , keep each line data in array.

rpm spec - Is it safe to verify the RPM that has just been installed from a %posttrans? -

i know non-standard, it's intended overcome short term problem proprietary distribution. because there dependencies unique our deployment systems, have compile libraries %post. because failing here result in corruption rpm database, fail silently or put more accurately, fail :-/ using %verifyscript, able verify if compilation incomplete , exit appropriately. idea can this: rpm -uvvvh proprietary-dist-1.0-2.i686.rpm rpm --verify proprietary-dist || rpm -uvvvh proprietary-dist-1.0-1.1686.rpm or this: rpm -uvvvh proprietary-dist-1.0-2.i686.rpm rpm --verify proprietary-dist || rpm --rollback proprietary-dist however, making use of %posttrans, figured simplify down to: rpm -uvvvh proprietary-dist-1.0-2.i686.rpm || rpm --rollback proprietary-dist it seems unclear documentation whether exiting non-zero %posttrans safe , won't cause rpmdb corruption - well, @ least documentation says shouldn't exit non-zero pre-dates when %pretrans , %posttrans introduced. i ...

javascript - AngularJS resetting array of arrays -

i asked question similar , tried solution worked no luck. pretty simple problem. have following : <script type="text/javascript"> 'use strict'; var app = angular.module('app', ['appcontrollers']); "use strict"; var appcontrollers = angular.module('app', []); appcontrollers.controller('personcontroller', ['$scope', '$http', function ($scope, $http) { $scope.responses = [[], [], []]; $scope.addcoach = function() { $scope.responses[0].push($scope.coach.name); }; $scope.addathlete = function() { $scope.responses[1].push($scope.athlete.name); }; $scope.addsupportstaff = function() { $scope.responses[2].push($scope.employee.name); }; so i'm trying add list of coaches, athletes , supporting staff respective arrays within array when check console log of $scope.responses shows added one. edit: so i've changed code following: <script type="text/javascript"> 'use strict...

mysql - Sql query to Add non digit values of multiple columns into a single column and find the count -

i have 1 table 2 columns this column1| column2 | b | c d | d the out put of query expect : name | count | 2 b | 1 c | 1 d | 2 it easy sum two(values) how concatenate nonvalues inside table. the query tried: select column1 name table union select column2 name table i combined version of 2 columns how suuposed count(name) ? this work perfectly.. select t.name, count(t.name) count ( select `column1` name table union select `column2` name table ) t group t.name

javascript - How to display image with fancybox href attribute -

i trying show image fancybox 1.3 . have managed base64 coding, worked charm. now, want retrieve image through servlet. if put url image src attribute, shows image, if put url href attribute, when click on picture shows this: http://i.imgur.com/oqxruxc.png i set response content type correctly. can problem? here's example display base64 image fancy box you don't need <a> tag <div class="content"> <img src="data:image/gif;base64,/9j/4aaqskzjrgab...." alt="social media" > <img src="data:image/gif;base64,/9j/4aaqskzjrgab...." alt="james bond;" > </div> jquery $('.content').on('click', 'img', function (e) { var target= $(this).attr("src"); var imgtitle= $(this).attr("alt"); $.fancybox({ 'overlayshow': true, 'href': target, 'titlepositio...

flex - Sound object in actionscript 3 -

simply trying load sound using url. not loading.... trying debug this. getting different thing. sound object getting bytesloaded value 15903 but the bytestoal value 0 is possible come this??? i think sound url may wrong. getting url? local or db? please check url... sound not available, trying load means come this. don't know correct or not... try confirm url....

I am really confused about NEW keyword use in C# and MVC -

what know new follows 1) when creating object in class ,array list etc example: public class employee { public int id {get;set;} public string name{get;set;} } } public static main(){ var emp n = new employee; } 2) modifier public class basec { public static int x = 55; public static int y = 22; } public class derivedc : basec { // hide field 'x'. new public static int x = 100; static void main() { // display new value of x: console.writeline(x); // display hidden value of x: console.writeline(basec.x); // display unhidden member y: console.writeline(y); } } /* output: 100 55 22 */ but going show scenario feel difficult how new key word implementing here . think first new word used create manager object use of second new or (new userstore<applicationuser> . ccould explain please. var manager = new applicationusermanager(new userstore<applicationuser>(context.get<app...

php - How to get last word of the URL (Laravel 5.1) -

this question has answer here: deprecated: function split() deprecated. how rewrite statement? 4 answers i want last word of url: http://localhost:8888/articles/tags/europa how make in laravel ? {{url::current()}} i'm getting full url. have tried {{url::current().split('/').last}} error: function split() deprecated try , use preg_split() instead example: $var = 'http://localhost:8888/articles/tags/europa'; $var = preg_split("/\//", 'http://localhost:8888/articles/tags/europa'); array_pop($var ); //removes last update i can't delete because accepted answer please see josh088's answer

css - Changing default HTML Tags in Sublime Text 3 -

i wanted ask, if there way, edit default tags come sublime text 3. for example: when type <style , hit enter, sublime outputs me <style type="text/css"></style> , want <style></style> , without type="text/css" , because want have slimmer, type attribute not needed anymore in html5. thanks in advance. you create snippet (tools > new snippet...) <snippet> <content><![cdata[ <style>$1</style> ]]></content> <!-- optional: set tabtrigger define how trigger snippet --> <tabtrigger>sty</tabtrigger> <!-- optional: set scope limit snippet trigger --> <scope>text.html</scope> </snippet> then save style.sublime-snippet in /packages/user folder. it can called typing sty + tab . note: <scope> element restricts executed on html files (or files syntax set html)

c# - Retrieve data SQL database and display in Gridview on website in Visual Studio 2013 -

i have created website replicates google. search bar allows customers find out if have product require. the customer searches product on website. query sent sql results displayed on website in grid (could multiple items) i using visual studios build this. have no idea how grab data database create connections , bring results. i'm new , apologise if has been asked. the steps take implement sql connection when button clicked or whatever requirement sql guide sqlconnection myconnection = new sqlconnection("user id=username;" + "password=password;server=serverurl;" + "trusted_connection=yes;" + "database=database; " + "connection timeout=30"); add gridview page in required position, , set datasource result datareader tutorial here string strsqlconnection = "data s...

javascript - Automatic Image zoom with easy and out -

can me how can on page: marriottgrandcaymanbeachhouse.com i want on website automatic zoom of images without hover or click. ease , out zooming function infinite. i use class don`t know how activate it. .zoom.visible > img { -webkit-animation-duration: 30s; animation-duration: 30s; -webkit-animation-fill-mode: both; animation-fill-mode: both; -webkit-animation-iteration-count: infinite; animation-iteration-count: infinite; -webkit-animation-name: move; animation-name: move; animation-direction: alternate; -moz-animation-direction: alternate; -webkit-animation-direction: alternate; -o-animation-direction: alternate; -ms-transform-origin: middle center; transform-origin: middle center; -webkit-transform-origin: middle center; -o-transform-origin: middle center; -moz-transform-origin: middle center; } unfortunately dont`t know search in google , hope can push me in right direction or has code example me. copying necessary pa...

python - TK, understanding pack and expanding space -

Image
i have window resizeable, want have 2 listboxes scroll bars expand fill space available. when have 1 listbox packed fill=both, expand=1, side=left , 1 scrollbar packed fill=y, expand=0, side=right expand horizontally, though set fill both directions. when resize window, listbox fill sides. bottom of window remain empty. then moved on add listbox. instead of packing scroll bar on right, packed left, stacked. listboxes continue have fill=both, expand=1 . when resize window both list boxes fill vertically! horizontal space remains empty. what going on? why ignore vertical space 1 element packed left , right? , why refuses fill horizontally when stacked left? the fact once fill vertical or horizontal space leads me believe parent frame expanding fine... or should investigate more well? without seeing actual code it's impossible know you're doing wrong. here's example prove pack works documented: import tkinter tk root = tk.tk() lb1 = tk.listbox(ro...

ios - UITableView Cells shifting positions or disappearing entirely on scroll -

Image
i developing , application iphone in swift, , have run peculiar error: in 1 of uitableviewcontrollers,enter code here cells disappear or change sections when scroll , down on table view. i've been dealing issue few days now, , has prompted me recode entire class, no avail. have researched extensively on error, , believe has data source , how tableview handles it, , have noticed other users have had same problem before, cannot find solution applies problems. for example, here seems deal cell height, have continued check , double check code, , cell height returns correct values. in addition, this post talks different errors tableview's data source, have strong pointer datasource's alert array , content , heights correct in cellforrowatindexpath. this post deals question, doing tableview on main thread. currently tableview has 4 sections: first, second, , fourth contain 1 cell , third has dynamic amount of cells based on amount of alerts user has added (for ex...

javascript - JS Regex to replace all html tags -

i have spent while researching , cant find solution, looking method remove html tags string , if img tags appear, replace them src attribute, sorry little information. thanks. i think might need: var str = "<b>test</b> <p><img src='path.png' /> boom <span>sss</span></p>"; var text = $(str).find('img').replacewith(function() { return $(this).attr('src'); }).end().text(); alert(text); <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>

github - I moved all my project files with "git mv", but I have lost all my history. Why? -

as per question ( git: want refactor codebase, , create new files structures , move things around. git history maintained? ) refactored project, , moved of files using "git mv" command. after committing refactoring work, @ bitbucket repo, , when @ history of of files moved... have recent refactoring commit. history every file moved no longer present. why this? commits file has been moved can found by git log --follow <some path moved file> see more @ is possible move/rename files in git , maintain history?

html - Unable to create box shadow on li pseudo element -

i trying create box shaadow on image somehow unable create one. using :after pseudo element it: html :: <ul class="bxslider fade out"> <li> <img src="http://unilaboralgirona.com/wp-content/uploads/2015/03/zcontact.jpg" /> </li> </ul> css :: .bxslider { margin: 0; padding: 0; } .bxslider li { position: relative; } .bxslider li:after { width: 100%; height: 30px; ; position: absolute; top:100%; left: 0; -webkit-box-shadow: 2px 2px 2px rgba(0, 0, 0, 1); box-shadow: 2px 2px 2px rgba(0, 0, 0, 1); } .bxslider li img { width: 100%; max-width: 300px; } fiddle here now ofcource since img does't support pseudo elements adding shadow li element, still see no shadow , don't understand why ? can explain? in console in ff, no pseudo elements shown. p.s. reason using pseudo elements because box-shadow has less 10...

android - Check already connected SSIDs, and notify if it's not connected automatically. -

i turn on wifi. android/iphone remembers att-wifi, boingo-hotspot, goesh, , number of other ssids have connected. automatically connects whenever sees 1 such, , stuck in app because did not log in through captive portal. is possible detect if phone in wifi, , if connection not established, prompt user check if hotspot? any pointer or direction helpful!

ruby on rails - Chain list of calls on an object, then return the modified object -

i have rails object, namely order . have list of calls need call on object: [:address, :number] . chain these methods on given object, , return result. so, end value above equal call to: obj.address.number . currently, i've done using: obj = order.first [:address, :name].each { |m| obj = obj.send(m) } puts obj but feel there best way of achieving using more "ruby" approach. you use ruby#inject achieve result_object = [:address, :name].inject(order.first, :send) puts result_object it analogous to order.first.address.name

ruby - How to syntactically call a method that takes a block in another method? -

so i'm new ruby , i'm looking make code little neater , cleaner looking. have these methods in class. made reverse polish notation calculator. know in theory "don't repeat yourself" can see in plus minus divide , times methods do. thing changes +, -, /, *. i'm wondering best way go fixing that? start, here's code. of thoughts below. class rpncalculator def initialize @calculator = [ ] end def push(num) @calculator << num end def plus value = @calculator[-2].to_f + @calculator[-1] @calculator.delete_at(-2) @calculator.delete_at(-1) @calculator << value end def minus value = @calculator[-2].to_f - @calculator[-1] @calculator.delete_at(-2) @calculator.delete_at(-1) @calculator << value end def divide value = @calculator[-2].to_f / @calculator[-1] @calculator.delete_at(-2) @calculator.delete_at(-1) @calculator << value end def times value = @calculator[-2].to...

select element with jquery using a criteria on element child class -

i have dom : <div class=main> <div class="child"></div> </div> <div class=main> <div class="child b"></div> </div> <div class=main> <div class="child"></div> </div> <div class=main> <div class="child b"></div> </div> i select jquery main div element has child without class "b". getting first , third element. have done , it's not working, returns me elements : $(".main").not(".b") i have tried this, throws me exception "invalid token" : $(".main").not(":.b") thanks in advance you need use combine :not , :has selector: $('.main:not(:has(".b"))'); or find child element not have class b , traverse such elements parent using .parent() selector: $('.child:not(".b")').parent()

How to properyly change permissions for Absences in Project-Open -

we have problem absences: a user created absence can not edit absence after wards :( after user's absence approved he/she can still delete absence :( how set permissions absences? i found file packages/intranet-timesheet2/tcl/intranet-absences-procs.tcl which contains permission matrix im_absence_new_page_wf_perm_table unfortunately permissions not effective - restart of project-open causes permissions active. a better solution desired - @ least works :/

plot - Initialize y-axis to be centered at 0 -

i'm generating line plots show percent error results. nice if y-axis centered @ 0 when plots first load. know can manually set bounds y-axis, tedious have set them manually each figure. is there way set figures center @ 0 along y-axis? here's code may provide additional details - from bokeh.plotting import figure, output_file, show bokeh.io import gridplot, hplot # prepare data x = [1, 2, 3, 4, 5] y1 = [-10, -9, 23, 4, -6] y2 = [-15, -4, 26, 32, -45] y3 = [-42, -20, -13, -34, -59] y4 = [-23, -34, -32, -43, -53] # output static html file output_file("lines.html", title="line plot example") # create new plot title , axis labels p = figure(title="simple line example", x_axis_label='x', y_axis_label='y') p.line(x, y1, line_width=2) p.line(x, y2, line_width=2) p2 = figure(title="simple line example", x_axis_label='x', y_axis_label='y') p2.line(x, y3, line_width=2) p2.line(x, y4, line_width=2) p = ...

java - Sharing an Array between OnClick classes in Android Studio -

i'm writing code takes input user, , user either clicks "enter activity" button or "done" button. i'm taking information within enteranotherbutton onclicklistener, need able transfer information donebutton onclicklistener send activity via intent. here's current code: public class entercourseactivity extends actionbaractivity { private mainactivity ma; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_enter_course); buttonclick(); } public void buttonclick () { button enteranotherbutton = (button) findviewbyid(r.id.enteranotherbutton); enteranotherbutton.setonclicklistener(new view.onclicklistener() { int = 1; public void onclick(view view) { edittext coursename; coursename = (edittext) findviewbyid(r.id.inputcoursename); string coursenamestring = coursename.gettext().tostring(); ...

regex - Translate Go Regexp to Javascript -

how go regexp translate javascript? "[\\w!#$%&'*+/=?^_`{|}~-]+(?:\\.[\\w!#$%&'*+/=?^_`{|}~-]+)*@(?:[\\w](?:[\\w-]*[\\w])?\\.)+[a-za-z0-9](?:[\\w-]*[\\w])?" there has better way you're doing monstrosity of pattern. regular expressions tend pretty portable. should drop regex tester (google it) or script file , see if matches expect. if don't, rebuild regex in chunks , see piece causes fail.

C# URL Handling to allow either separate sites or virtual directories? -

i've got question more own learning experience i've found solution, or 2 more specific. the issue have web service connect application, web service can deployed different ways, ie, iis virtual directories, or separate sites. obviously, these have impact on url. url in case gets pulled configuration file wherever application installed, application has able handle whatever gets pulled there. i wrote quick chunk in sample console example. first method doesn't work in case of virtual directories issue arises. other 2 methods return correct result, i'm curious, if there reason why 1 wouldn't replace string on using lastindexof, , if maybe there's solution? uri sitenameurl = new uri("http://sitename.test.com/packagedlservice.aspx"); console.writeline(string.format("url scenario 1: {0}",sitenameurl)); string path = sitenameurl.getleftpart(uripartial.authority); string uristr = string.format(@"{0}/sitename/packages/{1}/currentpackage....

go - Is this syntax a pointer to a slice or a slice of pointers? -

after looking @ this blog post , still unclear whether following syntax means slice of pointers or pointer slice. foo []*int which 1 it, , general rule of thumb case? this slice of pointers, read left right: ( [] ) slice of ( * ) pointers ( int ) integer. on other hand, *[]int ( * ) pointer ( [] ) slice of ( int ) integers.

R: Use function to define variables inside data-set -

i want see how model performs when make variable 'year' piecewise linear. know there automatic methods define within model , best cut-point. still, prefer making piecewise variable more transparant me , in addition, think solution problem can on other occasions well. so want make variables defined like year1997up<-0 year1997up[year>1997]<-year[year>1997]-1997 year1997up[year<=1997]<-rep(0,sum(year<=1997)) year1997down<-0 year1997down[year<1997]<-year[year<1997]-1995 year1997down[year>=1997]<-rep(2,sum(year>=1997)) so year piecewise divided cut-point 1997. i want years 1997 till 2011 , automate process, wrote function: piece.var.fun<-function(up,down,i,data){ within(data,{ up<-0 up[year>=i]<-year[year>=i]-i up[year<i]<-rep(0,sum(year<i)) down<-0 down[year<=i]<-year[year<=i]-1995 down[year>i]<-rep(i-1995,sum(year>i)) }) } test.dataset...

javascript - Accessing a "parent" functions' variable -

in javascript there way have mod() modify a? want do: function whatever(){ var a=0; mod(a); var amodded=a; } function mod(obj){ obj++ a=obj; } at end of whatever() want 'amodded' =1. there way without declaring 'a' outside of , functions? 1. make mod such changes [properties of] a directly: function whatever (){ var = {value: 0}; mod(a); var amodded = a.value; } function mod(obj){ obj.value++; } http://jsfiddle.net/derekl/2jl0we41/ 2. make mod such returns new value: function whatever (){ var = 0, amodded = mod(a); } function mod(obj){ return ++obj; } http://jsfiddle.net/derekl/jv9ya841/

LibGit2Sharp fetching error "Too many redirects or authentication replays" -

i receive error “too many redirects or authentication replays” when trying fetch libgit2sharp tfs server. i've tried solutions in article below , none seem working. libgit2sharp: fetching fails "too many redirects or authentication replays" code using defaultcredentials(): credentialshandler credhandler = (_url, _user, _cred) => new defaultcredentials(); var fetchopts = new fetchoptions { credentialsprovider = credhandler }; using (var repo = getrepository()) { remote remote = repo.network.remotes["origin"]; repo.network.fetch(remote, fetchopts); } // using

objective c - how to write block with arg. "UnsafeMutablePointer<UnsafeMutablePointer<Float>>" in Swift closure -

please syntax: __weak typeof (self) weakself = self; [self.audiofile getwaveformdatawithcompletionblock:^(float **waveformdata, int length) { [weakself.audioplot updatebuffer:waveformdata[0] withbuffersize:length]; }]; the waveform data array of float arrays, 1 each channel, , length indicates total length of each float array. @param waveformdata array of float arrays, each representing channel of audio data file @param length int representing length of each channel of float audio data in swift have: cell.audiofile.getwaveformdatawithcompletionblock { (unsafemutablepointer<unsafemutablepointer<float>>, int32) -> void } i stuck on unsafemutablepointer> i need use arg. in: cell.audiowaveview.updatebuffer(buffer: unsafemutablepointer, withbuffersize: int32) i know may old question, struggling same thing , solved: you need pass argument block waveformdatacomplet...

c# - Azure ServiceBus OnMessage Blocking Call or Not? -

we utilizing azure servicebus queues process high volumes of client requests. however, onmessage call seems blocking call, blocking on call incredibly inconsistent if indeed blocking call. what attempting accomplish watch queue on permanent basis web service application (to allow metrics mined running application) i creating subscription below: protected virtual void subscribe(string queuename, func<queuerequest, bool> callback) { var client = getclient(queuename, pollingtimeout); var transformcallback = new action<brokeredmessage>((message) => { try { var request = message.toqueuerequest(); if (callback(request)) { message.complete(); } else { message.abandon(); } } catch (exception ex) { //todo: log error message.abandon(); } }); var options = new onmes...

Accessing Drupal Entity fields in custom templates -

first of let me first project in drupal , still confused, apologize if question stupid. i created custom entity in drupal 7 using entity api. custom entity represents golf course. i used tutorial: http://www.sitepoint.com/series/build-your-own-custom-entities-in-drupal/ tried add custom theme, followed this: https://www.drupal.org/node/1238606 my callback function looks this: function view_golf_course($id) { $courses = entity_load('golf_course', array($id)); $course = $courses[$id]; drupal_set_title($course->name); $output = entity_view('golf_course', array($course)); $output += array( '#theme' => 'golf_course', '#element' => $output, '#view_mode' => 'full', '#language' => language_none, ); return $output; } and hook_theme() : function golf_course_theme($existing, $type, $theme, $path) { return array( 'golf_course' => array( 'va...

multicast - Time Limit issue in mod_multicast ejabberd -

we using mod_multicast ejabberd 2.1.11 following configuration [{host, "multicast.server_ip"}, {access, multicast}, {limits, [{local, message, infinite}, {local, presence, infinite}, {remote, message, infinite}]}] but getting error in response when send second broadcast message after 2 3 seconds of first message, <message xmlns="jabber:client" from="multicast.server_ip" to="8_9414440765@server_ip/10909448101435316508474960" type="error" id="1435316983"> <addresses xmlns="http://jabber.org/protocol/address"> <address type="to" desc="1435316983" jid="10_9414756966@server_ip"/> <address type="cc" desc="1435316983" jid="9_8386837120@server_ip"/> </addresses><ftype>emoji</ftype> <body>[fg#007]</body> <broadcastid>6</broadcastid> <error code="403" type="auth...

Swing layout issue on migration to java 8 -

Image
my swing application in java 5 had display after migrating java 8, zoomed , displays part of i saw this , tried setting j2d_d3d environment variable , tried passing vm parameter. didn't solved issue. idea be? for reference, here's example doesn't have problem. uses gridlayout(0, 1) congruent gaps , border. resize enclosing frame see effect. experiment box(boxlayout.y_axis) alternative. i suspect original code (mis-)uses combination of setxxxsize() or setbounds() , display effect shown if chosen & feel has different geometry specified buttons' ui delegate. import java.awt.eventqueue; import java.awt.gridlayout; import javax.swing.borderfactory; import javax.swing.jbutton; import javax.swing.jframe; import javax.swing.jpanel; /** @see https://stackoverflow.com/a/31078625/230513 */ public class buttons { private void display() { jframe f = new jframe("buttons"); f.setdefaultcloseoperation(jframe.exit_on_clos...

java - Get all text from online text file and show it all in a TextView -

i want text webpage , save string array/list , print in view/activity.. let's have url www.my.url/html.php , on page this: paul caroline steve' ... ... and want them written in same position in view/activity. i have simple activity: public class playerlistactivity extends activity { @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_playerlist); } } and xml file: <framelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/container" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#121e26" tools:context="com.tominocz.stonequestapp.mainactivity" tools:ignore="mergerootframe,contentdescription,hardcodedtext...

c++ - How to write functions and call them from main -

#include<iostream> #include<iomanip> #include<string> #include<fstream> using namespace std; struct studenttype { string studentfname[20]; string studentlname[20]; string studentdata[20][3]; int testscore[20][5]; char grade[20]; }; studenttype s; int main() { int index; int maxindex; int maxindex1; int coldex; int coldex1; int totalscore[20]; double avscore[20]; double highscore; double highindivscore; maxindex = 0; maxindex1 = 0; coldex1 = 0; ifstream infile; infile.open("test.txt"); for(index = 0; index < 20; index++) { infile >> s.studentfname[index] >> s.studentlname[index] >> s.testscore[index][0] >> s.testscore[index][1] >> s.testscore[index][2] >> s.testscore[index][3] >> s.testscore[index][4]; totalscore[index] = ((s.testscore[index][0]) + (s.testscore[index][1]) + (s.testscore[...

Using data from an excel sheet to graph in python -

Image
so have lot of data in excel spreadsheets. need graph through python. know how read data excel file using xlrd , know how graph in python using matplotlib. data looks has columns of x coordinates, y coordinates, , positive , negative y errors. need way for data imported spreadsheet , become points , error bars on graph. honest i'm new @ python , have no idea why code isn't working. import xlrd import numpy np import matplotlib.pyplot plt file_location = "c:/users/rima/desktop/apjl731data.xlsx" workbook = xlrd.open_workbook(file_location) first_sheet = workbook.sheet_by_index(0) col in range(first_sheet.ncols): x = first_sheet.cell_value(0,col) y = first_sheet.cell_value(1,col) yerr = first_sheet.cell_value(2,col) plt.errorbar(x,y,yerr,fmt='r^') plt.show() i haven't found how online, how make graphs in excel using python. i'm sure code missing lot make if work i'm not sure what. yerr, in order different error value on top , botto...

php - Drupal 7 failed to open stream: Permission denied in image_gd_save() -

i trying generate , scaled image thumbnails, scaling image has no problem , when use image_save($_image) // works fine (using same folder replacing) code has not problem, problem starts when tried save images in destination folder using destination parameter: image_save($_image, $destination) //throws errors then error occurs: warning: imagejpeg(c:\xampp\htdocs\drupal-devel\sites\default\files): failed open stream: permission denied in image_gd_save() (line 284 of c:\xampp\htdocs\drupal-devel\modules\system\image.gd.inc). i'm working windows xampp , using function is_write of php, return true, no problem permissions. i had been trying time , don't know what's happening, no problem permissions. this code: $destination = 'public://gallery/thumbs/'; $filepath = drupal_get_path('module', 'gallery_blueprint') . '/img/large/1.jpg' // someplace before function file_prepare_directory($destination, file_create_directory); _...

How to create a 3d / surface chart with JavaFX? -

Image
problem i tried create 3d chart javafx seems more difficult 1 expect. my current way of doing create trianglemesh, that's rather circumstantial. i'd provide list<point3d> chart , chart should rendered surface. however, simple pyramid 5 data points turns out rather complicated: float h = 200; // height float s = 200; // side trianglemesh pyramidmesh = new trianglemesh(); pyramidmesh.gettexcoords().addall(0,0); pyramidmesh.getpoints().addall( 0, 0, 0, // point 0 - top 0, h, -s/2, // point 1 - front -s/2, h, 0, // point 2 - left s/2, h, 0, // point 3 - 0, h, s/2 // point 4 - right ); pyramidmesh.getfaces().addall( 0,0, 2,0, 1,0, // front left face 0,0, 1,0, 3,0, // front right face 0,0, 3,0, 4,0, // right f...