Posts

Showing posts from January, 2015

javascript - Bad image rotation -

i have issue javascript when rendering image before upload in correct rotation. seems when render image witch have correct rotation on exif data browser doesn't use it. users see different rotation between have on system on when image displayed on website javascript. the code basic: do know simple way correct rotation bug ? lbemeraude.handleimage = function (f) { if (f.type.match('image.*')) { var reader = new filereader(); reader.onload = (function (file) { return function (e) { var image = {}; image.dataasurl = e.target.result; lbemeraude.renderimage(image); }; })(f); var image = reader.readasdataurl(f); } } lbemeraude.renderimage = function (image) { var eimage = lbemeraude.createimgelement(image.dataasurl); $('someelement').append(eimage); }; lbemeraude.createimgelement = function (src) { var image = document.createelement(&

Cannot retrieve license from Marmalade SDK server -

Image
i have evaluation license, cannot retrieve it. of course connection working, firewall disabled , etc. check proxy settings in internet explorer. marmalade take proxy settings automatically ie. whenever have issue on new machine, disable auto proxy setting manual in ie , works.

javascript - Blending two transitions simultaneously in D3 -

i have started learning d3 , playing around bit it. have created small animation . not playing out how wanted. here's animation . ---> fiddle now if see in js , there small bit of code transition of circles takes place. below code. transitions c.transition() .attr("cy", 150) .duration(2000) .each("end", function () { d3.select(this).transition() .attr("cx", 150) .duration(2000); what want both vertical , horizontal transactions happen simultaneously. know d3 not used library i'm pretty sure community just put both attributes in 1 animation (updated fiddle http://jsfiddle.net/daevq/1/ ) c.transition() .attr("cy", 150) .attr("cx", 150) .duration(2000)

sql - vbscript insert array into access database -

i have simple task complex procedure. i'm creating tracking program tracks usage of applications, other pertinent info. i'm first recording data application in temporary text file deleted once data retrieved. data separated commas can stored in csv file. csv file used pull specific pieces of information review. data stored permanently in 2010 access database. i've been able store data in text file. i've been able create vbscript read data text file , copy csv file. need figure out why, when i've put message box above script inserts data database, can see info in message box, won't print database , i'm not receiving error messages. here's vbscript code: ' set constants reading, writing, , appending files const forreading = 1, forwriting = 2, forappending = 8 ' sets object variables. dim objexcel, objfso, objtextfile, objcsvfile, objtrackingfolder ' sets integer variables. dim intpathypos ' sets string variables program. dim desk

java - Private Interfaces -

how can use methods of private interface in our code? abstract classes cannot instantiated. so, if need use methods of abstract class, can inherit them , use methods. but, when talk interfaces, need implement them use methods. the private keyword means "anyone in same class": public class foo { private interface x {...} private class x1 implements x {...} } this means classes declared inside of foo can use interface foo.x . a common use case command pattern foo accepts, say, strings , converts them internal command objects implement same interface. if add second class bar file foo.java , can't see foo.x .

How to remove an array containing certain strings from another array in Python -

example: a = ['abc123','abc','543234','blah','tete','head','loo2'] so want filter out above array of strings following array b = ['ab','2'] i want remove strings containing 'ab' list along other strings in array following: a = ['blah', 'tete', 'head'] you can use list comprehension: [i in if not any(x in x in b)] this returns: ['blah', 'tete', 'head']

c++ - How can i use my custom shader in Linderdaum Engine scene? -

currently replace default.sp custom shader , works fine. shader applied objects in scene. scene->setmtl() works materials , not opengl shaders. how can use custom shader objects? there method clscene::setmtlfromshader() accepts 3 clrenderstate variables. 1 each pass: normal, shadow , reflection. you need create own clrenderstate , set opengl shader program using clrenderstate::setshaderprogram() method. should work fine.

python - dnode working along nodejs on windows 8 error -

i have been trying dnode install link http://bergie.iki.fi/blog/dnode-make_php_and_node-js_talk_to_each_other/ i tried npm install dnode i gave me following error. gyp err! configure error gyp err! stack error: can't find python executable "python", can set pyt hon env variable. gyp err! stack @ failnopython (e:\program files (x86)\nodejs\node_modules\n pm\node_modules\node-gyp\lib\configure.js:118:14) could plz assist me issue appropriate commands :) much regards guys do have python installed? in path? which python if not can set python environment variable gyp can find it. export python=/path/to/python

html - Create nested list view from JSON -

i'm trying create nested listed view jquery. data in json file. looks this: { "fakultaeten": [ { "id": "1", "name": "carl-friedrich gauß", "institut": [ "mathematik", "informatik" ] }, { "id": "2", "name": "lebenswissenschaften", "institut": [ "biologie/biotechnologie", "chemie/lebensmittelchemie" ] }, { "id": "3", "name": "architektur, bauingenieurwesen und umweltwissenschaften", "institut": [ "department architektur", "department bauingenieurwesen und umweltwissenschaften" ]

java - Passing a variable value between activities -

i trying pass number edittext box in activity1 activity2 when button pressed, want number appear in toast or dialog box when action bar button pressed in activity2. have set intent , coded think should work seems crashing activity2 everytime. put in line of code should fetch variable. able see i'm going wrong. know passing data within variable should easy task. appreciated. activity1: public class activity1 extends activity { @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); //this.requestwindowfeature(window.feature_no_title); setcontentview(r.layout.screen_settings); this.setrequestedorientation(activityinfo.screen_orientation_portrait); final edittext inputtxt1 = (edittext) findviewbyid(r.id.conphonenum); button savebtn1 = (button) findviewbyid(r.id.btnsave1); savebtn1.setonclicklistener(new view.onclicklistener() { @override public void onclick(view view) { string phonenum1 = inputtxt1.

java - Oauth multipart request -

i want send files server oauth authorization. know how create oauth multipart request? use oauth lib requests. how can add lib ability send multipart? have plan rewrite httpclient4.java class. had such experience?

Delete from Array and return deleted elements in Ruby -

how can delete elements array , select them? for example: class foo def initialize @a = [1,2,3,4,5,6,7,8,9] end def get_a return @a end end foo = foo.new b = foo.get_a.sth{ |e| e < 4 } p b # => [1,2,3] p foo.get_a # => [4,5,6,7,8,9,10] what can use instead of foo.get_a.sth ? if don't need retain object id of a : a = [1,2,3,4,5,6,7,8,9,10] b, = a.partition{|e| e < 4} b # => [1, 2, 3] # => [4, 5, 6, 7, 8, 9, 10] if need retain object id of a , use temporal array c : a = [1,2,3,4,5,6,7,8,9,10] b, c = a.partition{|e| e < 4} a.replace(c)

MS Access VBA: Sending an email through Outlook -

how can send email through account using ms access vba? know question vague it's hard find relevant information online isn't outdated in way. edit: don't mean rude answering, i using ms access . cannot write actual code in outlook vba. add reference outlook object model in visual basic editor. can use code below send email using outlook. sub sendoutlookemail() dim oapp outlook.application dim omail mailitem set oapp = createobject("outlook.application") set omail = oapp.createitem(olmailitem) omail.body = "body of email" omail.subject = "test subject" omail.to = "someone@somewhere.com" omail.send set omail = nothing set oapp = nothing end sub

java - notify() not working in Runnable -

why can't notification reader in code: public class threadmain { public thread reader; private class serialreader implements runnable { public void run() { try { thread.sleep(3000); synchronized(this) { system.out.println("notifying"); notify(); } thread.sleep(3000); } catch (exception e){} } } threadmain() { reader = (new thread (new serialreader()) ); } public static void main(string [] args) { threadmain d= new threadmain(); d.reader.start(); synchronized(d) { try { d.wait(); system.out.println("got notify"); } catch (exception e) { system.out.println(e); } } } } i have line notifying in out

javascript - Workaround for issues with KB2846071 -

because of patch kb2846071, getting issues in our web application wherever using window.event.clientx or window.event.clienty . one part of breaking critical functionality in our application. have looked of links after insalling kb2846071 event.clinety seems negative value did windows update 2846071 break break handling of window.event.clientx clienty? but none of these provide solution or workaround. know solution ms, right looking immidiate fix. can provide can use in place of below code? window.onbeforeunload = function(e) { if (event.clienty < 0 ) { // close session // warn user... } };

sharepoint 2010 - Search for phrases in docs in ClearCase -

i have lot of docs in clearcase not sorted , have migrate them sharepoint after sorting them. have folder structer of how want docs sorted in sharepoint. want search particular words in docs in clearcase , move doc respective folder in sharepoint. example, if doc contained word "design" go design process folder in sharepoint. want able search word phrases in docs stored in clearcase. possible? this isn't clearcase feature, rather simple grep issue. (unless want search in versions of clearcase file) i recommend loading docs in snapshot view , , use favorite grep tool on files .

jax rs - Jersey 2.1 - Consuming collection of POJO as JSON string -

i have collection of entities (list) need convert to/from json. the pojo: public class task { private long id; private string title; private boolean done; (...) } jersey produces following result [{"id":1,"title":"t1","done":false},{"id":2,"title":"t2","done":false}] when call method: @get @override @produces("application/json") public list<task> findall() { (...) return tasks; } so far good. now, need consume similar json string. assumed following method trick: @put @consumes("application/json") public void save(list<task> tasks) { (...) } but instead error below: severe: line 1:0 no viable alternative @ input '"[{\"id\":1,\"title\":\"t1\",\"done\":true},{\"id\":2,\"title\":\"t2\",\"done\":false}]"' what doing wron

javascript - flowplayer cuepoints trouble -

hi sorry poor english .i creating bubble cuepoints manually using javascript in flowplayer. on mousehover show information .while page loading want load cue points(bubbles). having duration in seconds. how place bubbles in appropriate position(time). using flowplayer-3.2.16.swf , flowplayer-3.2.12.min.js . kindly me . cuepoints can added video adding data-cuepoints div holding video such: <div class="flowplayer" data-cuepoints="[6, 7, 8, 9]"> <video preload="none"> <source src="whatever.webm" type="video/webm" /> <source src="whatever.mp4" type="video/mp4" /> <source src="whatever.ogg" type="video/ogg" /> </video> </div> alternatively can add cuepoints via javascript such: <script type="text/javascript"> flowplayer.conf.embed = false; flowplayer.conf.fullscreen = true; flowplay

php - Elastic Search: Boosting results -

i have many objects have been indexed in es. 2 of each object's properties "type" , "title". there way boost results if type in result set majority, title weighs more other properties such "description"? edit: boosting properties. want, given characteristic of result set(most types similar), further boost field. you can add boosting query: for example: "term": { "terms": { "value": "stranger fiction", "boost": 1.8 } read more here: http://www.elasticsearch.org/guide/reference/mapping/boost-field/

Can I write a custom template for the Liferay blog portlet? -

i want make major changes layout of liferay blog portlet. possible define own template somehow? want able change markup. kind of same way can make templates web content. unfortunately blogs portlet doesn't have same capability webcontent. however, depending on setup, might able "mimic" blog webcontent: categorize content according requirements, publish on assetpublisher , stick label "blog" on it. it depends bit on number of blog authors , location of blogs have: after all, you'll have enable them author/edit webcontent in 1 site. if that's not problem, use this. might use defined template, might able automate bit of work when provide custom portlet article input - advanced usecase.

java - Selenium2 Webdriver taking screen shot works for Firefox but nothing else -

i using selenium 2 testng. selenium-java-2.33.0 trying take screen shot of browser on failed test cases. storing webdriver in hashtable id associated each browser type (ie, firefox, chrome, , safari). in cleanup routine "@aftermethod", fetch webdriver. here code: //code 1: if (webdriver instanceof takesscreenshot) { file tempfile = ((takesscreenshot)driver).getscreenshotas(outputtype.file); fileutils.copyfile(tempfile, new file("screenshots.png")); } //code 2: eventfiringwebdriver efiringdriver = new eventfiringwebdriver(webdriver); file scrfile = efiringdriver.getscreenshotas(outputtype.file); fileutils.copyfile(scrfile, new file("screenshot.png")); both of code paths works firefox, other browsers, cast exception thrown. java.lang.classcastexception: org.openqa.selenium.chrome.chromedriver cannot cast org.openqa.selenium.firefox.firefoxdriver

google app engine - appengine app works only with my account -

i've developed simple appengine application google apps domain. access restricted users in domain, , app enabled in admin console domain. the authentication/authorization in application done using decorators, using json client secrets downloaded api console. i've created client secrets of type "client id web applications". my main handler, on method, follows: @decorator.oauth_aware def get(self): if decorator.has_credentials(): .... stuff ..... else: self.response.out.write("decorator doesn't have credentials") the problem application works when i'm logged in account. other users in same domain, "decorator doesn't have credentials" error. any clue on why case? the problem quite simple: user not logged in and, instead of presenting login window, app crashing. to present login window should use @decorator.oauth_required instead of oauth_aware , , put login: required in app.yaml file

image - Jquery JRAC get coordinates -

i've been trying 2 hours can't find way coordinates once have settled on cropped width , height. docs jrac not either. have experiencing getting values width,height,x,y? you can use jrac same example document add jrac , compare multi jquery plugin because jrac can move image area , jquery plugin can not jquery $('.imagearea img').jrac({ 'crop_width': parseint(math.round(cusw / 4) + 4), 'crop_height': parseint(math.round(cush / 4) + 4), 'crop_left': 0, 'crop_top': 0, 'zoom_min': 0, 'zoom_max': 0, 'zoom_label': '', 'viewport_onload': function () { $viewport = this; var inputs = $("div.coords").find("input[type=text]"); var events = [

CakePHP Model Binding with TreeBehavior methods -

i making use of cakephp treebehavior class. $this->set('sports', $this->sport->children(1,true)); as can see bellow, function returns children need, not bind models. name of sport stored in table tags. associations defined in model , binds them if use 'find' method queries. there way use treebehavior functions , force model binding ? array( (int) 0 => array( 'sport' => array( 'id' => '2', 'parent_id' => '1', 'lft' => '6', 'rght' => '7', 'tag_id' => '51f0099f-ead0-4f41-8d0f-176c9c2b3e89' ) ), (int) 1 => array( 'sport' => array( 'id' => '3', 'parent_id' => '1', 'lft' => '8', 'rght' => '11', 'tag_id' => '79177f20-f46a-11e2-96ba-00116b93c9e5' ) )

php - Ajax not filling target DIV correctly after form submit -

i trying implement form plugin website have. supposed simple, refuses behave want. it's simple php email form inside div, once correctly submitted, replaced success or failure message inside same div. js adds message on top of form. i stunned because thought tackled serious trouble experience doing this, can't past simple bug. want response message inside div once contained form. here's include php: if (isset($_request['sender']) && isset($_request['message'])) {//if "sender" , "message" filled out, proceed //check if email address invalid $mailcheck = spamcheck($_request['sender']); if ($mailcheck==false) { echo "an error has occurred" . $_request['sender'] . " " . $_request['message']; } else {//send email $email = $_request['sender'] ; $subject = "this subject" ; $message = $_request['message']

winapi - WM_NCCALCSIZE, custom client area, and scroll bars -

Image
i have mfc app embeds scintilla text edit control. want customize scintilla control display custom controls next vertical scrollbar. essentially, want render controls in orange area below, green area represent scroll bars: i tried overriding wm_nccalcsize message of scintilla window , subtracting offset right side of client rectangle. here code: void cscintillactrl::onnccalcsize(bool bcalcvalidrects, nccalcsize_params* lpncsp) { cwnd::onnccalcsize(bcalcvalidrects, lpncsp); lpncsp->rgrc[0].right -= 100; } however, causes vertical , horizontal scroll bars reposition account smaller client width, shown below: i'm not sure if behavior caused scintilla or windows. there way can adjust client area , preserve positions of scroll bars? i found scintilla specific solution. can use sci_setmarginright command add margin right side of client area, , render controls inside that.

python - find all characters NOT in regex pattern -

let's have regex of legal characters legals = re.compile("[abc]") i can return list of legal characters in string this: finder = re.finditer(legals, "abcdefg") [match.group() match in finder] >>>['a', 'b', 'c'] how can use regex find list of characters not in regex? ie in case return ['d','e','f','g'] edit: clarify, i'm hoping find way without modifying regex itself. negate character class: >>> illegals = re.compile("[^abc]") >>> finder = re.finditer(illegals, "abcdefg") >>> [match.group() match in finder] ['d', 'e', 'f', 'g'] if can't (and you're dealing one-character length matches), could >>> legals = re.compile("[abc]") >>> remains = legals.sub("", "abcdefg") >>> [char char in remains] ['d', 'e', 'f

archive - SQL Server Archiving Strategy (not Backup) -

our contracts our clients state manage , store data within last 3 months. because have such high volume application, archive production tables moving old data "archive" database. have stored procedure gathers older data, dumps tables in "archive" database , removes rows production database. pretty simple, straightforward process. we want keep archive database @ manageable size , "shelve" data onto offsite media. best way accomplish still allow load offline data in order retrieve old data customer @ request? there no such thing best way ;). your requirements way broad , need narrow these down. try come detailed specs , you’ll able come solution once have data. here things i’d analyze first: monthly amount of data needs moved offsite how amount change in future (safe bet assume numbers grow) budget how long should keep archives before deleting them turnaround time restoring archived data depending on these factors “best” solution

html5 - How do you have to mark up a postal address so it allows invoking an intent on a mobile device? -

my goal when mobile user touches address on clients website appropriate intent invoked, allowing user to, example, display location on google maps or start gps navigation. similar behavior working great phone number. upon touching it, i'm asked if want complete action using skype or phone app. so far, i've marked address hcard microformat , localbusiness schema.org . i've added geographic coordinates , marked them well. while that's great structured data, didn't seem have effect regarding initial goal. is i'm trying achieve possible? before apple maps used put link 1 below. when tapped, open google maps app. don´t have iphone test right now, chrome android shows menu chose application handle type of link (chrome, maps, waze, etc). <a href="http://maps.google.com/maps?q=-22.90132,-43.176527">ccbb (centro cultural banco brasil)</a>

mysql - Upgrading umbraco from 4 to 6 -

i install umbraco 6.1.x, host suffers issue: http://issues.umbraco.org/issue/u4-1632 basically, can't install 6 due incompatibility mysql on linux , umbraco 6, read can upgrade 4.x.x , upgrade 6. question is, how do that? i.e. files need upload , edit such database remains, umbraco files version 6? yes, according bug report can install umbraco v4.11.x , upgrade v6.1.x , should work fine. the downloads available here: http://our.umbraco.org/download however, easiest way umbraco set use nuget in visual studio. run following line nuget console: install-package umbracocms -version 4.11.10 you'll have use console because if use package manager, install latest umbraco package version. next, load site in browser , configure database settings. upgrade using nuget again. find easiest way open nuget package manager in visual studio, select "updates", find umbraco package , click "update". automatically update files you. you need load site ag

php - Extracting URL's from mysql database and setting as single word clickable link -

i extract url's mysql database. wish link url single word 'click' in table. the snippet of code below extracts data mysql database , puts in table series of rows. each row there respective url wish extract database. instead of showing full , long url want have word click against each row people can click access url. can body tell me how done? $q="select * railstp download='$changeday'"; $r=mysqli_query($mysql_link,$q); if ($r) { echo "<strong>network rail schedule (stp) updates downloaded: $changeday</strong>"; echo "<p> </p>"; echo "<table id='customers'> <tr> <th>headcode</th> <th>traction</th> <th>from</th> <th>to</th> <th>depa

jquery - switching anchor tags on popover with a tab key -

i have popover message in webapplication. want perform action. has 2 buttons/anchor tags. when show popover, first button in focus (i'm setting focus jquery.focus) now, when press tab focus shifts second button, , after when hit tab focus goes in page ( below popover ). how make sure when keep pressing tab focus shifts between 2 buttons ( or n number of buttons , loop back) in popover , not go page. try binding tab keydown, focus whichever button isn't focused. $("body").keypress(function(e) { var code = (e.keycode ? e.keycode : e.which); if(code == 9){ if($("#button_one").focus()){ $("#button_two").focus(); } else if($("#button_two").focus()){ $("#button_one").focus(); } } }); source

Keep iframe content to display source html, but have source page to redirect -

i have iframe displays content html page (within same domain), let iframe content mydomain.com/page1.html . obviously, want content of page1.html displayed within iframe. however, have file ( page1.html ) redirected main site ( mydomain.com ) when whole url ( mydomain.com/page1.html ) typed in browser - without changing inside iframe. is doable? appreciate help. thanks. yes, wrote, sounds want happen: mydomain.com/page1.html typed browser redirects mydomain.com/ mydomain.com/page1.html loaded iframe not redirect stays in iframe unchanged you can add simple script page1.html accomplish this: <script> if (top == self) location.href = '/'; </script> warning: not add script domain's default home page or else cause infinite loading loop. self-contained example home page index.html contains: <p>this home page, containing frame.</p> <iframe src="page1.html"></iframe> frame page page1.html c

css - Issue with nth-of-type. I must be misunderstanding how it works -

here codepen problem trying resolve (or understand): http://codepen.io/jhogue/pen/wtlid basically, have set of columns floating. want use nth-of-type clear column starts new row. in case, every third .column starting @ fourth. how understand (3n+4) work. i need header in there well, first div element. though thought nth-of-type apply elements apply – in case, elements class .column – counting first element in container. so, nth-of-type not work way? understanding of how works incorrect? a clear picture of nth-of-type supposed do, vs. nth-child : http://css-tricks.com/the-difference-between-nth-child-and-nth-of-type/ you need more creative. may not need heading , paragraph inside div; if need wrapper, use <header> instead: <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <style> div:nth-of-type(3n+4) { color: red; } </style> </head> <body> <div class="co

database - ActiveRecord::StatementInvalid TypeError not a supported Ruby type, with NuoDB -

i'm using rails 3.2.13 legacy nuodb database , activerecord-nuodb-adapter gem. database connected , can accurate list of tables activerecord::base.connections.tables. here's error: [2] pry(main)> store.first store load (3.2ms) select `store`.* `store` fetch first 1 rows activerecord::statementinvalid: typeerror: not supported ruby type: 2004: select `store`.* `store` fetch first 1 rows /home/bion/.rvm/gems/ruby-2.0.0-p247/gems/activerecord-nuodb-adapter-1.0.3/lib/active_record/connection_adapters/nuodb_adapter.rb:905:in `columns' the type error has been resolved in update of nuodb ruby driver.

neo4j and java collection search -

hi i'm trying search using operator in, return empty list, wrong ? bellow unit test. whta want search product descriptio or similarity word macths description. (futurely pretend implement fuzzy). private graphdatabaseservice graph; private index<node> indexproduct; private executionengine engine; @before public void preparetestdatabase() { testgraphdatabasefactory testgraphdatabasefactory = new testgraphdatabasefactory(); this.graph = testgraphdatabasefactory.newembeddeddatabase("/tmp/neo4j/tests"); this.indexproduct = this.graph.index().fornodes("node_product"); this.engine = new executionengine(this.graph, stringlogger.system); this.loaddatafortest(); } private void loaddatafortest() { transaction tx = this.graph.begintx(); list<string> similarities = new arraylist<>(); similarities.add("televisor"); similarities.add("tv"); string description = "televisão"; pro

user interface - Python UI to enter 2 parameters -

i want create simple ui user can enter integer , string parameter. hoping use simple qinputdialog(), far can tell works 1 parameter. inputdialog = qtgui.qinputdialog() myint, ok = inputdialog.getint(inputdialog, 'enter params', 'int', 1) is there simple way like: inputdialog = qtgui.qinputdialog() myint, mystring, ok = inputdialog.getint(inputdialog, 'enter params', 'int', 1), inputdialog.gettext(inputdialog, 'enter params', 'text', 1) i started looking @ pyqt, seems such overkill basic. any appreciated. there's no standard qt dialog multiple fields. can either use 2 dialogs in sequence or else have user enter both values in single field, split them in code. e.g.: inputdialog = qtgui.qinputdialog() mytext, ok = inputdialog.gettext(inputdialog, 'enter number, space, text', 'data', '') if ok: myint, _, mytext = mytext.partition(" ") try: myint

android - What are the pros and cons of using HttpUriRequest vs. HttpURLConnection? -

i have made several apps , libraries android use httpurirequest create network requests (for example, droidquery library), have been seeing new libraries emerging (such okhttp , meant extraordinarily fast) use httpurlconnection instead. does httpurlconnection provide faster connection httpurirequest , or these 2 classes equivalent? pros , cons using 1 on other? this answered on android dev blog : which client best? apache http client has fewer bugs on eclair , froyo. best choice these releases. for gingerbread , better, httpurlconnection best choice. simple api , small size makes great fit android. transparent compression , response caching reduce network use, improve speed , save battery. new applications should use httpurlconnection; spending our energy going forward.

excel - Searching a folder to match each file to a table -

i added loop (see k part) , slows down entire program. possible make more efficient? i searching specific folder , trying match each file table in spreadsheet. trying make quarters(1,j) in k loop same quarters(i,j) lower part of code not sure how since have used integer i. for j = 1 2 k = 1 39 if k <= 29 'looks @ files in folder given quarter sourcefoldername = folderpath & "\" & quarters(1, j) set objfso = createobject("scripting.filesystemobject") set objfolder = objfso.getfolder(sourcefoldername) end if if k > 29 sourcefoldername = folderpath & "\" & quarters(k, j) set objfso = createobject("scripting.filesystemobject") set objfolder = objfso.getfolder(sourcefoldername) end if each objfile in objfolder.files = 1 notassigned = true 'keep going

.net - Fluent NHibernate sessions closes the database connection -

i'm using fluent nhibernate write oracle 11g database. i'm not sure if it's problem, nhibernate drivers have configuration settings 9 , 10g databases. anyways, when had instantiated 1 nhibernate sessionfactory , 1 nhibernate session (a used both regular session , istatelesssession). anytime performed read or write database, oracle sys.aud$ table have log of transactions being performed. our dba said because connection logging in , logging off after each read or write transaction. large amount of queries, end killing audit table. we're going create second database user tweaked auditing account, default nature nhibernate close , open connection each transaction? there way prevent connection logging in , logging off? here's sessionfactory configuration public static isessionfactory getsessionfactory() { var cfg = fluentnhibernate.cfg.db.oracleclientconfiguration.oracle10; cfg.connectionstring(c => { c.instance(...);

node.js - How do I use the PROXY protocol to get the client's real IP address? -

aws added support elb proxy protocol , wraps tcp streams , adds client ip address (as seen proxy) backend server has access client's ip (since otherwise see elb's ip). i know elb can run in http(s) mode, elb inserts x-forwarded-for header, run elbs in tcp mode can serve site on spdy . how can modify node.js app (using express) use proxy protocol? i made module caled proxywrap wraps node.js server s , automatically strips proxy protocol headers connections' streams, , resets socket.remoteaddress , socket.remoteport values found in proxy headers. it works built-in server modules (like http , https , , net ) drop-in replacement module: var http = require('http') , proxiedhttp = require('proxywrap').proxy(http) , express = require('express') , app = express() , srv = proxiedhttp.createserver(app); // instead of http.createserver(app) app.get('/', function(req, res) { res.send('ip = ' + req.c

Git: Howto hierarchically merge from the root to the leaf of a branch tree? (Patch stack management) -

i use git version control, have tried out mercurial. while don't mercurial in general, idea of maintaining separated patches mercurial queues (mq) quite appealing. therefore, looking similar (but easier use, more "gitty" , maybe more powerful) in git. so first explain have in mind: as example, let's doing test-driven development. master branch follows main repository of software. branched out that, have branch called "feature-test", , branched out that, "feature-implementation": master |_ feature-test |_ feature-implementation for each branch, remember parent branch. implementation work this: checkout feature-test , write test. checkout feature-implementation, rebase current status of feature-test , write implemenation. , on. at point, update master, , rebase both feature-test , feature-implementation. as side note: instead of rebasing branches, alternative merge changes parent branch. makes conflict resolution easier. cascadin

c# - Requesting extended permissions from facebook? -

i'm having trouble requesting extended permissions facebook. pass scope => 'email','publish_actions' , i've set app on fb require permissions. yet, when sign in site using fb, login dialog says "this application requests access public profile , friendlist" what missing here? end user asked after authorized app. 2 steps authorization in case.

android - Replacing Provider injections with Mockito mocks during test with Dagger -

i attempting test-drive suite of changes i'm making android service ( android.app.service ) - using dagger , robolectric , need replace field injected classes within service mocks reduce test scope...make (slightly) more 'unit' like. so, short version... i inject providers.of (guice syntax there...) android.app.service . how replace them mockproviders during unit test? the longer version... this relevant service code looks like; @inject spotservice spotservice; @inject provider<synchronisetideposition> synctideposition; @inject provider<synchroniseswelldatatask> syncbuoydata; @inject provider<synchroniseconditionstask> syncconditionsdata; @inject spotratingcalculator spotratingcalculator; @inject localbroadcastmanager localbroadcastmanager; @inject notificationmanager notificationmanager; /** * @see android.app.service#oncreate() */ @override public void oncreate() { super.oncreate(); inject(this); ... so, under normal operation sta

Alternative to enum in PHP -

is there alternative using enums in php? ask because in c# have methods return emum, in php nothing similar exists. here possible return types fictitious method: function login() { // logged in // log in failed verify account // log in failed account suspended // log in failed account banned } what's best way in php? you can use class: class loginstatus { const failverifyaccount = 0; const failaccountsuspended = 1; const failaccoutbanned = 2; } // how use $status = loginstatus::failverifyaccount; if ($status == loginstatus::failverifyaccount) echo "verify account"; or constants using define: define("login_status_verify_account", 0); define("login_status_account_suspended", 1); define("login_status_account_banned", 2); // how use $status = login_status_verify_account; if ($status == login_status_verify_account) echo "verify account";

matplotlib - Python Hexbin marginals offset from image produced -

Image
i have simple question. when using python hexbin plot option on spatial data (ra, , dec x , y) want see marginals on side. happily there simple option 'marginals = true'.... unhappily, can see below... x-axis marginals visibly offset hexagon produced image. have tried adjusting parameters marginals on x-axis appear offset image (and there never seems problem in y), ideas appreciated. please see code , image below, in advance! fig5=plt.figure(5) ax=fig5.add_subplot(111) imageh=plt.hexbin(radeg[corel], decdeg[corel], extent=[np.min(radeg[corel]), np.max(radeg[corel]), np.min(decdeg[corel]), np.max(decdeg[corel])], alpha=0.7, gridsize=20, marginals=true, vmin=5, vmax=105, cmap=get_cmap("jet"), mincnt=5) ax.axis([305,275,-40,-25]) cbar=plt.colorbar(imageh,extend='max') cbar.set_label(r'

android - why is BroadcastReceiver called twice from the OnPostExecute in asystask? -

the question simple created broadcaster class in fragrment class. , call asystask class perform. after execute class (on onpostexecute method), send broadcaster intent fragment class once. however, result got onreiver method 2 times. (i verified using log got onpostexecute method , send broadcaster once, onreiver method triggered twice). can give me help. bugs me , wasted time. thank you public class fragment extends fragment{ @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { currentview = inflater.inflate(r.layout.left_panel, container, false); mcontext = currentview.getcontext(); init(); return currentview; } @override public void onresume(){ super.onresume(); localbroadcastmanager.getinstance(getactivity()).registerreceiver(albumlistbroadcaster, new intentfilter(commonutilities.broadcasterofalbumtitlelist)); } private void init(){ albumlistbroadcaster = ne

clickonce - Does Google Drive Web Hosting work privately on Google Apps Accounts -

use case i use google drive quite heavily in organisation (through google apps) collaborate different teams on documents etc. saw google drive allows host web content directly on it. have made small .net application need host locally our test teams pick up. different use case, keep our content in 1 place, try host click once installer on drive, along publish.htm providing latest version @ times our test teams , others. have limited experience clickonce deployment in .net, have done in past on hard drives , servers. restrictions one limitation not want make public, described in of tutorials found online here , here . wouldn't mind keeping public within organisation, link visit , download application (this helps provide people in our organisation no access development servers etc. in future). 2 key things need understand: does hosting work locally within organisation on drive (or in pipeline drive sdk). if yes, how process different hosting using public. how gener

How to order effects in jquery sequentially -

i have snippet of code: $("a#list-mode").click(function() { $("#list-fix-pos").removeclass('col-lg-3', 1250, "easeinoutquart" ); $(this).hide("fade", 1250, true); $("a#map-mode").show("fade", 1250, true); }); how can order effects take place sequentially? @ moment, effects transition @ once. thanks jquery's .hide , .show functions allow specify function performed upon completion. syntax is .hide( duration [, easing ] [, complete ] ) in case, that'd be $("a#list-mode").click(function() { $("#list-fix-pos").hide(1250, 'easeinoutquart', function() { $(this).hide(1250, 'fade', function() { $("a#map-mode").show(1250, 'fade'); }); }); $("#list-fix-pos").removeclass('col-lg-3'); });

How to zoom in/zoom outusing using fingers swipe in /out in jQuery mobile+IOS+android -

can please tell me how zoom in/zoom out using using fingers swipe in /out in jquery. in android +ios screen zoom in zoom out using 2 finger , think touch start event work? or need other think zoom in / zoom out screen fingers how zoom using touch fingers?

android - How to get the shortcut menu name of Intent? -

Image
i can use following code packagename , activityinfo.name of intent. hope shortcut menu name such "add dropbox" image below, how can ? thanks! private void getshare() { intent share = new intent(android.content.intent.action_send); share.settype("image/*"); list<resolveinfo> resinfo = getpackagemanager().queryintentactivities(share, 0); if (!resinfo.isempty()){ (resolveinfo info : resinfo) { toast.maketext(getapplicationcontext(),info.activityinfo.packagename.tolowercase() +" cw " +info.activityinfo.name.tolowercase() ,toast.length_long).show(); } } } you can activityinfo.labelres edit: returns int referencing string res id. still have package's res map correct string.

c++ - Merge sort not working properly -

within merge sort method have merge function believe working correctly tested elsewhere. when try merge sort whole numbers not sort properly. edit: added merge code: void mergesort( int a[], int p, int q ) // pre: p >= 0; q >= 0; a[p..q] initialized // post: a[p..q] sorted in ascending order { int i; // counter used initialize l , r int j; int m; // midpoint of int l[100]; // lower half of int r[100]; // upper half of if ( p < q ) // if list contains more 1 value { m = ( p + q ) / 2; // find midpoint j = 0; ( = p; <= m; i++ ) // initialize lower half of array { l[j] = a[i]; j++; } j = 0; ( = m + 1; <= q; i++ ) // initialize upper half of array

batch file - WMIC get physical memory -

hi have script gets system information , stores information system variable , parses detailed info flat text file in folder. information lets me know in company has type of windows, type of computer, , specs. thing missing getting total physical ram machine, making total physical ram system variable , getting detailed ram info such how many banks populated , how ram flat text file. here script, appreciated. @if %debug%!==! echo on setlocal set prefix=%city%\%location%\computerlist\ /f "usebackq tokens=1,2 delims==|" %%i in (`wmic os name^,version /format:list`) 2>nul set "%%i=%%j" /f "tokens=2 delims==" %%i in ('wmic bios version /format:list') set "bios=%%i" /f "tokens=2 delims==" %%i in ('wmic computersystem model /format:list') set "model=%%i" ::for /f "tokens=2 delims==" %%i in (systeminfo |find "total physical memory" /format:list) set "memor