Posts

Showing posts from April, 2010

applescript - Funny issue with using automator to set quicktime window position -

i'm using applescript within automator start quicktime recording. when run applescript automator, works fine, when run same automator sequence double-clickable application, throws error* when gets line: tell application "system events" tell process "quicktime player" set position of front window {1131, 725} any ideas why? thanks!! *the error just, "the action “run applescript” encountered error" you might getting error because application doesn’t have permission access gui scripting. however, can position , resize windows in quicktime player without gui scripting this: tell application "quicktime player" tell window 1 set bounds {100, 100, 640, 480} end tell end tell the 4 numbers set bounds x position, y position, window width, window height. above script tells first window position 100 pixels away top of screen, 100 pixels away left of screen, , 640 pixels wide , 480 pixels tall. look in quicktim

How do I detect the url of where the user is coming from in Javascript/Angularjs? -

i want detect origin url of user entering website (such perform operations later). can achieved using angular? are looking referrer? var x = document.referrer;

ios - Cannot signal semaphore with Firebase observeEventType - what gives? -

i using firebase read/write data remote server. my objective write routine takes callback function. heres routine should accomplish: write data firebase (this works fine) observe changes on above written data if change occurs call callback success if timeout triggered, call callback failure im unable figure out why steps 2-4 failing me. below snippet of code here's whats going on in code: it sets gcd semaphore it writes data root firebase url - adds user called joe. works fine. can see data written vulcan it sets reference joe's node , watches events on childadded joe. here api reference upon getting event signals semaphore, should call callback message "success" instead see "timeout" message. strangely though observer print out newly added key:value pair, doubly confusing! whats going on here? using semaphores incorrectly? or using firebase's api incorrectly? typealias completionfoo = (gid:string) -> void func setstate

innodb - MySQL auto increment column -

i see weird behavior auto-increment column number increasing in step of 2 instead of 1. end row ids 1, 3, 5, 7. use mysql 5.6 + innodb engine. idea why weirdness? mysql> select version(); +-----------------+ | version() | +-----------------+ | 5.6.20-68.0-log | +-----------------+ 1 row in set (0.00 sec) mysql> show create table temp_table; | superset_version | create table `temp_table` ( `_id` int(11) not null auto_increment comment 'comm1', `name` varchar(100) not null comment 'comm2', `start_time` bigint(20) not null comment 'comm3', `updated_at` bigint(20) not null comment 'comm4', `status` varchar(50) not null comment 'comm5', primary key (`_id`) ) engine=innodb auto_increment=27 default charset=utf8 | notice insert incremented _id column difference of 2. mysql> insert superset_version(name, start_time, updated_at, status) value("temp row", -1, -1, "erro"); query ok, 1 row affect

Trying to get "read_insights" approval from Facebook -

Image
i have webservice allow facebook user create account , create reports/charts of facebook page insights. having problem getting through fb approval process. i have website working. using own account, able sign on service , pull in of facebook "pages". , report page insights on them (e.g. fans country). suspect able since "admin" (see screen shot below): when facebook did review, appears used account did not have associated "pages". created account, state not able select profile within service (you pick fb page , can report on different page metrics). working me. i see there area can create "test users": and test user signed in , created page it. understanding these not "real fb accounts". used approval process. anyways, should providing fb name of "test" account? , use during approval process? facebook's review team testing these "test users", mentioned correctly not real facebook accounts,

How to get the "key" in ENV variable in perl script -

i new user of perl script. trying modify script required output data. however, not sure how make changes in below statements related environmental variables: $cmiss_root=$env{cmiss_executable}; $cmgui_root=$env{cmgui_2_6_2}; $root=$env{root}; i think key between { } showed location of files. so, if change keys between { }, how can them? apology ignorant question bit confused how construct statement $env. thanks. if wish find out environment variables there are my @names_of_enviroment_vars = keys %env; will tell you. if wish change value of environmental variable can set useing. $env{root} = '/new/value/for/root/'; not setting environmental variables effect particular perl script , executable perl script launches.

ios - How can I show a popup of an image at the location the button was clicked? -

i have uibutton fills entire screen. want is: find location of button tapped , make image appear @ location in swift. i'm having trouble determining uibutton tapped. i've searched everywhere , have found nothing. thanks. if i'm reading correctly, looks don't want use uibutton , but, rather, normal uiview uitapgesturerecognizer .

reactjs - Has anyone gotten Push Notifications to work successfully with React Native? -

just general question, want build iphone using react native, need push notifications (and websockets), , want check if has been able them work. thanks! yes. have push notification via parse in production , use them heavily in our chat client.

java - JQuantlib missing extensions -

i working on big project requires massive financial calculations, using netbeans ide 7.3 default web application of java ee 5 (not maven application) ,my application server tomcat 7 using jsps , servlets os windows 7. i downloaded , added jquantlib binary application, when run keeps saying needs slf4j-api extension not found download , added jar project still error persists. how can solve ? , can give me guidelines on how ? the key here jquantlib requires slf4j-api version 1.4.0 in jar manifest: (from manifest.mf in jquantlib.jar) implementation-vendor-id: org.jquantlib extension-list: slf4j-api slf4j-api-extension-name: slf4j-api slf4j-api-implementation-version: 1.4.0 tomcat try use version of slf4j-api you're including in app, it's you've included isn't compatible. see http://grepcode.com/file/repo1.maven.org/maven2/org.apache.tomcat/tomcat-catalina/7.0.34/org/apache/catalina/util/extension.java#extension.iscompatiblewith%28o

qml - TreeView is not syntax highlighted -

qt creator 5.5 doesn't syntax highlight treeview both in windows , macos. import qtquick 2.5 import qtquick.window 2.2 import qtquick.controls 1.4 applicationwindow { visible: true width: screen.width /2 height: screen.height/2 treeview { anchors.fill: parent } } treeview marked red underlined if not recognized qt creator compile , run fine. why not syntax highlighted properly? i think it's bug, because required modules imported. you can suppress warning using //@disable-check m300 before line treeview { import qtquick 2.5 import qtquick.window 2.2 import qtquick.controls 1.4 applicationwindow { visible: true width: screen.width /2 height: screen.height/2 //@disable-check m300 treeview { anchors.fill: parent } }

sftp - Notepad++ NppFTP authenticated, no error, no files, no folders -

nppftp hanging when connecting without error message. on starting notepad++, nppftp - disconnected , displayed (correctly) in nppftp window. selecting (dis)connect button , profile starts connecting normally. in nppftp - output window following displayed: [nppftp] initialized connecting [sftp] host key accepted [sftp] banner: ~~~~ [sftp] authenticated everything stops here. rest of nppftp buttons "light up" after connecting , files , folders can browsed. settings , show messages buttons work. the nppftp window says nppftp - connecting . notepad++ continues work @ point nppftp stuck. notepad++ must restarted put nppftp in disconnected state enable (dis)connect button . i'm using private key file authentication passphrase. it's worked before not now. ideas? notepad++    v6.1.5 nppftp        v0.2.4 you put output .bashrc . makes ssh sessions work fine tm , makes sftp sessions fail. if want have output after login, should

Excel counting line items and not the count from the requested macro -

using simple macro: function countitalics(r range) long dim ri range each ri in r countitalics = countitalics - ri.font.italic next ri end function this count number of italics not information in italic cell range, meaning: 3 cells not merged count 1 but this: 3 cells merged count 3 (i merged 3 cells make one). you try function countitalics(r range) dim ri range each ri in r if ri.font.italic countitalics = countitalics + 1 / ri.cells.mergearea.count next ri end function

java - Is there a good way to use Slf4j to log certain event to a separate log file? -

i using slf4j logging in java service, type of events, want create separate log file it. is possible use slf4j implement that? slf4j abstraction helps interface various logging frameworks - need select logging framework too. below example logback - if prefer other frameworks (jul, log4j2), same concept works well. what need log special events under specific logger: logger logger = loggerfactory.getlogger("my.special.events"); logger.info("oh my! has happened!"); then set logback (or framework of choice) send events coming via logger destination (another appender) too: <configuration> <appender name="stdout" class="ch.qos.logback.core.consoleappender"> <encoder> <pattern>%msg%n</pattern> </encoder> </appender> <appender name="special" class="ch.qos.logback.core.fileappender"> <file>specialevents.log</file> <enc

ios - Setting UIView to Start From Upper-Left Corner (0,0) -

i adapted uipangesturerecognizer use pull-down dismiss view. made this, view can dragged in y-axis , if change in y greater 100, dismisses view. override func viewdidload() { super.viewdidload() let mypangesturerecognizer = uipangesturerecognizer(target: self, action: "mypanaction:") self.player.view.addgesturerecognizer(mypangesturerecognizer) } func mypanaction(recognizer: uipangesturerecognizer) { let translation = recognizer.translationinview(self.view) if let myview = recognizer.view { myview.center = cgpoint(x: myview.center.x, y: myview.center.y + translation.y) } recognizer.settranslation(cgpointzero, inview: self.view) if recognizer.state == uigesturerecognizerstate.ended { let velocity = recognizer.velocityinview(self.view) if velocity.y > 100 { dismissviewcontrolleranimated(true, completion: nil) } else { // reposition

Excel VBA pasting to multiple ranges -

Image
i trying paste formula multiple ranges. have long list of ranges want paste to. there way loop through list without having write code each range? tried pasting list of ranges 1 line it's long 1 line range('lcm-00 (2)'!$j$57:$y$57).copy range('lcm-00 (2)'!$j$57:$y$57,'lcm-00 (2)'!$j$54:$y$54,'lcm-00 (2)'!$k$50:$y$50,'lcm-00 (2)'!$k$47:$y$47,'lcm-00 (2)'!$ab$57:$aq$57,'lcm-00 (2)'!$ab$54:$aq$54,'lcm-00 (2)'!$ac$50:$aq$50,'lcm-00 (2)'!$ac$47:$aq$47,'lcm-00 (2)'!$at$57:$bi$57,'lcm-00 (2)'!$at$54:$bi$54,'lcm-00 (2)'!$au$50:$bi$50,'lcm-00 (2)'!$au$47:$bi$47,'lcm-00 (2)'!$bl$57:$ca$57,'lcm-00 (2)'!$bl$54:$ca$54,'lcm-00 (2)'!$bm$50:$ca$50,'lcm-00 (2)'!$bm$47:$ca$47,'lcm-00 (2)'!$cd$57:$cs$57,'lcm-00 (2)'!$cd$54:$cs$54,'lcm-00 (2)'!$ce$50:$cs$51,'lcm-00 (2)'!$ce$47:$cs$47,'lcm-00 (2)'!$j$42:$y$42,'lcm-00 (2)

c++ - How to convert multiple chars to decimal value? -

i'm trying following: have vector of chars looks like: { '3' '2' 'a' '4' '4' 'a' '9' }. ('a' place holder i've added vector denote 1 value ends , other begins) i can't figure out how make chars 3 , 2 convert actual decimal value 32 , on 44 (9 not hard.) now before go , rate duplicate or "we won't homework" comments start showing up, want know i've omitted other steps i've successfully completed save , time. know atoi exists in c++ we're not allowed use them (along find_first_of or sort of library functions). believe ascii can job can't seem figure out. thanks. the intuitive leap you're missing char number you're using encode symbol of kind, has value. figure out value of numbers 0-9, , can use translate value of type char value of type int. (richard's example above 1 way of doing that, example.) and have digits of number, , have derive number t

javascript - JS: fullpage.js moveTo() among different section -

context: i'm trying move between different slides within section of fullpage.js clicking 1 of 5 elements. problem: the first moveto() - first slide of other 4 works perfectly. however, once on other slide, cannot navigate other slides clicking of elements. appreciated! my js: $(document).ready(function() { // move quality $( "#q" ).click(function() { $.fn.fullpage.silentmoveto('why', 1); }); $( "#d" ).click(function() { $.fn.fullpage.silentmoveto('why', 2); }); $( "#p" ).click(function() { $.fn.fullpage.silentmoveto('why', 3); }); $( "#z" ).click(function() { $.fn.fullpage.silentmoveto('why', 4); }); $( "#e" ).click(function() { $.fn.fullpage.silentmoveto('why', 5); }); }); $('#fullpage').fullpage({ css3: true, sectionscolor: ['white', 'grey', '#fff', '#fff'],

python - Theano dmatrix contains newaxis raise dimension mismatch -

the following snippet of definition of theano variable , function rbfnn. # theano tensor definition self.x = t.dmatrix('x') self.y = t.dmatrix('y') self.centers = t.dmatrix('centers') self.sigmas = t.dvector('sigmas') self.w = theano.shared(np.zeros((self.n_centers, self.n_classes)), 'w') self.b = theano.shared(np.zeros((self.n_classes,)), 'b') # build graph self.phi = t.exp(-t.sum(t.square(self.x[:, np.newaxis, :] - self.centers[np.newaxis, :, :]), axis=-1) / ( 2 * t.square(self.sigmas))) self.prob = t.mul(self.phi, self.w) + self.b self.pred = t.argmax(self.prob, axis=1) self.loss = t.mean(t.sum(t.square(self.y - self.prob), axis=1)) self.w_grad = t.grad(self.loss, self.w) self.b_grad = t.grad(self.loss, self.b) self.updates = [(self.w, self.w - self.learning_rate * self.w_grad), (self.b, self.b - self.learning_rate * self.b_grad)] # build

Why garbage collection? Why not compilers auto-insert free() instead? -

rather running garbage-detection periodically @ run time, why don't make compilers automatically insert free() @ appropriate places? way, pay price once @ compile-time. the compiler knows places variable goes out of scope or gets reassigned different object. so, can find out if object no longer reachable, , insert free() automatically there. can't it? why? if it's because of multithreading, can single-threaded/green-threaded languages then? the compiler knows places variable goes out of scope or gets reassigned different object. sure - variables. not clear variables - clear memory pointing to. , because variable went out of scope, not mean memory pointed no longer reachable. for example: y = ... { x = new x(); if (todayistuesday()) { y = x; } } // x went out of scope you can't make compile-time decision whether memory pointed x should freed @ last line of segment, because depends on day of week when code ran . so solve this, de

GWT RequestBuilder: How to handle pdf? -

i sending request on server, , server returns streamingoutput (wriring bytes of pdf file) in onresponserecieved need handle file , start download. how start download file? i supose dont need process data in javascript, you? if want download file or display in browser, create button in page when user clicks show in new window or user asked save file: final string url = "http://gwtquery.googlecode.com/git/readme.txt"; string name = "readme.txt"; anchor link1 = new anchor(name); rootpanel.get().add(link1); link1.addclickhandler(new clickhandler() { public void onclick(clickevent event) { window.open(url, "_blank", ""); } });

user interface - Using AutomationElement in C# -

Image
i'm trying use automationelement object uiautomation in c# not being recognized. i'm guessing it's not part of standard library since i'm getting hint visual studio saying might missing reference, reference need add use automationelement? i've tried uiautomationclient didn't work though should contain automationelement according microsoft documentation . hope can help in link posted have info, need add reference uiautomationclient (right click on project references) , add namespace system.windows.automation source

php - Display dropdownlist filter data? -

<?= $form->field($model, 'srf_student_id')->dropdownlist( arrayhelper::map(studentdetails::find()->all(),'student_registration_id','student_registration_id'), ['prompt'=>'select student id']); ?> how set condition in dropdownlist. want select student_registration_id studentdetails is_select = 0; data result set dropdownlist. please give me help. try this: <?= $form->field($model, 'srf_student_id')->dropdownlist( arrayhelper::map(studentdetails::find()->where(['is_select' => 0])->all(),'student_registration_id','student_registration_id'), ['prompt'=>'select student id']); ?>

mysql - getting error #1242 while deleting data from the table -

i trying delete data table , query below: delete mybadge uid=5 , badge_name=(select concat(tag_name,'-beginner') tag,post_tags post_tags.tag_id=tag.tag_id); i getting 5 records select statement, want delete 5 records. use- 'in' keyword instead of '=' sign delete mybadge uid=5 , badge_name in (select concat(tag_name,'-beginner') tag,post_tags post_tags.tag_id=tag.tag_id);

c++ - Gaussian Pyramid Out of Bounds -

i trying write own codes gaussian pyramid using c++. i tried both reduce , expand equations stated in http://persci.mit.edu/pub_pdfs/pyramid83.pdf , equation (1) , (2). however, array index out of bounds when trying access [2i + m][2j + n] , [(i - m) / 2][(j - n) / 2] , respectively. my gaussian kernel: 5x5 matrix; g1image: original image reduced 1 level, both row , column half of dimensions of original image's. my m , n set -2 < m/n <= 2 , when access gaussian kernel, add 2 index, becoming w[m + 2][n + 2] * original_image[2i + m][2j + n] i did try set m , n 0 < m/n <=4 well, equation becomes w[m][n] * original_image[2i + m][2j + n] or w[m][n] * original_image[2i + m - 2][2j + n - 2] any of mentioned equations out of bounds. w[m][n] * original_image[2i][2j] reduce equation , w[m][n] * g1image[i / 2][j / 2] expand equation working though. however, displayed image seems there no smoothing effect. can explain me how should set image dimen

c# - Executing services on multiple machines at same time -

i creating project remote monitoring application, consist of service hosted on individual machines. job of service collecct information regarding cpu usage, memory usage, etc. using wmi. service executes scan every 15 seconds using threading. want services on each machine executed @ same time. eg. 8.15, 8.30, 8.45. have written simple logix checks current second count , makes thread sleep time system reaches time falls either @ x.15, x.30, x.45 , etc. implementing not assure value collected service via wmi same process @ same time. eg. cpu usage machine 1 , cpu usage machine 2 should collected @ same time can compared @ run time. same goes other processes , metric values well. any appreciated. what's tolerance on "exactly same time?" within second? 10 milliseconds? if systems on same lan , have small network delays use zeromq setup tcp/ip publish-subscribe system fire pulse every 15 seconds causes systems take snapshot. if systems dispersed can use qu

ios - Can we enable Game Center for particular version? -

i new game center, after gone through game center in&out. have questions in mind, need clarification of guys: 1) can enable game center particular app version,(ie) previous app version 1.0 doesn't have game center feature, enable game center 2.0 app version. so, question is, if enable game center app version 2.0, whether can affect previous app version 1.0? 2) why of app not providing game center login feature inside app, instead of login via game center feature? 1) yes, can integrate game center in same app next version. not problem @ all. user notification update available once updated have feature. , previous version work fine if don't want update. 2) if app game center enabled means, has communicate many times in many ways. eg. score, update score, achievements, leader board , challenges. of above feature requires game center authentication proceed further. of app (even 1 created) needs game center login @ start after works smoothly. better ask authe

Converting Ruby to Python -

i'm trying convert ruby script python. i'm not familiar python getting typeerror . printer.rb lease = struct.new(:property, :renter) lease_list = [] file.open('input.txt').readlines.each |line| p, r = line.split(' - ') lease_list << lease.new(p.tr('#', ''), r) end # sort decimal value lease_list.sort_by { |m| m.property.scan(/\d+/)[0].to_i }.each |lease| puts "\##{lease.property} - #{lease.renter}" end printer.py import re class lease: def __init__(self, renter=none, unit=none): self.renter = renter self.property = unit lease_list = [] import sys lines = open('input.txt', 'r') line in lines: l, m = line.split(' - ') lease_list.append(lease(l,m)) lines.close() print lease_list.sort(key=lambda lease: re.split(r"\d+", lease.property)) python error traceback (most recent call last): file "printer.py", line 16, in <module> print lease_l

visual studio 2012 - SmartStore.net installation dramas -

i'm having issue running new project... it's smartstore.net version 2.x source downloaded , unzipped local dev machine (win 8.1 running iis 8.5) create new website in iis pointing "smartstorenet-2.x\src\presentation\smartstore.web" setup hosts file etc , set permissions on appdata, content, media, plugins configured vs21012 web proj use iis website created previously. build sln, good. run sln ctrl+f5 , recieve "503 service unavailable" browser app pool has shut down many errors. errors? if run without using iis , use inbuilt webserver in vs runs .less fails , there's no css. there .less plugin i'm missing? any ideas appreciated the minimum ide requirement smartstore.net visual studio 2013. should better try again vs 2015 community edition.

angularjs - Angular directive: compile is invoked, but not link -

i have following directive: angular.module('mymodule', []).directive('mydir', function () { return { scope: {}, restrict: 'e', link: function () { alert('hello!'); } }; }); and i'm using in template so: <my-dir attr1="hello" attr2="world" /> when load page, don't alert. however, if assign compile property instead of link property, alert. why not invoking link function, it's happily invoking compile ? note: tried return pre / post link object compile function, yet still doesn't invoke anything. doesn't matter if make <my-dir> self-closing (as above) or not. same code working me check this <html> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.0-rc.0/angular.min.js"></script> <script type="text/javascript"> var myapp = angular.module('myapp'

asp.net - Microsoft.Bcl.Build What is it used for -

i tried download , build dotnetopenauth.samples github . got error nuget.targets said the process cannot access file 'xxx\tools\microsoft.bcl.build.tasks.dll' because being used process . so checked in targets file. found <restorecommand>$(nugetcommand) install "$(packagesconfig)" -source "$(packagesources)" -o "$(packagesdir)"</restorecommand> caused error. in packages.config found <package id="microsoft.bcl.build" version="1.0.8" targetframework="net40" /> defined. since found project doesn't reference dll. comment package configuration. , rebuild it. error gone. but problem why package not being referenced in project while defined in package configuration? (microsoft.bcl.build) used for? thanks. updated forgot add information nuget. this package provides build infrastructure components projects referencing specific microsoft packages can build. do not direct

ios - Interface not drawn if becomeCurrentPage is called by a late page -

just sarah said in link: https://forums.developer.apple.com/thread/26922 have same problem using method "becomecurrentpage" when called "presentcontrollerwithnames()" , pages more 5. have watchkit app initial controller creates 15 page interface called using presentcontrollerwithnames(). of these same sub-classed wkinterfacecontroller. depending on context data passed, 1 of first 15 pages call becomecurrentpage() during awakewithcontext() make active page. works fine long 1 of pages later pages, display appears blank. if swipe through pages, nothing appears until page 4 displays after slight pause. after swiping forwards or backwards shows expected displays. debugger can see interface elements have been initialised , can accessed programmatically. not set hidden, not appear. writing simple test app, have found problem not total number of pages index of page calls becomecurrentpage(). , not consistent between simulator , watch or test test. in test app, run

java - Android save camera picture to local storage -

today have deal difficult thing. i start camera , want save taken image directly internal storage, without moving it. file targetdir = new file(getapplicationcontext().getfilesdir()+file.separator+"projectmain"+file.separator+"subforder"); targetdir.mkdirs(); //create folder if don't exist file externalfile = new file(targetdir, "picturename.jpg"); uri imageuri = uri.fromfile(externalfile); intent takepictureintent = new intent(mediastore.action_image_capture); takepictureintent.putextra(mediastore.extra_output, imageuri); startactivityforresult(takepictureintent, actioncode); it seems if try save them directly internal storage, camera ignores click on "ok"-button after take picture. think there wrong "internal" uri, because if use environment.getexternalstoragedirectory() instead of getapplicationcontext().getfilesdir() extra_output, works fine, have move file afterwards internal storage (t

html - How can I have PHP send Chinese characters in an email? -

i've scoured stackoverflow trying find answer none of answers provided similar questions have solved problem. so have pretty basic form here, , want able accept chinese characters, , send data in email. (note: chinese characters appear on webpage no issue) html: <!doctype html> <html> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <head> <link href="tour.css" rel="stylesheet"> </head> <body> <?php include('tour-form.php') ?> <div class="form"> <div class="row"> <div class="container"> <br> <form class="form-horizontal" role="form" method="post" action="tour.html"> <div class="form-group"> <label for="name" class="col-xs-2 control-label&quo

c# - How to Remove Items from Excluded Changes -

i added files solution , deleted after code tests. now, items still in excluded changes of team explorer. how can refresh visual studio excluded changes panel removed items go away? depending on version of visual studio have pending changes window (probably under team explorer tab). select deleted file, open context menu , select undo... for more information have @ https://msdn.microsoft.com/en-us/library/ms245456(v=vs.100).aspx

html - Buttons break when styling -

before start, here's jsfiddle https://jsfiddle.net/on652pk6/ with css https://jsfiddle.net/8zq922nd/1/ without css the buttons don't load in jsfiddle because wasn't sure how reference image files buttons, can see how it's supposed @ officialsamsmith.com so here's problem: of buttons @ top should link respective websites, , do, when no styling applied. style buttons, break. start on scratch on css if had to, before switched new host did not have issue. thing i've changed since remember them working (its been few months since i've worked on project) buttons (which png files) permalinked before, , refer directly file. i hope i'm not missing extrememly obvious here, thank in case. your #inprogress covering links. this: https://jsfiddle.net/on652pk6/2/ .buttonbox { text-align: center; height: 100px; width: 100%; padding-top:20; } #inprogress { padding-top:0px; font-size: 75px; position: rela

Go template comparison operators on missing map key -

i unable find documentation regarding type of return value when attempting key map in key doesn't exist. go bug tracker appears special 'no value' i'm trying compare 2 values using eq function gives error if key doesn't exist example: var themap := map[string]string{} var mystruct := struct{mymap map[string]string}{themap} {{if eq .mymap.keythatdoesntexist "mystring"}} {{.}} {{end} results in error calling eq: invalid type comparison from assume nil value not empty string "" in go itself. is there simple way compare potentially non-existent map value , value? use index function: {{if eq (index .mymap "keythatdoesntexist") "mystring"}} {{.}} {{end} playground example the index function returns 0 value map value type when key not in map. 0 value map in question empty string.

python - Why does apply change dtype in pandas dataframe columns -

i have following dataframe: import pandas pd import numpy np df = pd.dataframe(dict(a = np.arange(3), b = np.random.randn(3), c = ['foo','bar','bah'], d = pd.timestamp('20130101'))) print(df) b c d 0 0 -1.087180 foo 2013-01-01 1 1 -1.343424 bar 2013-01-01 2 2 -0.193371 bah 2013-01-01 dtypes columns: print(df.dtypes) int32 b float64 c object d datetime64[ns] dtype: object but after using apply changes object: print(df.apply(lambda x: x.dtype)) object b object c object d object dtype: object why dtypes coerced object? thought in apply columns should taken in account. pandas 0.17.1 python 3.4.3 you can use parameter reduce=false , more info here : print (df.apply(lambda x: x.dtype, reduce=false)) int32 b float64 c object d datetime6

c# - The type not mapped issue -

i have class in domain-project : public class person: entityobject { public int id { get; set; } public string name { get; set; } } i have repository in dataaccess-project: public class personrepository { databasecontext dbcontext { get; } public personrepository(databasecontext dbcontext) { this.dbcontext = dbcontext; } public virtual ienumerable<person> getall() { return dbcontext.persons.tolist(); } public virtual void savechanges(person persoon) { // configure auditing dbcontext.audit<person, personhistory>( (record, action) => new personhistory() { id = record.field<person, int>(f => f.id), name = record.field<person, string>(f => f.name), createddate = datetime.now, createdby = "simon", changedby = "simon", changeddate =

xcode7.2 - Different list of iOS simulator Xcode 7.1 and Xcode 7.2 -

Image
i've installed xcode 7.2. i've opened 1 project in xcode 7.1 , same on xcode 7.2. simulator list in xcode 7.2 strange compared xcode 7.1. when try run app on xcode7.2 simulator runs , quits silently. why so? the problem xcode 7.1 , xcode 7.2 communicating different instances of coresimulatorservice, out of sync. suspect installed older runtime , both running services created devices installed runtime (instead of one). xcode uses udid disambiguate them. discussed in more detail in multiple other questions on stackoverflow.

Combining all elements in a vector of lists based on the common first element of each list in the vector in R -

i have large vector of lists (about 300,000 rows). example, let's consider following: vec = c( list(c("a",10,11,12)), list(c("b",10,11,15)), list(c("a",10,12,12,16)), list(c("a",11,12,16,17)) ) now, want following: for each unique first element of each list in vector, need unique elements occurring corresponding in lists in vector, along respective frequencies. output like: for a , have elements 10, 11 12, 16 & 17 frequencies 2,2,4,2 & 1 respectively. b , 10, 11, 15 frequencies 1,1,1 . many in advance, ankur. here's 1 way it. first, simpler way create list is: l <- list(c("a", 10, 11, 12), c("b", 10, 11, 15), c("a", 10, 12, 12, 16), c("a", 11, 12, 16, 17)) now can split first character, , tabulate first character. tapply(l, sapply(l, '[[', 1), function(x) table(unlist(lapply(x, function(x) x[-1]))

Confusion with Ruby's `GC#start` -

program - i p ruby_version = "a" b = "b" p "#{a}" p "#{b}" p "garbage count => #{gc.count}" b = "d" p "garbage count => #{gc.count}" gc.start p "garbage count => #{gc.count}" p "#{a}" p "#{b}" output: "1.9.3" "a" "b" "garbage count => 1" "garbage count => 1" "garbage count => 2" "a" "d" in program i output of p "garbage count => #{gc.count}" made me confused 1,1,2 .confusion garbage objects count. tried modified version of program-i as below. where commented out gc.start . looking @ output of program -ii seems strated gc.start in first program,which in turn destroyed no-reference object "b" . program - ii p ruby_version = "a" b = "b" p "#{a}" p "#{b}" p "garbage count => #{gc.count}"

sas - Apparent symbolic reference not resolved -

the variable department has value of m&s in data step set ttt; departmentcomp=compress(departmentcomp);*for use in making directories; call symput('ggg',trim((division))); call symput('fff',trim((department))) the log displays symbolgen: macro variable fff resolves m&s warning: apparent symbolic reference s not resolved. how can rid of warning suspect affects program? use %superq() mask '&' , prevent resolution of '&s'. here's example you: 60 data test; 61 comp = "%superq(fff)"; 62 putlog "note: comp=%superq(fff)"; 63 run; note: comp=m&s note: data set work.test has 1 observations , 1 variables.

php - Telegram, Texting From Bot to Bot -

it possible send message telegram bot telegram bot? got error response when sending text bot either using @botname or directly botname target id. if not possible, i'll close question. thanx in advance.... i found answer question. @nick lee : no, not possible. bot can send messages has sent messages. means bot can talk human, not bot

mysql - Select count of rows from the same table -

hi have table below , need select count of different trade ids given distinct orderids unable in mysql format +-----------+---------+ | orderid |tradeid | +===========+=========+ | 1 | 58761 | +-----------+---------+ | 1 | 58762 | +-----------+---------+ | 2 | 58763 | +-----------+---------+ | 2 | 58764 | +-----------+---------+ | 2 | 58765 | +-----------+---------+ where result required +-----------+---------+ | orderid |count | +===========+=========+ | 1 | 2 | +-----------+---------+ | 2 | 4 | +-----------+---------+ just count / group by select orderid, count(*) some_table group orderid sql fiddle here:- http://www.sqlfiddle.com/#!9/305630/1 note if wanted of distinct tradeids each orderid use select orderid, count(distinct tradeid) some_table group orderid

javascript - Passport Send Mail Strategy -

i creating nodejs app requires user registers; i'm using passport manage autentication ('local' strategy) need modify strategy. need that, first user registers, mail send 1 (or more) administrators link aprove or not registration. remember in moodle called "email-based self-registration". i know can manually, suppose passport or other library has functionality implemented. ¿someone knows if possible? thank in advance. passport user authentication. take @ drywall, uses express , passport. http://jedireza.github.io/drywall/

c# - Selenium Script halts while switching window handles -

im facing same issue described here but closed thread. im using selenium webdriver 2.48.2, on win7 ie 11. situation goes this, have test clicks on button supposed open new experiment, new experiment opens in new tab on chrome , in same tab on firefox, opens in new window on ie11 when run through selenium. strange thing not open in new window when browser opened manually instead of through selenium script. maybe selenium script opens new webdriver? , script halts while searching new page's elements. code is, checks if new handle opened or not, finds new handle , switches window handle newer one. here c# code snippet. private static tresult triggerandwaitfornewwindow<tresult>(pageobject pageobject, action action, int timeout = 30) tresult : pageobject, new() { iparent parent = pageobject.driver; list<string> existinghandles = pageobject.driver.windowhandles.tolist(); action(); string popuphandle = wait.until(() => { string foundhandle = null

angularjs - Cancel Angular File Upload -

i not able cancel uploading file request angular, using below mentioned plugin upload file , according author feels way simple, not sure how should implement it. how uploading files, angular plugin files gets posted php , php intern reads entire file , streams java api through curl, so, have cancel button , once user clicks on cancel upload button need able stop upload angular plugin, once upload stopped can make call clean half streamed file....and other clean stuff. plugin link: https://github.com/danialfarid/ng-file-upload $scope.uploadfiles = function(files) { if(files != undefined){ $scope.currentfileuploadlist = files; $scope.$apply(); } angular.foreach(files, function(file, key) { if(isspecialchar(file.name)){ //$scope.currentfileuploadlist[key].status = false; //$scope.$apply(); file.upload = upload.upload({ url: $scope.base_folder+'/sync/file/upload', fields: {csrf_token: $('.csrf_token').html

node.js - How to effectively fetch comments for posts with MongoDB/mongoose? -

i have following post , collection documents: // posts { "_id" : objectid("56978d8cdbc511a81e7e2ea8"), "body" : "post body 1", "created_at" : 1452772748737 }, { "_id" : objectid("56978d3cdbc655b81e7e2e10"), "body" : "post body 2", "created_at" : 1452772759731 } // comments { "_post" : objectid("56978d8cdbc511a81e7e2ea8"), "body" : "comment 1" }, { "_post" : objectid("56978d3cdbc655b81e7e2e10"), "body" : "comment 2" } i need query posts comments following result: { "_id" : objectid("56978d8cdbc511a81e7e2ea8"), "body" : "post body 1", "created_at" : 1452772748737, "comments": [{ "_post" : objectid("56978d8cdbc511a81e7e2ea8"), "body" : "

node.js - Sorting using created at and updated at in mongodb -

why need created_at or updated_at sorting since objectid contain timestamp. we can do products.find({"p":p}).sort({'_id': 1}).exec(callback); or products.find({"user_id":user_id}).sort({'_id': -1}).exec(callback); correct me if i'm wrong. assuming created_at date when document has been created, , updated_at date of latest document update: if don't use either of these fields in application, there chances don't need them. there few usecases document's id not enough: filter or group created_at filter, group, or sort update_at

c# - Where should I put new ListItem for DropDownList -

i have page 1 main dropdownlist , 2 other. made choose settings printing report. problem - use datasource s in these dropdownlist s haven't empty value. should put adding new empty value dropdownlist correct work? there code (in comment thing need add) protected void ddlmain_load(object sender, eventargs e) { switch (ddlmain.selectedvalue) { case "1": dfirst.visible = true; dsecond.visible = false; break; case "2": dfirst.visible = false; dsecond.visible = true; break; } <div> <asp:dropdownlist id="ddlmain" runat="server" autopostback="true" onload="ddlmain_load"> <asp:listitem text="1" value="1"></asp:listitem> <asp:listitem text="2 " value="2"></asp:listitem> </asp:dropdownlist> </div> <div runat="s

android - Disabling swiping gestures in mobile chrome browser -

mobile chrome (ios/android) has feature if swipe @ left or right hand margins of screen changes tabs. my web app uses swiping, , "feature" seems in way. there way disable this? no, there's no way disable gesture. there's ticket requesting feature on @ https://code.google.com/p/chromium/issues/detail?id=117657 if want star / chime in.

c# - Inheritance in combination with class Attribute parameters and insertions into ViewData -

question educational purposes only. i have mvc application has 3 web journeys mirror 1 in many ways - makes convenient introduce base class take care of common parts. i using lots of class attributes being put viewdata makes convenient when reusing views between journeys can insert different phone number (or other bits) per journey without need inherit data in each viewmodel, same per journey (not placeable master page shown in many different views). these constants used in code when generating emails , such. [layoutviewdata(contactnumber = contactnumber, legaltype = legaltype, legalreference = legalreference)] public class journeycontroller : basejourneycontroller { private const string contactnumber = "0800 161 5191"; private const string contactnumberforpricingpage = "0800 051 3322"; private const string productreference = "ls0083"; private const string legalreference = "conveyancing"; } public class layoutviewdat

Get all usa state in state drop down listin in magento registration -

i hope doing well, i working in magento 1.6.0.1. current site usa, in registration page don't need country drop down list,and must display usa state in state drop down list. for set country value "us" in hidden field. so how can usa state in state drop down list add in register.phtml display states of us: <div class="field"> <label for="region_id" class="required"><em>*</em><?php echo $this->__('state/province') ?></label> <div class="input-box"> <select id="region_id" name="region_id" title="<?php echo $this->__('state/province') ?>" class="validate-select"> <option value=""><?php echo $this->__('please select region, state or province') ?></option>

r - mlr - Ensemble Models -

the mlr package great , idea of creating modelmultiplexer helps. modelmultiplexer " selects " 1 single model out of models used. is there support or planned support creating bagged or boosted ensemble of individual models? bls = list( makelearner("classif.ksvm"), makelearner("classif.randomforest") ) lrn = makemodelmultiplexer(bls) ps = makemodelmultiplexerparamset(lrn, makenumericparam("sigma", lower = -10, upper = 10, trafo = function(x) 2^x), makeintegerparam("ntree", lower = 1l, upper = 500l)) > print(res) tune result: **op. pars: selected.learner=classif.randomforest; classif.randomforest.ntree=197 mmce.test.mean=0.0333** you have few options in mlr . if have single model, can use baggingwrapper : lrn = makelearner("classif.part") bag.lrn = makebaggingwrapper(lrn, bw.iters = 50, bw.replace = true, bw.size = 0.8, bw.feats = 3/4) more details on in the tutorial . for several learners, can u

php - Need help on updating a data on a database table using facebox -

good day of you. title says need facebox when updating data(s). here's code button show facebox echo ' td> <a rel="facebox" href="../admin/c_status.php?id='.$row["userid"].'">edit</a> </td> '; and here's code inside facebox <?php include("../db/dbcon.php"); //$id = $_get['id']; //echo $id; ?> status <form method="post"> <select name="selactive" id ="selactive"> <option value="active">active</option> <option value="in-active">in-active</option> <option value="graduate">graduate</option> </select> <br> <br> <button class="btn btn-success btn-block btn-large" name="savechangebutton" id ="savechangebutton">save changes</button> </form