Posts

Showing posts from March, 2010

php - How to use TYPEs in Telegram Bot API? -

i'm new telegram bot. know how use methods send message or others file_get_contents method in php or curl, don't know enough types. although read in telegram page, misunderstood. don't know how use types in bot. want create keyboard bot, think when use curl, should send types parameters. wrote code below : $params = array ( 'chat_id' => $chatid, 'text' => 'hello !', 'replykeyboardmarkup' => array ( 'keyboard' => array(array('hello', 'hi')) ) ); it sends me message when use curl : $curl = curl_init("https://api.telegram.org/bot".$apitoken."/sendmessage"); curl_setopt($curl, curlopt_header, true); curl_setopt($curl, curlopt_returntransfer, 1); curl_setopt($curl, curlopt_post, 1); curl_setopt($curl, curlopt_postfields, ($params)); curl_setopt($curl, curlopt_ssl_verifypeer, false); curl_exec($curl); curl_close($curl); but doesn't show me keyboards ...

akka.net - How can I make my actor not die? -

i'm learning akka.net. i've set running test i'm running actor locally, , remotely on actor on vm in azure. the problem is, after i'm done , close application locally remote actor goes down. "an existing connection forcibly closed remote host" what need remote actor accept termination, , wait next connection actor running locally. how can fix this? if you're creating actors using remote deployment , actor stopped, once it's parent die (due actor system shutdown). in case, while child living on machine, it's still child of local actor. natural part of actor system lifecycle - children cannot live without parents. if you're interested having actors scattered among cluster nodes , make them rebalanced/recreated automatically, may take @ akka.cluster.sharding plugin. keep in mind, while lot easier, solution more complex , slower solution standard akka actors. make sure need features.

What is the difference between the component architecture and multi-transclusion model in AngularJS? -

i understand component architecture is, don't understand how different multi-transclusion model. can please explain? the difference components used encapsulate logic , define how custom html element rendered . multi-transclusion is/can part of component. tells where arbitrary text/html/... placed when component rendered. this useful if want create component layout application. think official documentation example that: https://docs.angularjs.org/api/ng/directive/ngtransclude#multi-slot-transclusion

SAS: use macro to loop through a list of strings and read in & process files -

i have list of string contains 10 file names. each file, need read in , genearate table , plots , save results pdf files (i used ods pdf) want automate process, sas can read first element, generate results , save them pdf, goes next file name , read in... can me that? thanks! part of code: %macro print; %do i=1 %to 10; proc import out= configtable datafile= "/sas/data/table.xlsx" dbms=xlsx replace; getnames=yes; run; proc import out= dfw datafile= "/sas/data/%scan(&arr, &i, %str(,)).xlsx" dbms=xlsx replace; getnames=yes; run; proc sql; create table dfwflow (select *, ......) order .....; quit; %end; %mend; %print; but doesn't work.....

racket - Remove a package from within DrRacket -

Image
in command line, can add , remove packages raco pkg . in drracket, however, package management handled through either file -> install package (if installing packages), or file -> package manager (if want install package, list of installed packages, etc.). unfortunately, dialog not appear have tag removing package. possible remove package drracket, or must done with: raco pkg remove <package-name> obviously, can indirectly within racket using find-exe : #lang racket (require compiler/find-exe) (system* "-l" "raco" "remove" "<package-name>") but seems clunky. there better way remove packages drracket/ you can remove package going to: file -> package manager , , click on second tab ( currently installed ) see list of of installed packages. select package want remove, , find remove button in bottom right corner. if click button package removed system. here picture of list of installed packages remove bu

What does django controllers are in views.py -

Image
i have followed several django tutorials. not know why controllers stored in file called views.py. confuse filename. looking mvc development. there other files in django "real" controllers ? yes ! it's design decision , it's described guys behind django here . basically argument that, in opinion, in our interpretation of mvc, “view” describes data gets presented user. it’s not how data looks, data presented. view describes data see, not how see it. it’s subtle distinction. a “view” python callback function particular url, because callback function describes data presented. i entice read entry hold of overal idea behind views naming. about controllers, yes again. though, can define several layers of called middlewares in django handle lots of static logic before/after requests handled views, still, it's view plays main role of controller in django.

Spring JSP to Controller -

i facing problem sending spring controller. try many way got error neither bindingresult nor plain target object bean name 'command' available request attribute here jsp page.. <div class="container"> <div class="row"> <div class="col-md-4"></div> <div class="col-md-4 well-lg"> <spring:url value="/fetch/page" var="fetchpage" /> <form:form method="get" action="${fetchpage}"> <div class="center-block "> <label class="control-label"> name</label> <form:input placeholder="customer name" class="form-control" path="name" /> </div> <br /> <button type="submit" class="btn btn-pri

featherlight.js - how to get a plain old external link working with featherlight -

i have div link: <div data-featherlight="test" > <a href = "http://example.com" target = "_blank">link </a> </div> the lightbox works fine, when click link, makes recursive lightbox. want link pop new window. note, don't want ajax call, pop link on 3rd party domain. thanks help, kevin not sure, might closer want using iframe ? fl think link should done ajax, you'll have specify want iframe instead...

How to mock nested / multiple layers of return objects in python -

i'm struggling find way of mocking multiple layers / nested return values. in other words, want return magic mock in turn returns magic mock it's own set return values. i'm finding relatively cumbersome , looking more elegant , maintainable solution. i'm trying test following code efficiently. url returns json string needs further processing: import json urllib.request import url open def load_json(): # first return value response = urlopen("http://someurl.com/api/getjson") # in turn, contains 2 nested return values read , decode response_dict = json.loads(response.read().decode('utf-8')) this how i've mocked far, extremely inelegant , makes maintenance complicated: class mytestcase(testcase): @patch('load_json_path.urlopen') def test_load_json(self, mock_urlopen): ### trying simplify of # third nested return mock_decode = magicmock(return_value='["myjsondata"]&

sql - LEFT join returns only NULL for right side -

i facing problem join query 2 conditions. problem query gives left site, whereas right site contains null . checked types of data match. going wrong? select t2.year_number ,t2.week_number ,t2.stock_ric ,t1.sent_pos_weighted ,t1.sent_neut_weighted ,t1.sent_neg_weighted ,t1.observations ,t1.av_w_relevance ,t1.av_w_lnkd_cnt1 ,t1.av_w_item_cnt1 res structure2016 t2 left join pre t1 on t1.week_number = t2.week_number , t1.stock_ric = t2.stock_ric order stock_ric, week_number edit: brief example of how tables , should like. stock_ric columns of type char(13) table structure2016: stock_ric year week_number jpm.n 2016 1 jpm.n 2016 2 jpm.n 2016 3 table pre: stock_ric week_number sent_pos_weighted jpm.n 5 0.1 jpm.n 3 0.9 jpm.n 1 0.1 jpm.n 10 0.1 result

arrays - C#: Compare two ArrayList of custom class and find duplicates -

i have 2 arrays of arraylist. public class productdetails { public string id; public string description; public float rate; } arraylist products1 = new arraylist(); arraylist products2 = new arraylist(); arraylist duplicateproducts = new arraylist(); now want products (with fields of productdetails class) having duplicate description in both products1 , products2 . i can run 2 for/while loops traditional way, slow specially if having on 10k elements in both arrays . so can done linq. if want use linq, need write own equalitycomparer override both methods equals , gethashcode() public class productdetails { public string id {get; set;} public string description {get; set;} public float rate {get; set;} } public class productcomparer : iequalitycomparer<productdetails> { public bool equals(productdetails x, productdetails y) { //check whether objects same object. if (object.referencee

java - Is using enums efficient for many constants memory-wise? -

i have class looks this: public class messagebuilder{ private enum msgcodes{ code_1("some string"), code_2("another string"), code_3("you idea"); private string msg; msgcodes(string msg){ this.msg = msg; } private string text(){ return msg; } } private messagebuilder(){ //prevents initialization outside class } //gives synchronized behaviour initialization without enforcing getinstance() private static class loader{ static messagebuilder instance = new messagebuilder(); } public static messagebuilder getinstance(){ return loader.instance; } public string buildmessage(string[] codes){ string res = ""; for(string code : codes){ res += qamsg.valueof(code).text(); } return res; } } my concern overtime (meaning application develops) have more , more enum on class (which understand not preferred way keep constants used on 1 class), i&#

Arduino loop update of a variable is incorrect -

i've got following code snippet in setup() function: ... unsigned int a0val; unsigned int a0total = 0; ... (i = 0; < 1000; i++) { a0val = analogread(a0); serial.println(a0val); a0total += a0val; } serial.println(a0total); ... this done baseline analog value @ startup account different types of sensors being used. 1 type may read 0 , may read non-zero value. point have starting point reference averaging 1000 readings @ startup time. 1000 overkill, i'll cut later. now, 1000 readings somewhere between 128 , 130, expect a0total around 129,000. however, total consistently comes out less half number, 63,722 in 1 example. it's not half, it's less that. another example: add first 500 readings when around 350-352, , total came out 43614. looks wrap-around, i'm using unsigned int both values can't happening. so me looks "a0total += a0val" not updating every loop, doesn't make sense either. what missing? thanks, ron

javascript - Access div in nested meteor template -

i'm trying access or more precise remove class inside nested template parent template. here how code structured. parent template <template name='paymenttemplate'> <div class="progress-wrapper"> {{>progressbar }} </div> </template> child template <template name="progressbar"> <div class="progress"> <div class="checkoutprg progress-bar progress-bar-success" role="progressbar" aria-valuenow="25" aria-valuemin="0" aria-valuemax="100" style="width: 25%;"> checkout </div> <div class="deliveryprg progress-bar progress-bar-danger " role="progressbar" aria-valuenow="25" aria-valuemin="0" aria-valuemax="100" style="width: 25%;"> delivery </div> <div class="paymentprg progress-bar progress-b

Groovy Multiline String Doesn't Recognize Lines with Only Whitespaces -

i'm guessing known issue , there's efficient workaround somehow. i getting output has lines in contain fixed number of empty spaces. i'm doing string comparison test such 1 below part of unit test. there way pass without modifying strings using stripindent() or like? note, test below supposed have 4 white spaces in seemingly empty line between teststart , testend in multiline string. however, stack overflow may removing it? string singleline = 'teststart\n \ntestend' string multiline = ''' teststart testend ''' println singleline println multiline assert singleline == multiline string singleline = 'teststart\n \ntestend' string multiline = ''' teststart (assume there 4 spaces on line) testend ''' println singleline println multiline assert singleline == multiline that assertion supposed fail. first character in singleline character t teststart . first character in multiline

java 9 - How to start a new JavaFX project with JDK 9 in IntelliJ -

Image
i trying start new jdk 9 project in intellij, when attempt run following error during make process: error:java: invalid flag: -release i know haven't set correctly can't seem find relating setting project jigsaw in intellij. edit here screen shot of issue. haven't been able find related anywhere. i have no compiler errors in ide. fails on build/run command. clean install of intellij, new project started jdk 9. i able set jdk level experimental , worked. hopefully others run issue.

python - String instead of integer in finding "bob" -

my question code: count = 0 char in s: if char.startswith("bob"): count += 1 print ("number of times bob occurs is: " + str(count)) i have solution followed: count = 0 in range(len(s)): if s[i: i+3] == "bob" count += 1 print ("number of times bob occurs is: " + str(count)) my question: instead of taking out solution using integer "for in range(len(s))", want alternative solution using character/string. tell me why above solution returns "0" in finding "bob"? thanks. what wrong first piece of code become apparent print statement in loop. statement for char in s loops through each character in s , no character starts word bob . if want for in something type loop, can do: count = 0 word in s.split(): if word == "bob": count += 1 print ("number of times bob occurs is: " + str(count)) this work if wan match occurrences of bob oc

How to create child classes like mysqli class in php -

i building little website, , have problem dealing classes. want create class named message_manager has child named send (like mysqli class has query has child). i need because want have variables in send class. can me it. class message_manager{ var $sender; var $connection; function __construct($connection, $sender){ $this -> sender = sender; $this -> connection = $connection; } } class send extends message_manager{ var $message_id; private function _send($receiver, $message){ //function sends message , generate $id $this -> message_id = $id; } function __construct($receiver, $message){ return $this -> _send($receiver, $message) } } //sending message $conn = new mysqli(....); $messenger = new message_manager($conn, $user1); $a = $messenger -> send($user2, $message); $id = $a -> message_id; i have tried above code not work. or work-around welcome

eclipse - program won't compile java.lang.ClassNotFoundException -

hi guys total newbie. please me. the program is: import java.util.scanner.*; import java.lang.*; public class hextodecimalfromweb{ public static void main (string [] args) { scanner input = new scanner(system.in); printheader(); while (true) { string hex = input.next("enter hexadecimal number: "); int dec = integer.parseint(hex, 16); if (dec == sentinel) { break; } system.out.println(hex + " hex = " + integer.tostring(dec)+ "decimal"); } } private static void printheader() { system.out.println("this program converts hexadecimal decimal."); system.out. println("enter 0 stop."); } private static final int sentinel = 0; } the error this: java.lang.noclassdeffounderror: hextodecimalfromweb caused by: java.lang.classnotfoundexception: hextodecimalfromweb @ java.net.urlclassloader$1.run(urlclassloader.java:202) what reason that? i think may i

opencv - How to import cv2 in python project "Visual Studio 2015"? -

Image
i start opencv . followed tutorials installing opencv in windows. after downloading , extracting opencv first, create environment variable , path then moved python in visual studio. installed python , started simple tutorial, faced problems python. first problem numpy module not found. solved cv2 error couldn't solved it, followed instruction said need copy cv2.pyd file in ..\python34\lib\site-packages afterword tried >>> import cv2 but got error thanks of you.

git - Find the branch of a commit on github -

Image
i want find out branches commit belongs on github unlike of commits, 1 not display branch on github a) b) cloned repository, and ran git branch --contains <commitid> locally, got error: no such commit however, on github can navigate commit passing <commitid> in url think contradict error got earlier... i suspect branch deleted (i not sure remote branch deletion, think ref removed , commits left untouched?)...and commit not reachable (ignored when git clone locally?) if how can find more information these "zombie commits"? if wrong, happened? maybe git revert ? a pull request not branch, marker says "i want merge feature branch other branch". what has happened here is: someone created branch. a pull request created merge branch. the branch merged without use of --no-ff , , deleted. then cloned. since commits now-deleted branch unreachable, git doesn't bother send them when clone. since haven't yet been garb

database - How to create TFRecords file from png images -

i'm started working tensorflow week ago, , have basic problems. the major 1 didn't find way create tfrecords contains data. understood process necessary in order train own network few millions 32x32 pixels images. i've found lot of tutorials , lot of documentations referring "input_pipeline", none of tutorials explained how create own database, own images. i have few major folders , sub-folders, ~300,000 png images each, label in name of image (0 or 1 - binary classification). the way images trough (glob) lines: "/home/roishik/desktop/database/train/exp*/*png" "/home/roishik/desktop/database/train/exp*/tot*/*png" so question is: how create tfrecords file contains images , labels? i'll appreciate help! i'm stuck problem 2 days, , found specific answers mnit , imagenet. thanks! millions of 32x32 images? sounds cifar. check out tensorflow models , have script download cifar10 , convert tfrecords: download_and

bash - printf colours not working from .bash_logout -

i'm trying use this lovely script on logout ubuntu box i'm ssh'd into. if invoke manually, colours correct. however, whenever it's run .bash_logout , every line white , prefixed colour code: \x1b[38;5;160;01m .d8888b. 8888888888 8888888888 y88b d88p .d88888b. 888 888 \x1b[38;5;196;01m d88p y88b 888 888 y88b d88p d88p" "y88b 888 888 \x1b[38;5;202;01m "y888b. 8888888 8888888 y888p 888 888 888 888 \x1b[38;5;208;01m "y88b. 888 888 888 888 888 888 888 \x1b[38;5;214;01m "888 888 888 888 888 888 888 888 \x1b[38;5;220;01m y88b d88p 888 888 888 y88b. .d88p y88b. .d88p \x1b[38;5;226;01m "y8888p" 8888888888 8888888888 888 "y88888p" "y88888p" term set xterm-256color in both vm , host (os x 10.11). tried using ech

How to translate docker-compose.yml to Dockerrun.aws.json for Django -

i following instructions @ https://docs.docker.com/compose/django/ basic dockerized django app going. able run locally without problem having trouble deploy aws using elastic beanstalk. after reading here , figured need translate docker-compose.yml dockerrun.aws.json work. the original docker-compose.yml is version: '2' services: db: image: postgres web: build: . command: python manage.py runserver 0.0.0.0:8000 volumes: - .:/code ports: - "8000:8000" depends_on: - db and here translated far { "awsebdockerrunversion": 2, "volumes": [ { "name": "db" }, { "name": "web" } ], "containerdefinitions": [ { "name": "db", "image": "postgres", "essential": true, "memory": 256, "mountpoints": [ { &

java - implementing queue with arrays -

im confused why queue not working, believe there problem in enqueue , dequeue methods. im not sure, supposed implement class initial array size set 8. array size doubled once number of elements exceeds size. after element removed beginning of array, need shift elements in array 1 position left. write test program adds 20 numbers 1 20 queue , removes these numbers , displays them. here code public class queue { private int[] elements; private int size; private int first; private int last; public static final int default_capacity = 8; public queue(){ (default_capacity); } public queue (int capacity){ elements = new int[capacity]; first = 0; last = 0; size = 8; } public void enqueue(int v){ //fills queue , lengthens if necessary if (last>=size){ int[] temp = new int[elements.length*2]; system.arraycopy(elements, 0, temp, 0, elements.length); elements = te

vim - How can I make a key bind that only applies in a certain situation? -

note: bar symbol ( | ) represents editor caret throughout question i've made ultisnips snippet this: snippet "(\w+)" "html tag" r <`!p snip.rv = match.group(1)`>$0</`!p snip.rv = match.group(1)`> endsnippet this lets me expand word html tag, example typing "body" , pressing tab expands <body>|</body> . the caret placed between tags. when press return, end with: <body> | </body> this done keybind this: :ino <buffer> <cr> <cr><esc>o but don't want permanently rebind return key. want specific keybind active when caret placed between opening , closing html tag. how can done simply? another example when have caret placed between 2 curly brackets, so: function() {|} and press enter, result be: function() { | } again can done above key mapping, in case want active when caret placed between 2 curly brackets. you use map-expression (see :h map-e

oop - NullObject Pattern: How to handle fields? -

suppose have book class contains year_published public field. if want implement nullobject design pattern, need define nullbook class behaves same book not anything. question is, should behavior of nullbook when it's fields being assigned? book book = find_book(id_value); //this method returns nullbook instance because cannot find book book.year_published = 2016; //what should here?! the first thing should make properties private. class nullbook { private year_published; // or solution2 private year_published = null; public setyearpublished(year_published) { this.year_published = null; // or solution2 nothing! } } you can define field private in parent class, children have implement setter acces field class book { private year_published; public setyearpublished(year_published) { this.year_published = year_published; } } class nullbook extends book { public setyearpublished(year_published) { pare

r - How to reduce the font size of a tooltip in rnvd3? -

i using rnvd3 packadge plot interactive multibarchart in shiny app, , tooltip of chart has big font size , reduce it. here code: library(shiny) library(rcharts) library(shinythemes) library(shinydashboard) ui <- navbarpage(title = "information", tabpanel(title = "graph", fluidrow( column(2), column(8, tags$br(), tags$h5("chart", style="font-weight: bold; font-size:20px", align = "center"), tags$br()) ), fluidrow( column(1), column(8, tags$br(), tags$h5("exemple", style="font-weig

In pandas, what does the na_action parameter to Series.map do -

when using series.map , na_action do? docs unclear , have not come example in results affected parameter. although explanation in documentation pretty clear, it's hard see what's going on if you're using numeric functions take nans input , return them nan. else hasn't read docs, if na_action='ignore' na values not passed mapping function, if na_action=none (the default) will. here's trivial example showing difference: import pandas pd import numpy np s = pd.series([1, 2, 3, np.nan]) s2 = s.map(lambda x: 'this string {}'.format(x), na_action=none) 0 string 1.0 1 string 2.0 2 string 3.0 3 string nan dtype: object s3 = s.map(lambda x: 'this string {}'.format(x), na_action='ignore') 0 string 1.0 1 string 2.0 2 string 3.0 3 nan dtype: object if have better example own analysis should consider creating issue on pandas repo , in order improve documentation , others understand.

javascript - I want to add keyup and click on a button -

whenever user press or click button #btnsubmit ajax executes. when press enter. both keyup , click executes. when use click. executes click function. <script type="text/javascript"> function loaddelegates($barcode) { var xhttp = new xmlhttprequest(); xhttp.onreadystatechange = function() { if (this.readystate == 4 && this.status == 200) { document.getelementbyid("getdel").innerhtml = this.responsetext; $("#btnsubmit").focus(); } }; xhttp.open("get", "activityclient/" + $barcode, true); xhttp.send(); } function storetime($barcode) { var xhttp = new xmlhttprequest(); xhttp.onreadystatechange = function() { if (this.readystate == 4 && this.status == 200) { document.getelementbyid("getdel").i

Connecting to Azure SQL with Python -

i trying connect sql database hosted in windows azure through mysqldb python. i keep getting error mysql_exceptions.operationalerror: (2001, 'bad connection string.') this information works when connecting through .net (vb, c#) not having luck here. for below used server's name azure .database.windows.net correct way go this? here code: #!/usr/bin/python import mysqldb conn = mysqldb.connect(host="<servername>.database.windows.net", user="myusername", passwd="mypassword", db="db_name") cursor = conn.cursor() i have tried using pyodbc freetds no luck. @kyle moffat, os on? here how can use pyodbc on linux , windows: https://msdn.microsoft.com/en-us/library/mt763261(v=sql.1).aspx windows: download , install python install microsoft odbc driver 11 or 13: v13: https://www.microsoft.com/en-us/download/details.aspx?id=50420 v11: https://www.microsoft.com/en-us/download/details.aspx?id=36434 op

android - Storing App Information -

i have been looking @ different ways hold onto predefined character data, having hard time nailing down best solution. an example of data 10 strings, 5 int arrays (of size 10 each). there 10+ set's of data. application load in information , inflate generic "character" objects. possible solutions: xml: due android's structured xml requirements can hard use without making different xml file every character, , have id overlapping similar named data values. sqlite: wouldn't huge database, databases ugly version controlled unless done create-database script has own downsides (such making sure db date between builds). hard-coded objects: far least favorite solution, using polymorphism hardcode of objects. dirty, not dynamic should be. i consider things such version controlling files, ease of updating (due them being inflated, never changed app). if data baked suggest use harcoded data. reasons. in 3 solution save data in application. if use

android - Watchdog timeout killing ActivityManager -

we seeing random reboots while capturing bugreport. traces,binder holding lock , performing file operations,while activity manager waits acquire same lock on release. reason binder fails complete operation in stipulated time of 60 secs(watchdog timeout period) after watchdog kick in , kill activity manager resulting in reboot. not sure why file operations failing. idea?? ****logcat**** 28429 28736 w watchdog: *** watchdog killing system process: blocked in monitor com.android.server.am.activitymanagerservice on foreground thread (android.fg), blocked in handler on activitymanager (activitymanager) 28429 28736 w watchdog: foreground thread stack trace: 28429 28736 w watchdog: @ com.android.server.am.activitymanagerservice.monitor(activitymanagerservice.java :18792) 28429 28736 w watchdog: @ com.android.server.watchdog$handlerchecker.run(watchdog.java:173) 28429 28736 w watchdog: @ android.os.handler.handlecallback(handler.java:739) 28429 28736 w watchdog: @ android.os.

lucene - Spellcheck not working in search in AEM 6.1 -

spell check not working in aem 6.1 after creating suggested indexes specified in -- https://docs.adobe.com/docs/en/aem/6-1/deploy/platform/queries-and-indexing.html , https://jackrabbit.apache.org/oak/docs/query/lucene.html as per docs spellcheck has been implemented in oak since versions 1.1.17 , 1.0.13. oak version 1.22 should work.the aem version 6.1.0.20150507 created index - /oak:index/lucene-spellcheck - jcr:primarytype = "oak:queryindexdefinition" - compatversion = 2 - type = "lucene" - async = "async" + indexrules - jcr:primarytype = "nt:unstructured" + nt:base + properties - jcr:primarytype = "nt:unstructured" + jcr:title - propertyindex = true - analyzed = true - useinspellcheck = true i 0 results when run query using crx-de's query tool using query manager jsp. select [rep:spellcheck()] nt:base [jcr:path] = '/content/abc' , s

ios - Animation finishes immediately, regardless of duration and delay -

i have animation block, cell background color clear immediately: cell.mylabel.backgroundcolor = .orange uiview.animate(withduration: 3.0, delay:3, animations: { cell.mylabel.backgroundcolor = .clear }) the point running in cellforrowat i tried moving animation custom cell, no success again: override func didmovetowindow() { uiview.animate(withduration: 3.0, delay:3, animations: { self.mylabel.backgroundcolor = .clear }) } try this, cell.mylabel.layer.backgroundcolor = uicolor.redcolor().cgcolor uiview.animate(withduration: 3.0, delay:3, animations: { cell.mylabel.layer.backgroundcolor = uicolor.clearcolor().cgcolor })

php - Creating (Complex?) Custom Queries for Wordpress compatible with Visual Composer -

i'm struggling make 2 custom queries visual composer: a query display posts published date after today's date (have plugin publishes future posts) in ascending or descending order (whichever makes show soonest upcoming event first) a query display posts meet multiple category requirements (eg. categories 'upcoming' , 'class' or 'upcoming' , 'social' really, either of these should give me results want, first convenient. i can't life of me decipher codex's page on custom queries , figure out how them work outside of context of php page, , in context of visual compose. one thought had perhaps need add custom query functions.php has name, , call query variables visual composer? right idea? how such thing/call new query? i've tried following satisfy #1 , seems have disregarded query altogether , displayed events: [vc_basic_grid post_type="custom" grid_id="vc_gid:1473741223498-3776c0d3-292b-4" custom_q

rails enum, load enum values based on condition is it possible? -

lets have model enum : class apt < activerecord::base enum apt_status: [ :draft, :publish, :unpublish, :waiting ] end and in controller load enum : @apt_statuses = apt.apt_statuses it's working fine, if want load enum values based on user role? lets if admin want load enum values, , if not admin, display 3 enum values ":draft, :unpublish, :waiting" is possible? please suggest. many thanks. btw here controller, have no idea how fill @apt_statuses in else condition ishaveprivilage = usermaster.joins(:rolemasters, :rolemasters).where(id: @current_user.id, rolemasters: {name: "super admin"}) if ishaveprivilage @apt_statuses = apt.apt_statuses else end i use enum in view : <%= f.select :apt_status, options_for_select(@apt_statuses.collect { |s| [s[0].humanize, s[0]] }, selected: @apt.apt_status), {} , class: "form-control" %> error trace : nomethoderror in admin::apts#new showi

c# - Entered wrong value. goto Start; -

edit. based on answers received realized asking more know @ stage in learning , such, have decided forget question until have learnt , understand more. not want overstep , confuse myself. just newbie looking guidance. from previous question asked here, introduced goto start; in switch statement. i started using , had me thinking wanted program go start in event user entered invalid input. example, in calculator below, if user enters other number, how program disregard input , prompt user again enter number? maybe display "invalid input. please try again" user. right now, if number entered, console crashes , throws me error. thanks in advance assistance int num1, num2, output; string op; console.write("\n\n"); console.writeline("calculator\n"); console.writeline("============="); console.write("\n\n"); start: console.write("please enter first number:&

python - Django URLs error: view must be a callable or a list/tuple in the case of include() -

after upgrading django 1.10, error: typeerror: view must callable or list/tuple in case of include(). my urls.py follows: urlpatterns = [ url(r'^$', 'myapp.views.home'), url(r'^contact/$', 'myapp.views.contact'), url(r'^login/$', 'django.contrib.auth.views.login'), ] the full traceback is: traceback (most recent call last): file "/users/alasdair/.virtualenvs/django110/lib/python2.7/site-packages/django/utils/autoreload.py", line 226, in wrapper fn(*args, **kwargs) file "/users/alasdair/.virtualenvs/django110/lib/python2.7/site-packages/django/core/management/commands/runserver.py", line 121, in inner_run self.check(display_num_errors=true) file "/users/alasdair/.virtualenvs/django110/lib/python2.7/site-packages/django/core/management/base.py", line 385, in check include_deployment_checks=include_deployment_checks, file "/users/alasdair/.virtualenvs/django110/

internet explorer - Printing is not available. Verify that ActiveX is enabled -

i'm working on reporting service. i'm clicking on print button of report page , getting below error. message webpage printing not available. verify activex enabled, or try using internet explorer desktop. can please me proper solution. have tried these links no success. link-1 link-2

android - StackOverflowError when using ViewCompat -

i'm using viewcompat compatible animation lower api (10). but when deploy on emulator stackoverflowerror this code: private void fabfadein(){ if (floatingactionbutton.getvisibility() == view.gone) { floatingactionbutton.setvisibility(view.visible); viewcompat.setalpha(floatingactionbutton, 0f); viewcompat.setscalex(floatingactionbutton, 0f); viewcompat.setscaley(floatingactionbutton, 0f); viewcompat.animate(floatingactionbutton) .alpha(1) .scalex(1) .scaley(1) .setduration(300) .setinterpolator(new overshootinterpolator()) .setlistener(new viewpropertyanimatorlistener() { @override public void onanimationstart(view view) { } @override public void onanimationend(view view) { viewcompat.animate(floatingactio