Posts

Showing posts from March, 2011

Python 3.4 tkinter button -

my program should destroy btn1 , create again after 1 second in loop. don't no why program destroy btn1 , don't show again. have idea why? from tkinter import * import random def hide(): btn1.destroy() btn1.after(2000,hide) def show(): btn1 = button(root, bd=c, text="hello\nworld", relief="ridge", cursor="trek") btn1.grid(row=0,column=0) btn1.after(3000,show) root = tk() root.geometry("350x150+400+400") c=random.randint(20,40) btn1 = button(root, bd=c, text="hello\nworld", relief="ridge", cursor="trek") btn1.grid(row=0,column=0) btn1.after(2000,hide) btn1.after(3000,show) root.mainloop() it work if use grid_forget instead of creating new object each time. note happens @ multiples of 6 seconds (2000 x 3000) depends on 1 last 1 execute. def hide(): btn1.grid_forget() btn1.after(2000,hide) def show(): btn1.grid(row=0,column=0) btn1.after(3000,show...

button - excel VBA can't get spinbutton value -

i have several shapes (autoshapes, connectors, labels, spin buttons) in worksheet, , want write several parameters of each 1 sheet. can't spin buttons value code below (the message reads: object not admit property or method). however, if replace sshape.value sb_fr.value (sb_fr specific name of 1 of spin buttons) code works ok. value property different others properies, top, or width or left? dim sshape shape = 0 each sshape in worksheets("sheet1").shapes worksheets("sheet2").cells(i + 1, 1) = sshape.name worksheets("sheet2").cells(i + 1, 2) = sshape.top worksheets("sheet2").cells(i + 1, 3) = sshape.left ss = split(sshape.name, "_") if (ss(0)="sb") 'if shape spin button worksheets("sheet2").cells(i + 1, 4) = sshape.value 'here problem end if i=i+1 next

c# - Event "While Button is Pressed" -

i made event grid in wpf c#. the mousemove event. i want trigger mousemove event when mouse left button pressed , keep event when mouse out of grid or out of main window . when button pressed keep mousemove event grid all on screen until button releasd . consider mouse move event method grid private void grid_mousemove(object sender, mouseeventargs e) { if (e.leftbutton == mousebuttonstate.pressed) // when left button pressed. { // perform operations , keep until mouse button released. } } the goal rotate 3d model when user hold left button , rotate model while moving mouse until button releases. this make program , rotation eeasier user. especialy performing long rotations cause mouse out of grid. i tried use while fails , know because of single threaded. so way im thinking somehow expand new grid on screen when button pressed inside original grid , keep until release. and of course dummy grid ...

go error: undefined: "html/template".ParseFile -

i have following error while compiling code "html/template undefined: "html/template".parsefile" at string of source code "t, _ := template.parsefile("edit.html", nil)" package main import ( "net/http" "io/ioutil" "html/template" ) type page struct { title string body []byte } func (p *page) save() error { filename := p.title + ".txt" return ioutil.writefile(filename, p.body, 0600) } func loadpage(title string) (*page, error) { filename := title + ".txt" body, err := ioutil.readfile(filename) if err != nil { return nil, err } return &page{title: title, body: body}, nil } const lenpath = len("/view/") func edithandler(w http.responsewriter, r *http.request) { title := r.url.path[lenpath:] p, err := loadpage(ti...

c# - Where is HttpContext.User property set initially? -

httpcontext has user property treats iprincipal type. documentation of ms know property might set http-modules such windowsauthenticationmodule or formsauthenticationmodule but, example, code of windowsauthenticationmodule : windowsprincipal user = context.user windowsprincipal; if (user != null) {/* code... */} it's interesting if condition false (user null or user has other type, not windowsprincipal) windowsauthenticationmodule return control (for intagrated mode pipeline of iis). have following questions: after iis authenticates client (as anonymous or authenticated user, configured) pass security token asp.net. our application in case wrapps token in windowsidentity и windowsprincipal objects. happens before authentication modules begin implementing. true? if 1 true, httpcontext.user property set initially? if 1 true, when httpcontext.user null? guess it's might if configure web.config : < authentication mode="none" /> am ri...

How can I restrict a certain user to one table in a MySQL database -

my database standard mysql database provided me web hosting company. i have tried issue grant command grants select, insert, , update privileges specified user on specific table. grant select, insert, update on database.table restricteduser for reason, kicking error. #1142 - grant command denied user 'adminuser'@'localhost' table 'tablename' i using phpmyadmin hosting company provides should have full admin privs correct? note- i've edited out actual table names security purposes. you don't have grant privilege if you're working in shared multitenant mysql database. next move open support ticket hosting company asking them how you're trying do. don't surprised if say, "we don't allow that." running large-scale multitenant mysql instances risky business, , restricting privileges of user accounts 1 way hosting companies, inexpensive ones, mitigate risk.

clojure - Sequentially calling a function with elements from a vector -

suppose have function f accepts 2 arguments x & y . have vector x composed of elements x 1 , x 2 , ... x n . how can write function g , g ( x , y ) calls f ( x i , y ) x ? further specification: g return vector, each element stores result of f ( x i , y ). understanding should considering map or mapv . you can use map implement it. i'm using lambda expression here define function takes 1 argument. (defn f [x y ] (...) ) // apply f x y every element of xs // in order need function takes 1 argument x_i , takes second argument somehere else - second argument of g // that's lambda \x -> f x y - in short form. (defn g [xs y] (map (fn [x] (f x y)) xs)) for example (def x [1 2 3 4]) (defn f [x y] (* x y)) (g x 3) ;=> (3 6 9 12)

html - How to access a css file and its styles from another php file? -

i looking include or gain access of css file using php. know it's possible don't know how it, following css file: <style type="text/css"> .titlestyle { color:black; text-align: center; font-family: stencil std; } </style> i planning use file , style within in php or html script. heard word include or require might needed, please me situation? thanks! consider having separate header file header.php. header.php <html> <head> <title>title</title> <link rel="stylesheet" type="text/css" href="layout.css"/> </head> and include file wish <?php include 'header.php'; ?>

ios - SDWebImage Library - placeholder from URL -

i'm using sdwebimage download , cache images in uitableview asynchronously i'm having problems. the scenario following: when cell created want load low quality blurred image (1-2kb) url, before real image comes in. after higher quality image downloaded, want show one. until now, i've tried these options, neither 1 seems work way expect: 1: sdwebimagemanager *manager = [sdwebimagemanager sharedmanager]; [manager downloadimagewithurl:[nsurl urlwithstring:lowqualityimageurl] options:0 progress:^(nsinteger receivedsize, nsinteger expectedsize) {} completed:^(uiimage *image, nserror *error, sdimagecachetype cachetype, bool finished, nsurl *imageurl) { if (finished) { cell.pictureview.image = image; [manager downloadimagewithurl:[nsurl urlwithstring:highqualityimageurl] ...

css - Inline block challenges and suggestions for the layout -

i keep reading articles floats outdated , using inline-block solves problems such having use clearfix , few more. these articles go on justify inline-block showing same example: 3 squares aligned middle. in trying use inline-block create navbar, come across many problems. navbar layout looks such: <nav id="main-nav" class="navbar"> <div class="logo"> <!-- image --> </div><!-- --><div class="navbar-header"><!-- --><button type="button" class="navbar-toggle closed"> <span class="sr-only">toggle navigation</span> <i class="fa fa-bars"></i> </button> </div> <div class="navbar-collapse navbar-sidebar"> <ul class="navbar-nav"> <!-- list-items --> </ul> </div> ...

json - Kimono Labs takes forever to create API -

Image
when try create api webpage using kimono lab, takes forever create it(it's stuck on create api screen). i've tried using google chrome extension yields same problem. cleared cookies , browsing data still won't work. reasons why it's not working. i having same issue , thought wasn't working, happened let sit there while grabbed dinner , on 2 hours later, worked , created api. i have verified takes long time using both chrome , firefox, extension , bookmarklet. not sure why takes long, try letting go while.

How to use Java 8 Collectors groupingBy to get a Map with a Map of the collection? -

imagine these classes class subject { private int id; private type type; private string origin; private string name; subject(int id, type type, string origin, string name) { this.id = id; this.type = type; this.origin = origin; this.name = name; } // getters , setters } enum type { type1, type2 } i have list of subject classes list<subject> subjects = arrays.aslist( new subject(1, type.type1, "south", "oscar"), new subject(2, type.type2, "south", "robert"), new subject(3, type.type2, "north", "dan"), new subject(4, type.type2, "south", "gary")); i result of using collectors.groupingby() map grouping first subject objects subject.origin , grouped subject.type getting result object map<string, map<type, list<subject>>> groupingby accepts downstream collector, can groupingby : subjects.str...

android - Passing data to AsynTask -

when pass arg way works: new merrtedhenatedegeve().execute("https://navigator.bkt.com.al/bktnavigator/al/deget/al_ilamre_deget.php"); when pass arg way crashes: sh_d sh_d_instance = new sh_d(); new merrtedhenatedegeve().execute(new string(sh_d_instance.deshifro(url_deget))); this async class: class merrtedhenatedegeve extends asynctask<string, string, string> { // marrja e te dhenave te degeve protected string doinbackground(string... args) { // ketu po krijojme parametrat qe te na duhet per te krijuar querin ne db list<namevaluepair> params = new arraylist<namevaluepair>(); // ketu po bejme kerkesen per tek serveri dhe presim te marrim pergjigjen e json ne string jsonobject jsondega = jparserdega.makehttprequest(args[0], "get", params); try { // si fillim kontrollojme nqs kemi sukses ne marrjen e te dhenave apo jo int sukses = jsondega.getint(tag_sukses); ...

Push notification reaching ios (apns) but not android (gcm) device -

so have simple ruby app uses rpush send push notifications iphone , android phone. right sends iphone. not sure whether problem script (i.e. incorrect values registration_id , app_name , or auth_key ), or whether problem how have android app configured. the relevant part of code here (values changed security - format/length of keys left untouched make sure "look right" people experience) api setup/rationale (sending notification) # gcm app = rpush::gcm::app.new app.name = "myapp" app.auth_key = "pofasyfghilk3l-uesvrlmbawcrthcwkwmcygem" app.connections = 1 app.save n = rpush::gcm::notification.new n.app = rpush::gcm::app.find_by_name("myapp") n.registration_ids = ["dergv80jk-s:apa91bhgerskbnrhhndes947nmkxi116tc3-k-tgd-ht5nzvc8qawekvcrmwrvs78rul8-vvhp2ultoevqzznn8gsr9t6wdxdypgfcliqajzj0xbybgbi0bm-ryufjcxfcc_5lel381f"] n.data = { message: "testing!" } n.save! rpush.push i determined name of app "myapp" loo...

beautifulsoup - Mobile Site not giving correct Data - Beautiful Soup -

i'm trying product details following website. baby shampoo tcin:# , product details. information not showing in page when parse it. a simple line like: spans = soup.find_all("span", {"class" : "list-value"}) is turning no results, , when go more basic to: print(soup.prettify) i see page print out none of details in page. not seeing iframes on page, , can't figure out why data not showing. i attempted adjust headers in request: headers = { 'user-agent': 'mozilla/5.0 (linux; <android version>; <build tag etc.>) applewebkit/<webkit rev> (khtml, gecko) chrome/<chrome rev> mobile safari/<webkit rev>'} and also: headers = { 'user-agent': 'mozilla/5.0'} but neither of these changing results. ideas happening, , data located? thanks, mike if see network requests through chrome developer options or firefox firebug, can see http , post requests made , have find...

php - Alternatives to refresh to avoid blacklisting -

i run php script interfaces twitter api off website. trivia bot that, @ defined intervals, sends calls api send , receive tweets (send trivia question , choices, replies answers, send correct answer, etc.). automate, use meta refresh tag. operate bot, open script on browser , leave alone, refresh , run script repeatedly. this works should, except after 90 minutes of continuous use, triggered blacklisting of ip webhost. tech support recommended "refreshing less often," affect intended product. not information limits before blacklisting triggered. clearly reloading web page no-no provider, short of changing providers, there alternatives meta refresh (or really, refreshing of page) still allow repeated, automated calls twitter api?

jboss - How to inject a logging statement before every catch block in java -

i started aspect oriented programming using jboss , , have implemented code injection - before , after method gets called , after method throws exception. want know how inject code within method ? want inject logging statement before every catch block gets executed , how using java ? i not know jboss aop, in case can use aspectj because features handler() pointcut. driver application: package de.scrum_master.app; import java.io.filenotfoundexception; import java.io.ioexception; import java.util.random; import java.util.concurrent.timeoutexception; import javax.naming.namingexception; public class application { public static void throwrandomexception() throws timeoutexception, ioexception, namingexception { switch (new random().nextint(5)) { case 0: throw new timeoutexception("too late, baby"); case 1: throw new filenotfoundexception("file.txt"); case 2: throw new ioexception("no read permissi...

tsql - SQL server identity or a self calculated sequence -

i designing database. want define automatic sequence on table primary key field. best solution it? i know can enable identity property field, has problems ( example seed jumps on restart , unsuccessful events) i can use calculated sequences. example can calculate max of filed values , after incrementing use key new inserted record. which 1 better? there solution? to mind there's 3 options: identity - simplest, can have gaps when server restarted etc. sequence - separate object, have still gaps in case of rollback a separate table numbers - won't have gaps, can hotspot can cause blocking.

jquery - How to check on ajax success when the server response is true or false? -

i have server response true or false . have been trying figure out how check on success if returned value true or false following script : $('form[data-async]').on('submit', function(event) { var $form = $(this); var $target = $($form.attr('data-target')); $("input#login").val('connexion...'); $.ajax({ type: $form.attr('method'), url: $form.attr('action'), data: $form.serialize(), cache: false, success: function(data) { if (data == true) { alert('success : user logged in'); } else { alert('erreur login'); } }, error: function(){ alert("failure"); } }); event.preventdefault(); }); i have been trying possible value data data == 'true' & data == 1 still not working. idea please ? here called function : function login ($username, $password){ if (!isset($_session['vivvo...

neo4j - Cyper - odd error when creating relationship -

i've got following query, responds cryptic error message of "invalid input 'h': expected 'i/i' (line 2, column 2)" here's query: create unique (c:accountcharge)-[:account_charged]->(a:account) (a.id = "a7f7def6-8f2b-4b21-bfac-dab2f6e6eaae") , (c.id = "666b1865-e29d-455b-abb0-50d679952543") both nodes exist, , can't see there's break anywhere, neo4j not @ all. the query's being created c# neo4jclient, retyping manually still same error, it's not hidden character or anything. where can used match clause. the expected i because cypher possible clause after create with clause, second letter instead of h. you should first match 2 nodes , create unique relationship afterwards

javascript - Hiding menu java script -

i trying hide 1 of drop down menu when user log-in or log-out, use $_session know if user logged in. wrong javascript. hope help. !!here code: the 2 drop down menu want hide/show: <li class="dropdown" id="account" > <a href="#" class="dropdown-toggle" data-toggle="dropdown"> account <b class="caret"></b> </a> <ul class="dropdown-menu" > <li><a href="#">login</a></li> <li class="divider"></li> <li><a href="#">register</a></li> </ul> <li class="dropdown" id="user"> <a href="#" class="dropdown-toggle" data-toggle="dropdown"> <?php if(isset($_session['username'])) { echo ' '.htmlentities($_session['username'], ent_quotes, 'utf-8...

java - How to open url on another tab at same browser using selenium webdriver? -

i want open url on new tab clicking on button add account. working framework, i've found solution don't understand how apply it. below code i've find element , return performing operations. can 1 let me know integrate code opening url in new tab, using code? private boolean operatewebdriver(string operation, string locator, string value, string objectname) throws exception { boolean testcasestep = false; try { system.out.println("operation execution in progress"); webelement temp = getelement(locator, objectname); if (operation.equalsignorecase("sendkey")) { temp.sendkeys(value); } thread.sleep(1000); driver.manage().timeouts().implicitlywait(5, timeunit.seconds); if (operation.equalsignorecase("click")) { temp.click(); //try open account on tab. string mywindow...

loops - PHP buttons in 'for' and onclick with parameter -

my problem want make 1 button each $i incrementation in loop, , on click of 1 button, must call include of php file, passing parameter (a link) included php. here have tried: for($i=0;$i<64;$i++){ $link="https://www.google.fr/search?q=$i"; //for example echo ' <form method="post"> <button name="button$link">hello</button> </form>'; // generate random string have random variable name (unique) $seed = str_split('abcdefghijklmnopqrstuvwxyz'.'abcdefghijklmnopqrstuvwxyz'.'0123456789'); shuffle($seed); $rand = ''; foreach (array_rand($seed, 5) $k){ $rand .= $seed[$k]; } $$rand=$link; //puts parameter (link) in dynamic variable if(isset($_post["button$$rand"])){ include("other.php"); // $$rand used in function } } so tried dynamic variables, part 'checks if button clicked' job out o...

c++ - How to update data at a particular line in a file? -

consider have following file ("testt.txt") abc 123 def 456 ghi 789 jkl 114 now if wanted update figure next name ghi (i.e. 789 ), how it? the following code helps me reach there no doubt, how update quickly? #include<iostream> #include<fstream> #include<string> using namespace std; int main() { int counter = 0; string my_string; int change = 000; ifstream file ( "testt.txt" ); while(!file.eof()) { counter = counter + 1; getline(file, my_string, '\n'); if (my_string == "ghi") { ofstream ofile ( "testt.txt" ); (int = 0; < counter + 1; i++) { //reached line required i.e. 789 //how process here? } ofile.close(); break; } } cout << counter << endl; file.close(); return 0; } clearly counter here 5 corresponding ...

c# - Nunit runsTestCase with a TestCaseSource with the first iteration having no parameters? Why? -

hi new nunit , passing series of objects testcase testcasesource. reason though nunit seems run test first no parameters passed results in ignored output: the test: private readonly object[] _nunitisweird = { new object[] {new list<string>{"one", "two", "three"}, 3}, new object[] {new list<string>{"one", "two"}, 2} }; [testcase, testcasesource("_nunitisweird")] public void thecountsarecorrect(list<string> entries, int expectedcount) { assert.areequal(expectedcount,calculations.countthese(entries)); } thecountsarecorrect (3 tests), failed: 1 or more child tests had errors thecountsarecorrect(), ignored: no arguments provided thecountsarecorrect(system.collections.generic.list 1[system.string],2), success thecountsarecorrect(system.collections.generic.list 1[system.string],3), success so first test ignored because there no parameters, don't want te...

tomcat - Spring Autowired with abstract inheritance error -

consider situation: i have class , b , c. class b extends abstract class , class c want use class b member perform operations. @service public abstract class a{ } @component public class b extends a{ } @service public class c { private class b b; @autowired public c(class b b){ // constructor this.b = b; } private void setb(b b){ this.b = b; } private b getb(){ return b; } } when ever try component scan, tomcat not load. have successful inject beans in way non inherit objects. the error receive listen start error: jun 14, 2015 12:09:04 pm org.apache.catalina.core.standardcontext startinternal severe: error listenerstart jun 14, 2015 12:09:04 pm org.apache.catalina.core.standardcontext startinternal severe: context [] startup failed due previous errors jun 14, 2015 12:09:05 pm org.apache.catalina.loader.webappclassloader checkthreadlocalmapforleaks thanks assistance. there dependencies issue able print ...

ios - SDWebImage can load the sandbox picture? -

one of programs load webp image sdwebimage . have feature downloads webp image server , save in sandbox. don't know how use sdwebimage read webp image in sandbox. display interface. i tried following: [self.img1 sd_setimagewithurl: [nsurl fileurlwithpath:[cachesdir stringbyappendingpathcomponent: [nsstring stringwithformat:@"jsoncache"]]]//local picture placeholderimage:img options:sdwebimagelowpriority progress:^(nsinteger receivedsize, nsinteger expectedsize) { } completed:^(uiimage *image, nserror *error, sdimagecachetype cachetype, nsurl *imageurl) { self.img1.image = image; }]; but error... so should do...?

visual c++ - printing pdf file on printer using c++ -

in c++ application (dll) printing bitmaps without using print dialogue i.e. end code without prompting user select file. functionality working fine. trying implement method print existing pdf file on printer. exisiting function specific bitmaps, confused how can send pdf file printer. following working code docinfo didocinfo = {0}; didocinfo.cbsize = sizeof( docinfo ); didocinfo.lpszdocname = l"printtest"; if( startdoc( memdc.getsafehdc(), &didocinfo ) > 0 ) { if( startpage( memdc.getsafehdc() ) > 0 ) { cbitmap bitmap; cimage frontimage; frontimage.load(_t("c:test.bmp")); bitmap.attach(frontimage.detach()); bitmap bm; bitmap.getbitmap(&bm); int w = bm.bmwidth; int h = bm.bmheight; // create memory device context cdc tempdc; tempdc.createcompatibledc(&memdc); cbitmap *pbmp = tempdc.selectobject(&bitmap); tempdc.setmapmode(memdc.getmapmode()...

iis 6 - same server, get url: vbscript msxml3.dll 80004005 unspecified error, or msxml6.dll error '80072ee6' System error: -2147012890 -

Image
what's correct way output of asp page located on same server? <% geturl "/route/to/abc/123/" function geturl(url) set objxmlhttp = createobject("msxml2.serverxmlhttp.3.0") objxmlhttp.open "get", url, false objxmlhttp.send() if objxmlhttp.status = 200 response.write objxmlhttp.responsetext end if set objxmlhttp = nothing end function %> results in pesky error. msxml3.dll error '80004005' unspecified error /test.asp, line 7 switching newer serverxmlhttp set objxmlhttp = server.createobject("msxml2.serverxmlhttp.6.0") reveals different, more meaningful error: msxml6.dll error '80072ee6' system error: -2147012890. /test.asp, line 8 which google happily found reason to, says "don't use serverxmlhttp connect same server. ( https://support.microsoft.com/en-us/kb/316451 ) use? article didn't offer much. anyway cool, there's proper reason error. use connect...

polymer 1.0 - Styling issue in polymer1.0 -

i not able assign dynamic value margin-left of element inside dom-repeat. <template id="test" is="dom-repeat" items="{{viewelements}}"> <span style$="margin-left:{{item.stpt}}">{{item.stpt}}</span> </template> use computed binding: <template id="test" is="dom-repeat" items="{{viewelements}}"> <span style$="[[_computedclass(item.stpt)]]">{{item.stpt}}</span> </template> ----- _computedclass: function(value) { return 'margin-left:' + value + ';' }

ios - Having issue with asynchronous processing using Parse -

i have parse database has records consisting (among other items) of pffile items of thumbnail images. database read-only , created using program. confirmed thumbnails in parse. when try retrieve thumbnails using function shown below, notification before images processed resulting on occasional failures based on timing of post-notification processing. how can ensure records processed? func convertpfilestoimages () { println("convertpfilestoimages") let notification = nsnotification(name: "imagesloaded", object: self) in 0 ..< records.count { let userimagefile = records[i].icon records[i].image = uiimage() println("name: \(self.records[i].name) image: \(self.records[i].image)") userimagefile.getdatainbackgroundwithblock { (imagedata: nsdata?, error: nserror?) -> void in if error == nil { //println("no error") if let imagedata = imaged...

PayPal Open SSL exception certificate B verify failed - rails -

i'm trying paypal live settings work , keep getting error when attempting purchase paypal on site: exception type: openssl::ssl::sslerror exception message: ssl_connect returned=1 errno=0 state=sslv3 read server certificate b: certificate verify failed request i have cacert.pem file , exists in correct location on application. i'm not sure issue is? thanks

java - Spring 3.2.5 form tag radioButtons behavior -

can iterate collection of objects in form:radiobuttons in spring 3.2.5? for instance in addemployee.jsp, <td><form:radiobuttons path="empdepartmentname" items="${departments}"/></td> and method populate departments, @requestmapping(value = "/", method = requestmethod.get) public string homepage(modelmap map) { map.addattribute("employee", new employee()); populatedepartments(map); return "addemployee"; } private void populatedepartments(modelmap map){ list<string> departments = new arraylist<string>(); departments.add("dept 1"); departments.add("dept 2"); map.addattribute("departments", departments); } can departments list<department> , allow client select department name ui , map selected department directly in employee entity instead of going through transient variable empde...

google apps script - Using the contents of an array outside a function -

is there possibility use contents of array in function? example, have following code: var locations = []; function values() { var values = ['test1','test1'] (i in values) { locations.push(values[i]); } } logger.log(locations) now logs nothing, if place logger in function, returns contents of array. call function values(); this var locations = []; values(); function values() { var values = ['test1','test1']; (i in values) { locations.push(values[i]); } } logger.log(locations);

Send email with template (Mandrill JSON) -

hi i've created html email template using apache velocity . i'm trying send email through mandrill json api. there known html template in mandrill. but there way send html subject content generated velocity passed string value mandrill , mandrill render html send email. please suggest better alternatives mandrill (eg:amazon ses, know of) system developed in java. take @ sendwithus . provide template management , sending api on top of mandrill, , know support dynamic subject lines. docs here.

javascript - understanding pure js Event function -

i going through source of pace.js , came across following function , :: evented.prototype.trigger = function() { var args, ctx, event, handler, i, once, _ref, _ref1, _results; event = arguments[0], args = 2 <= arguments.length ? __slice.call(arguments, 1) : []; if ((_ref = this.bindings) != null ? _ref[event] : void 0) { = 0; _results = []; while (i < this.bindings[event].length) { _ref1 = this.bindings[event][i], handler = _ref1.handler, ctx = _ref1.ctx, once = _ref1.once; handler.apply(ctx != null ? ctx : this, args); if (once) { _results.push(this.bindings[event].splice(i, 1)); } else { _results.push(i++); } } return _results; } }; now understanding plain js, bit of challenge me, still went through independent components , methods used in function, not able figure out function doing in plugin. can explain? if can give me genuine general idea enough. also can function used independent of plu...

Cant find File System, Registry icon in WIX setup project in Visual Studio -

Image
i installed wix in machine. followed video of https://www.youtube.com/watch?v=cofpyibcqn8 enter link description here i can not find way add file systems, no icon it, no context menu entry on project. i using visual studio 2012. that's add-in express designer wix in video. it's paid component. installing wix on system adds project templates visual studio. it's free installer/packaging engine uses xml (scripting) build msi's , etc , doesn't come designer. wix quite steep learning curve, if want editor suggest check out package & deployment add-in microsoft re-introduced vs2013, it's on visualstudio gallery. brian harry blogs here: http://blogs.msdn.com/b/bharry/archive/2014/04/18/creating-installers-with-visual-studio.aspx

ruby - How to change rails model object variable names that holds object of another model -

say have model , associated schema defined. class memory < activerecord::base belongs_to :memory_slot end class memoryslot < activerecord::base has_many :memories end now typically let me can access memory slots of memory via @memory.memory_slot.name . want access via different method @memory.supporting_memory_slot.name . best way can that? you won't need new migration, can use previous memory_slot_id , , still can change name following: class memory < activerecord::base belongs_to :supporting_memory_slot, class_name: 'memoryslot', foreign_key: 'memory_slot_id' end class memoryslot < activerecord::base has_many :memories end this way, if had records saved previously, work in current scenario well. if generate new migration, old records saved not accessible, because used using foreign_key memory_slot_id .

c++ - How can I debug an bmac project in omnet? -

how can debug omnet++ project bmac or imac. omnet++ version: 4.6 want debug bmac project. need change configuration of simulator? thank full have solution. your question broad. if, debugging simulation mean running simulation in debugger gdb , see this other answer . for general tips on debugging in sense of finding errors, might find this article on omnet++ wiki helpful .

java - Image as a background in JScrollPane -

how add image background in jscrollpane? tried image doesn't display: bufferedimage img = null; try { img = imageio.read(new file("c:\\users\\suraj\\documents\\netbeansprojects\\javaapplication2\\src\\javaapplication2\\images\\2.jpg")); } catch (ioexception e) { e.printstacktrace(); } image imag = img.getscaledinstance(d.width, d.height, image.scale_smooth); imageicon imageback = new imageicon(imag); flowlayout fl = new flowlayout(); frame.getcontentpane().setlayout(fl); fl.addlayoutcomponent(null, new jlabel(imageback)); edit : add jlabels , jbuttons on jscrollpane background if goal show image in jscrollpane without showing other components (such jtable) in jscrollpane, should: make imageicon out of image via new imageicon(myimage) add icon jlabel place jlabel jscrollpane's viewport, can done passing jlabel jscrollpane's constructor. and done. if need else, describe problem in great...

android - Why are these buttons mis-aligned in a TableLayout? -

Image
i'm using table layout arrange buttons. long use same font labels aligned in each row. for buttons i'd use icons custom ttf font. when use such icon, button placed higher, so: (this image scaled make the problem more evident.) i took measurements - buttons appear of same height, regardless of used font. why buttons not aligned properly? have suggestion them aligned? thanks. following commonsware's advice (thanks quick replies!), tried this: final linearlayout.layoutparams layoutparams = new linearlayout.layoutparams(viewgroup.layoutparams.match_parent, viewgroup.layoutparams.wrap_content); layoutparams.gravity = gravity.center_vertical; row.setlayoutparams(layoutparams); this did not work. try base alignment comment next. add following attribute tablerow : android:baselinealigned="false" by default, button labels' base lines vertically aligned causes offset experience.

node.js - failure to run mocha tests with sails -

i'm following sails docs , tried run mocha tests. i've edited package.json in way docs specified, reason when try run mocha eacess, permission denied error. at first got: error: eacces, permission denied '/library/application support/apple/parentalcontrols/users' i didn't understand why has running tests, added required permission folder. then got: error: eacces, permission denied '/library/application support/applepushservice' again, didn't understand, changed permission on folder, didn't also. i'm not understanding why mocha need permissions on these files , or how fix it. i ran command : mocha test/bootstrap.test.js test/unit/**/*.test.js and project structure same in sails tutorials. i'm using mocha@2.2.5 . co-worker cloned repo, , tried run tests on machine, failed same errors. i tried downgrading mocha@2.2.0 didn't also. the full error trace: events.js:85 throw er; // unhandled 'error...

Docusign Salesforce Logout/switch account -

we working on docusign project, our sandbox connected our docusign production org. connect sanbox instead. can me can change docusign account in salesforce sandbox. can me this? you can try these steps : in sf sandbox org: use setup->create->tabs create tab docusign account configuration object. open docusign account configuration tab , pick “go”. there should 0 or 1 object if there one, delete it. go docusign admin tab don’t perform setup steps. creates new docusign account configuration object. go docusign account configuration tab, open single object, edit , change environment dropdown point ds environment want use (preview, demo), pick save. go docusign admin tab , configure connection ds using creds ds envrionment.

javascript - how to use document.getElementsByClassName("classname") with style.animation -

getelementbyid works since ids have unique , function returns 1 element (or null if none found). got struck class name. how can add style.animation class name ? function myfunction() { document.getelementsbyclassname("mydiv").style.webkitanimation = "mynewmove 4s 2"; document.getelementsbyclassname("mydiv").style.animation = "mynewmove 4s 2"; } .mydiv { width: 100px; height: 100px; background: red; position: relative; -webkit-animation: mymove 1s infinite; /* chrome, safari, opera */ animation: mymove 1s infinite; } @-webkit-keyframes mymove { { left: 0px; } { left: 200px; } } @-webkit-keyframes mynewmove { { top: 0px; } { top: 200px; } } @keyframes mymove { { left: 0px; } { left: 200px; } } @keyframes mynewmove { { top: 0px; } { top: 200px; } } <button onclick="myfunction()">try it...

unix - Permission Denied error setting 777 folder access -

i created user admin access named hadoop. funny thing when create folder , try give 777 access gives me error. hadoop@linux:~$ mkdir testfolder hadoop@linux:~$ ls -ltra testfolder/ total 8 drwxrwxrwx 25 hadoop sudo 4096 jun 14 20:00 .. drwxrwxr-x 2 hadoop hadoop 4096 jun 14 20:00 . hadoop@linux:~$ chmod -777 -r testfolder/ chmod: cannot read directory ‘testfolder/’: permission denied why when creator of directory ? hadoop@linux:~$ groups hadoop root sudo strangely, using gui, can go in , right click directory , change file permissions. can me understand not understanding. note : use ubuntu 14 your command chmod -777 -r testfolder/ issue here, more specific - part of first argument. leave away, use chmod 777 -r testfolder/ , should fine... not sure details, -777 should remove permissions, preventing access @ least recursive portion of command. assume not want do. instead want grant more permissions directory. looks command blocks itself. though might...

php - trouble of show http image in https -

i need embed http image in https website, because if use <img src="http://www.sof.com/abc.jpg"/> not show in https website. after that, search topic of function, found <img src="https://www.some.com/image.php?url=http://www.sof.com/abc.jpg" /> can show in https so genarate 2 source. 1 image file: http://www.website1.com/abc.png , and https web adress https://fb.ccc.com after create image.php code below: <? $strfile = base64_decode(@$_get['url']); $strfileext = end(explode('.' , $strfile)); if($strfileext == 'jpg' or $strfileext == 'jpeg'){ header('content-type: image/jpeg'); }elseif($strfileext == 'png'){ header('content-type: image/png'); }elseif($strfileext == 'gif'){ header('content-type: image/gif'); }else{ die('not supported'); } if($strfil...

jquery - How to execute JavaScript function in an Ajax() Response -

i have home page load ajax() response , post ul li content, same page have script function can select li content trigger function, isn’t working. page 1 html <ul id="feature-deals" class="list-products allshopping-deals"> </ul> script $(document).ready(function(){ $.ajax({ url: "product/shopping-trending-items.php", success: function(result){ $(".allshopping-deals").html(result); } }); $(".products").click(function (){ alert ($('.pid', this).text()); page 2 html <li class="products"> <span class="pid">1234</span> </li> page 1 == home page w/(ajax() load function + click function) ----> page 2 == li content holding pid , waiting load ajax() ----> target output alert pid value script in page 1 you should delegate event: $(".allshopping-deals").on('click...

ios - Centering MKMapView on spot N-pixels below pin -

Image
want center mkmapview on point n-pixels below given pin ( which may or may not visible in current maprect ). i've been trying solve using various plays -(cllocationcoordinate2d)convertpoint:(cgpoint)point tocoordinatefromview:(uiview *)view no success. anyone been down road ( no pun intended )? the easiest technique shift map down, 40% coordinate be, taking advantage of span of region of mkmapview . if don't need actual pixels, need move down cllocationcoordinate2d in question near top of map (say 10% away top): cllocationcoordinate2d center = coordinate; center.latitude -= self.mapview.region.span.latitudedelta * 0.40; [self.mapview setcentercoordinate:center animated:yes]; if want account rotation , pitch of camera, above technique may not adequate. in case, could: identify position in view want shift user location; convert cllocation ; calculate distance of current user location new desired location; move camera distance in direction 180°...

How should I add a stationary progress bar to a C++ program that produces terminal output (in Linux)? -

i have existing program contains loop on files. various things, providing lots of terminal output. want have overall progress bar remains stationary on same line @ bottom of terminal while of output file operations printed above it. how should try this? edit: so, clear, i'm trying address display problems inherent in bit following: #include <unistd.h> #include <iostream> #include <string> using namespace std; int main(){ (int = 0; <= 100; ++i){ std::cout << "processing file number " << << "\n"; string progress = "[" + string(i, '*') + string(100-i, ' ') + "]"; cout << "\r" << progress << flush; usleep(10000); } } the portable way of moving cursor around know of using \r move beginning of line. mention output stuff above progress. fortunately, in luck since you're on linux , can use terminal escape codes move around ...