Posts

Showing posts from September, 2015

applescript - Javascript to fill a formatted text field on a web site -

i know virtually nothing javascript. monkey-see, monkey-do approach i’ve managed use javascript within applescript/safari fill text fields on web-site using following command: do javascript "document.getelementbyid('elementid').value ='texttoenter';" in document 1 i’ve been able enter text fields except one. fields work labeled input type="text” . field doesn’t work complex in entered text can formatted (bold, italics, underline, alignment, etc.) after entry. assuming i’ve identified correct source code element looks follows prior text entry: <body id="tinymce" class="mce-content-body " onload="window.parent.tinymce.get('fax_text').fire('load');" contenteditable="true" spellcheck="false"><p><br data-mce-bogus="1"></p></body> depending on how viewed, p , br tags appear on separate lines otherwise identical. after manual entry of tex

excel vba add hyperlink to shape in group -

i have absolutely no idea why cannot add hyperlink shape if trigged in-cell function. when run manually immediate window, working well. don't have troubles doing manually. i have no idea how write error handling in vba this sample code. function testcase(xllabelname string) dim sht worksheet each sht in activeworkbook.sheets if shapeexist(sht, xllabelname) sht.hyperlinks.add anchor:=sht.shapes(xllabelname), address:="", subaddress:="a1" testcase = "bingo" end if next sht end function from immediate window bingo answer , in cell #arg! error , line not executed. tried ungroup shapes first using dim gshp shape dim shrng shaperange dim tmp string set gshp = sht.shapes(getparentshape(xllabelname)) tmp = gshp.name set shrng = gshp.ungroup sht.hyperlinks.add anchor:=sht.shapes(xllabelname), address:="", subaddress:="a1" shrng.regroup shrng.name = tmp but failed. , still im

angular ui router - 10 digest iterations reached in angularjs when using $state.go -

i using angular ionic. i not want user have login again in case logged in , did not logout last time used application. reason, using local storage check if user logged in. tried putting code in run block. $rootscope.$on('$statechangestart', function (event, tostate, toparams, fromstate, fromparams) { if($localstorage.userinfo){ $state.go('deployment'); //this line 270 of app.js event.preventdefault(); return; } }) but gives error says: rangeerror: maximum call stack size exceeded @ scope.$broadcast (ionic.bundle.js:23414) @ object.transitionto (ionic.bundle.js:40804) @ object.go (ionic.bundle.js:40671) @ app.js:270 @ scope.$broadcast (ionic.bundle.js:23412) @ object.transitionto (ionic.bundle.js:40804) @ object.go (ionic.bundle.js:40671) @ app.js:270 @ scope.$broadcast (ionic.bundle.js:23412) @ object.transitionto (ionic.bundle.js:40804) also, error: [$rootscope

sql server 2008 - Delete all records from a table except latest N months records (sorted by id) -

Image
can please me in solving this. need keep latest 3 months records in table. table structure: after purge table should try this: delete tablex inner join (select max(insertdt ) lastdate, id tablex group id) lastdates on lastdates.id = tablex.id insertdt < dateadd(m,-3,lastdates.lastdate)

How to make a python source code edit it self -

i writing program countries around world. i want add feature user add own country, modifying source code. this current source code written in python 3.0.1: # -*- coding: utf-8 -*- print "bem vindo um programa educativo sobre os variados paises mundo, creado por tomas simoes, 2015" contry = raw_input("qual e o pais que desejas visitar? - ") if contry == "afeganistao": print "o que desejas saber sobre o/a", contry,"?" print "1 - cultura" print "2 - linguagem" print "3 - historia" print "4 - localizacao" contry_spec = raw_input(" : ") if contry_spec == "1": print "nao sei muito sobre cultura do/a", contry,",desculpa!" elif contry_spec == "2": print "a linguagem do/a", contry,"e pachto e dari." elif contry_spec == "3": print "nao sei muito sobr

Unable to execute FxCop rules with MSBuild SonarQube Runner -

we facing issues while analyzing .net projects using sonarqube 5.1.1. please note fxcop rules enabled @ quality profile level. we using msbuild sonarqube runner analyze projects. facing error says sonar.cs.fxcop.assembly must set. we have faced similar issue sonar-runner-2.4 @ time parameter can passed sonar-project.properties file. but sonar-runner not support .net projects, using msbuild sonarqube runner now. could kindly confirm how can avoid these issues msbuild sonarqube runner , execute fxcop rules on .net projects? c# plugin version 4.1. please let me know if further information needed our end. we have postponed our production sonar upgrade due issue project teams not ok disabling fxcop rules @ quality profile level. kindly in fixing this. thanks, sri priyanka i thinks should read http://www.sonarqube.org/easy-analysis-of-visual-studio-solutions-with-the-sonarqube-scanner-for-msbuild/ , http://docs.sonarqube.org/display/plug/c%23+plugin . pay

Copy constructor with different struct in c++ -

how initialize ptype2 copy ptype3 struct (type-conversion)? typedef struct ptype2 { double x, y; ptype2() : x(0), y(0) {} ptype2(const ptype3 & ptype3) : x(ptype3.x), y(ptype3.y) {} //abort ptype3.z create two-dimensional point ptype2(double xy) : x(xy), y(xy) {} ptype2(double x, double y) : x(x), y(y) {} } ptype2; output: error c2065: 'ptype3' : undeclared identifier error c2143: syntax error : missing ',' before '&' error c2228: left of '.a' must have class/struct/union error c2228: left of '.b' must have class/struct/union error c2664: 'ptype2::ptype2(const ptype2 &)' : cannot convert argument 1 'ptype3' 'const int' error c4430: missing type specifier - int assumed. note: c++ not support default-int i have 2 typedef struct , ptype2(double x, double y) , ptype3(double x, double y, double z) . an assignment operator overloading solve problem? the compiler can'

Windows 8.1 universal app crashes on Windows 10 -

my app published in store, built on windows 8.1 , works on 8.1 (desktop , tablet). crashes on windows 10 after navigate page has webview control (though might not reason). looked @ windows logs (eventvwr.msc) , found out crash has happened in system library. has faced problems windows 8.1 apps running on windows 10? update 1: information system's event log faulting application name: .... faulting module name: twinapi.appcore.dll, version: 10.0.10240.16397, time stamp: 0x55af0938 exception code: 0xc000027b fault offset: : 0x0001cab9 faulting process id: 0xe30 faulting application start time: 0x01d0daabb7ab6d89 faulting application path: c:\program files\windowsapps..... faulting module path: c:\windows\system32\twinapi.appcore.dll faulting package full name: .... faulting package-relative application id: app update 2 of article debugging windows 8.1 store app crash dump i've cracked crash dump , found out problem method in code. method has code captures scree

php - Online Editor for HTML CSS and Javascript -

i need editor html,css , javascript can integrate php. my project related decorating album, user can select pre defined templates , can change css html , javascript of template. please me out in there many publishers such, particularly netbeans . with can edit projects in php syntax recognition html, javascript , css, among others.

php - Mysql insert in two tables where the first table has foreign key and update the first table -

this have in db if insert in bmw car brands example.how update id_make whith id bmw sql.(i know huge mess in code , no aligment) http://i.stack.imgur.com/gqqg1.png this form: <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal">&times;</button> <h4 class="modal-title">add car:</h4> </div> <div class="modal-body "> <form action="index.php?page=carlist" method="post" autocomplete="off"> <div class="form-group"> <label for="marca">marca:</label> <!-- <input type="text" class="form-control" name="marca" placeholder="marca" data-toggle="modal" data-target="#marca"> -->

java - Accessing content of ByteArray without JNI GetByteArrayElements -

i investigating more efficient way of accessing content of bytearray through jni without ugly getbytearrayelements. seeking knowledgeable jni experts explain seeing , possibly solution. my test function jniexport void jnicall java_analyizer(jnienv *env, jclass cls, jbytearray bytes, jint bytes_len, jlong addr,jint limit) { jbyte *elements = (*env)->getbytearrayelements(env, bytes, false); char * e = (void *) elements; char * f = (void *) bytes; char * o = (void *) (uintptr_t) addr; printf("%d %d\n", e,f ); hexdump(e, (int) bytes_len); hexdump(f, (int) 500); hexdump(o, (int) limit); return; } void hexdump(void *addr, int len) { printf("hex address: %d len: %d\n", (uintptr_t) addr, len); int i; unsigned char buff[17]; unsigned char *pc = (unsigned char*) addr; // process every byte in data. (i = 0; < len; i++) { // multiple of 16 means new line (with line offset). if ((

Add only 10 records using Java in Mysql -

i making application in java using netbeans. want admin can add 10 users record , after 10 users added in database admin not able add more users(my idea buttons disable after 10 users addition). using mysql record saving. fire count query on table. , use resultset restrict(validate, records<=10) before app(client) enters new value. or put constraint in schema design itself.

javascript - using jQuery to switch background position every 250px -

im new jquery , not sure best way change background position, need change background position every 0 -250px, 0 -500px etc... know best way this? cheers js: function startavataranimation() { var avatarheight = 250; var avatartotalheight = 2750; var = 0; var avatarspeed = 1000; setinterval(function(){ i++; if(i > avatararray.length){ = 0; } $(".avatars").css({'background-position' : '0 -' + (i*avatarheight) + 'px' }); }, avatarspeed); } html: <div class="avatars"></div> im getting error @ moment avatararray not defined, first attempt hope ok. guess needs work out height knows when stop well? thanks again fixed following solution: function startavataranimation() { var avatarheight = 250; var avatartotalheight = 2750; var = 0; var avatarspeed = 500; var avatararray = {}; setinterval(function(){ i++;

sql - NVL faster than is not null condition? -

i asking myself if nvl funtion faster not null condition. searched on google if talk found nothing respond @ question. so here's situation have sql request , want know faster. in example simplify query have it's give idea of want know. here's request nvl function select ta.mnt tablea ta ta.id not in(select nvl(tb.id,-1) tableb tb); here's not null condition select ta.mnt tablea ta ta.id not in(select tb.id tableb tb tb.id not null); so 1 return faster? they're not same logic. consider start null, 0, 1 in tableb . - nvl version changes -1, 0, 1 - where not null changes 0, 1 . this means not in has fewer items check in where not null , that's why can faster. that said, using not in not fastest. 2 standard options left join , not exists . select tablea.* tablea left join tableb on tableb.id = tablea.id tableb.id null select tablea.* tablea not exists (select * tableb tab

javascript - RxJS bufferWithCount() not pausing for timeout -

i trying control inflow slow subscriber. tried below in nodejs var xmlnodestream = rx.observable.from([1,2,3,4,5,6,7,8,9,10,11]); var commjson = xmlnodestream.bufferwithcount(2).publish(); var fastsubscriber = commjson.subscribe( function (x) { console.log('----------\nfastsub: onnext: %s', x); }, function (e) { console.log('fastsub: onerror: %s', e); }, function () { console.log('fastsub: oncompleted'); }); var slowsubscriber = commjson.subscribe(function (x) { settimeout(function () { console.log("============\nslowsub called: ", x); }, 5000); }); commjson.connect(); when run above code , expect slow subscriber pause 5 seconds everytime before next data-batch received. but not happening. after initial 5 second delay, data flooded slowsubscriber in batches of 2. what right way control inflow slow subscibers can take time (and preferably fast ones can wait slow ones complete) ? it isn't pausing bec

c# - What events to handle in DataGridView for inline update / add / delete? -

essentially want user experience can go dgv , edit data (ie click cell, type stuff, hit enter), , have go database. can handle sql side, events should handle can figure out if user has done add, delete, or update? thanks. string lastcelltext; textbox textbox; private void datagridview1_editingcontrolshowing(object sender, datagridvieweditingcontrolshowingeventargs e) { if (e.control textbox) { textbox = e.control textbox; textbox.textchanged += textbox_textchanged; } } void textbox_textchanged(object sender, eventargs e) { //your actions } private void datagridview1_cellendedit(object sender, datagridviewcelleventargs e) { if (textbox.text ==string .empty ) { //do delete } if (textbox.text != lastcelltext) { //if textbox.text in database update else add } lastcelltext=textbox.text; textbox.textc

How to upload thumbnail image for ios rss feed table cell from xml feed -

almost finished rss app need create work. still new xcode , have tried many different open source code's available out there. found 1 more suited needs last thing need thumbnail images work table view cells. articles title , description in cells load fine, when tried re-write code image comes blank. the project made work google news rss : https://news.google.com/?output=rss . rss using : http://www3.westchestergov.com/home/all-press-releases?format=feed&type=rss now, part of code believe deals image downloading table view cells : override func tableview(tableview: uitableview, cellforrowatindexpath indexpath: nsindexpath) -> uitableviewcell { let cell = tableview.dequeuereusablecellwithidentifier("cell", forindexpath: indexpath) as! uitableviewcell let newsitem = rssdatalist[indexpath.row] cell.imageview?.image != nil cell.textlabel?.text = newsitem.title cell.detailtextlabel?.text = newsitem.summary // use cached image or do

python requests module - set key to null -

from requests documentation : remove value dict parameter sometimes you’ll want omit session-level keys dict parameter. this, set key’s value none in method-level parameter. automatically omitted. i need data key's value none take json value null instead of being removed. possible ? edit : seems happen request data keys. while not session-level behaviour of removing still same. there no session-level json parameter, merging rules don't apply. in other words, json keyword argument session.request() method passed through unchanged, none values in structure not result in keys being removed. the same applies data , there no session-level version of parameter, no merging takes place. if data set dictionary, keys value set none ignored. set value '' if need keys included empty value. the rule apply when merging headers , params , hooks , proxies .

c# - ConfigureAwait(true) is working only on 4.6 -

i ran following code on dot net framework 4.5, 4.5.1, 4.5.2 , 4.6 public async task<int> printculturesasync() { thread.currentthread.currentuiculture = new cultureinfo("en-in"); console.writeline(thread.currentthread.managedthreadid); console.writeline(thread.currentthread.currentuiculture); await somemethod().configureawait(true); console.writeline(thread.currentthread.managedthreadid); console.writeline(thread.currentthread.currentuiculture); return 1; } i observed on framework 4.6, c onfigureawait(true) working , showing same culture after await somemethod().configureawait(true) called. not supported on 4.5, 4.5.1 , 4.5.2 ? that new feature in .net framework 4.6 see: task class (system.threading.tasks) starting desktop apps target .net framework 4.6, culture of thread creates , invokes task becomes part of thread's context. is, regardless of current culture of threa

regex - PHP: Splitting a large string by certain characters in as large chunks as possible -

i implementing google translation api , take 5000 characters @ time, need split larger documents smaller ones , send multiple api requests. i need therefore split content chunks long possible (but less 5000) , has been split, not in middle of sentence make translations difficult process google. i therefore give method array of characters should when splitting. </div> </p> </section> </blockquote> </br> . (dot space) what approach this? regexp greedy default. .{0,4980}(\<\/div\>|\<\/p\>|\<\/section\>|\<\/blockquote\>|\<\/br\>|\.\s) should give longest string ending 1 of delimiters.

subprocess - Python communicate with omxplayer -

i want know when omxplayer starts playing live stream link. time takes 4-5 second times 6-7 second. when execute os.system('omxplayer '+url) , following message: no xset in (/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl) which: no xrefresh in (/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl) then when live stream starts (after 5-7 second), get: video codec omx-h264 width 1280 height 720 profile 578 fps 25.000000 audio codec aac channels 2 samplerate 44100 bitspersample 16 subtitle count: 0, state: off, index: 1, delay: 0 v:portsettingschanged: 1280x720@25.00 interlace:0 deinterlace:0 anaglyph:0 par:1.00 layer:0 alpha:255 i trying second message via subprocess. never it. how can second message or how can know when omxplayer start working? thanks #!/usr/bin/python2 import sys, os, time subprocess import pipe, popen url="http://livestreamlink.m3u8"

How to pass variables and data from PHP to JavaScript? -

i have variable in php, , need value in javascript code. how can variable php javascript? i have code looks this: <?php ... $val = $myservice->getvalue(); // makes api , db call ?> i have javascript code needs val , looks along lines of: <script> myplugin.start($val); // tried this, didn't work <?php myplugin.start($val); ?> // didn't work either myplugin.start(<?=$val?> // works sometimes, fails </script> there several approaches this. require more overhead others, , considered better others. in no particular order: use ajax data need server. echo data page somewhere, , use javascript information dom. echo data directly javascript. in post, we'll examine each of above methods, , see pros , cons of each, how implement them. 1. use ajax data need server this method considered best, because your server side , client side scripts separate . pros better separation between layers - i

android ndk - strange OutOfMemory error without memory leak -

i'm working @ pdf reader app using native library mupdf . unfortunately i'm encountering oom error after lot of swiping through pages. i'm using following code insights in memory behavior (i've used android device monitor before): runtime.getruntime().totalmemory() // amount of allocated memory in app heap debug.getnativeheapallocatedsize() // amount of allocated memory in native heap now comes strange thing...due swiping through pages returned values of these methods stable, doesn't there memory leak @ all. after time oom error occurs although values of these 2 methods still @ beginning. does know happening here? you can try prevent outofmemoryerror occurring adding in application tag in appmanifest.xml : android:largeheap="true"

ftp is not resolving hostname from hosts file -

i have hostname in /etc/hosts, 10.0.0.124 hostname.domain hostname can ping , ssh hostname. when enter ftp 10.0.0.124 or ftp hostname "no route host" in response. when comment out line, , try ftp hostname ftp responds "name or service not known". ftp looking in hosts file apparently not believe it. why not?? on centos 6.5 , ftp installed using yum install ftp . ftp daemon running on hostname vsftpd. and fixed! problem hostname's firewall configured drop ftp packets. obvious! inserted -a input -m state --state new -m tcp -p tcp --dport 21 -j accept in /etc/sysconfig/iptables, , restarted iptables service. done!

javascript - JS JSON not parsed by PHP json_decode -

i have issue parsing json data json_decode php function. issue json receive not formatted. looks follows: "{ user:1 ,product:4 ,commentcount: 1 ,comment:'all fine! done.' ,commentdate:{ year:2015 ,month:8 ,day:19 } , likes:8 }" when try decode string json_decode php function null. possible format string preg_replace function edit: found code on web wraps variable names in quotes. values still , json_decode still returns null. // fix variable names $phpjson = preg_replace( '/([a-za-z0-9_]+?):/' , '"$1":', $phpjson ); working solution malformed json: $json = "{ user:1 ,product:4 ,commentcount: 1 ,comment:'all fine! done.' ,commentdate:{ year:2015 ,month:8 ,day:19 } , likes:8 }"; $json = preg_replace('/(,|\{)[ \t\n]*(\w+)[ ]*:[ ]*/','$1"$2":',$json); $json = preg_replace('/":\'?([^\[\]\{\}]*?)\'?[ \n\t]*(,"|\}$|\]$|\}\]|\]\}|\}|\])/','":"

twitter bootstrap - HTML nested div outside of parent div -

Image
i'm having issues divs appearing outside of parent div. happens when window on computer in full screen mode, when screen made smaller phone/tablet size divs function how should. in codepen used border colours distinguish when divs outside of parent div when they're inside parent div. http://codepen.io/markbond/pen/lvkpjg?editors=110 fullscreen phone view html <div class="ibox-content" id="ibox-9"> <!--div body--> <div class="content active" id="budgetselection"> <div class="col-lg-6"> <label>budget scenerio</label> <div class="checkbox"> <label><input type="checkbox" />50mill</label> </div> <div class="checkbox">

PHP get_headers() fails with Pinterest -

i'm working on tool integrates link of different social networks: facebook: https://www.facebook.com/jonathan.parentlevesque google plus: https://plus.google.com/+jonathanparentl%c3%a9vesque instagram: https://instagram.com/mariloubiz/ pinterest: https://www.pinterest.com/jonathan_parl/ rss: https://regex101.com twitter: https://twitter.com/arcadefire vimeo: https://vimeo.com/ondemand/crashtest/135301838 youtube: https://www.youtube.com/user/darkjo666 i'm using basic regex one: /^https?:\/\/(?:[a-z]{2}|[w]{3})?\.pinterest.com\/[\s]{5,}$/i on client , server side minimal domain validation on each links. then, i'm using function validate page exists (it's useless integrate social network links don't work after all): public static function isurlexists($url){ $exists = false; if(!stringmanager::stringstartwith($url, "http") , !stringmanager::stringstartwith($url, "ftp")){ $url = "https://" . $url;

sprite kit - SKPhysicsJointFixed in SpriteKit and Swift -

i'm making game in sprite kit , swift , have sprite @ bottom of screen , falling sprites top want catch , stick sprite @ bottom, i'm trying use skphysicsjointfixed when objects collide instead of falling object sticking 1 @ bottom supposed catch , have attached, seems if bottom sprite adapts physics of falling sprite , falls off screen it. here's code have in didbegincontact method. , skewer name of sprite @ bottom should @ bottom , not disappear. if contact.bodya.node!.name == "skewer" { let boundx = skewer.physicsbody?.node?.position.x let fixedjoint = skphysicsjointfixed.jointwithbodya(contact.bodya.node!.physicsbody, bodyb: contact.bodyb.node!.physicsbody, anchor: cgpoint(x: boundx!, y: boundy)) physicsworld.addjoint(fixedjoint) // contact.bodyb.node!.removefromparent() } else { contact.bodya!.node!.removefromparent() } and physics bottom screen sprite here func makeskewer()

Alternating colors in Listview in Android Studio App -

i looking alternate colors in listview between 2 separate colors. here listview attributes. <listview android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/efile_results_list_view" android:layout_gravity="top" android:clickable="true" android:background="" /> here creating listview. @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); super.init(r.layout.activity_efile_results); resultlistview = (listview)findviewbyid(r.id.efile_results_list_view); if (listview() % 2 == 0) { resultlistview.setbackgroundcolor(color.ltgray); } else { resultlistview.setbackgroundcolor(color.white); } resultlistview.setonitemclicklistener(this); if(lastrequestedfilings != null) { filin

html - Else block of javascript program always executes even If block is true -

else block keeps executing if true. if remove else block program works fine. want check if user not in record prints not found. var students = [ { name: "linda", track: "ios", points:' 50' }, { name: "brian", track: "android", points: '80' }, { name: 'trish', track: 'rails development', points: '350' } ]; var search = " "; var student; var message = " "; function print ( msg ) { var output = document.getelementbyid("output"); output.innerhtml = msg; } function studentreport( student ) { var report = "<h2> student name: " + " " + student.name + "</h2>"; report += "<p> student track: " + " " + student.track+ "</p>"; report += "<p> student points: "+ " " + student

ruby on rails - JSON::ParserError 757 Unexpected token -

a little background on i'm working on. i'm trying create app spice coding portfolio can't app work me. followed guide part of it, integrating steam openid/omniuath ruby on rails since uses post no csrf token....yadda yadda yadda. anyhoo, i'm trying far upon logging in through steam, moment, list of players owned games display. it's not working me. code below controller. class welcomecontroller < applicationcontroller skip_before_filter :verify_authenticity_token, :only => :auth_callback def index @gameslibrary = [] if session.key? :current_user url = uri.parse("http://api.steampowered.com/iplayerservice/getownedgames/v0001/?key=#{env['steam_web_api_key']}&account_id=#{session[:current_user][:uid]}") res = net::http::get(url) @gameslibrary = json.parse(res)['game_count']['app_id']['name']['playtime_forever'] || [] end end def auth_callback auth = request.env['o

javascript - Undo for div tag -

i have div tag contenteditable = 'true' . when enter text keyboard , call undo function ( document.execcommand('undo',false, null) ), of text entered deleted. want undo last character typed. how can that? function doundo() { document.execcommand('undo',false, null); } <!doctype html> <html> <head> <script src="formulas.js"></script> <link rel="stylesheet" href="styles.css" type="text/css" media="screen" /> </head> <body id="main" spellcheck="false"> <span contenteditable="false"> <button onclick="doundo()">undo</button> </span> <div id = "maindiv"contenteditable="true">a</div> </body> </html> in doundo() instead of calling execcommand re

python - Django's Generic Views: how to filter get_queryset based on foreign class attributes? -

i've been following django starter tutorial ( https://docs.djangoproject.com/en/1.8/intro/tutorial05/ ) i decided make modifications test skills of now. specifically intend implement custom get_queryset resultsview generic view. something this: # views.py class resultsview(generic.detailview): model = question template_name = 'polls/results.html' def get_queryset(self): ''' make sure displaying results choices have 1+ votes ''' return question.objects.get ... basically goal return questions' choices choices at least 1 vote . so tried in django's shell this: # django shell q = question.objects.get(pk=1) q.choice_set.filter(votes=1) [<choice: not much>] here question pk = 1, filter based on choice_set (of choice model, fk refers question model). i'm trying figure out how implement in views.py , returns questions' content (i.e. choices) choices 1+ votes (i.e. dis

lua - Timer called twice in scene Corona SDK -

i have timer in code spawns objects every 1 seconds. when object collides "deathobj" scene changes scene2 scene1. when scene1 return scene2 timer called twice, if retry called 4 times etc... how can call timer once? function scene:show( event ) local scenegroup = self.view local phase = event.phase if ( phase == "will" ) elseif ( phase == "did" ) local function spawn() --things spawn object end end local function deathobjcollision(self, event) if (event.phase == "began" ) composer.gotoscene("scene1") end end deathobj = display.newrect(300,1900,1600,100) physics.addbody(deathobj, "static", {density=1.0, friction=0.5, bounce=0.3}) deathobj.collision = deathobjcollision deathobj:addeventlistener( "collision", deathobj ) spawntimer = timer.performwithdelay(1000, spawn, -1) end end try pause or cancel ti

testing - How-to turn off all SSL checks for postman for a specific site -

Image
please read carefully. please not send me link on how import certificate. i using postman qa , testing work. have test system rebuild myself , trusted. has custom self signed certificates , import them detailed here: http://blog.getpostman.com/2014/01/28/using-self-signed-certificates-with-postman/ however when access site, https://mysite.mycompany.com , message "net::err_cert_revoked". since revoked, importing certificate not @ all. so, there way postman ignore certificates testing purposes? not testing certificates other functionality @ point in time. not care security in case @ have complete control of system, behind firewall, , rebuild system. there option in postman if download https://www.getpostman.com instead of chrome store (most has been introduced in new versions , chrome 1 updated later) not sure old ones. in settings, turn off ssl certificate verification option be sure remember reactivated afterwards, security feature. if want use chrom

android - Resize libgdx correctly after orientation changed -

Image
i have square images on stage. reason become rectangles after resize. how resize them correctly? , how manually resize game? landscape portrait as see have 230x230, can't rectangles imagesendpos[i] = new image(skin1, "square"); imagesendpos[i].setwidth(230); imagesendpos[i].setheight(230); imagesendpos[i].setposition(pointiend.getx(), pointiend.gety()); stage.addactor(imagesendpos[i]); create() method public void create() { stage = new stage(); gdx.input.setinputprocessor(stage); soundcontainter=new soundcontainter(); soundcontainter.init(tasksheet,audios); camera = new orthographiccamera(gdx.graphics.getwidth(), gdx.graphics.getheight()); camera.settoortho(true, gdx.graphics.getwidth(), gdx.graphics.getheight()); camera.update(); } resize() method public void resize(int width, int height) { stage.getviewport().setscreensi

ios - Not receiving push notifications on iPhone5 -

i have implemented push notifications on ios app , have tested on iphone6(ios 8.4) , works fine. i've trouble making work on iphone5c(ios 8.3). whatever do, don't notifications. i've check device token , correct don't have idea why not receiving notification on phone. i've checked time live(ttl) value , it's not null if lost connection each time sending notification (which isn't case) would/should receive when going online again. i can't testing/debugging on server right it's harder try fix issue. edit : here how register notifications: if ([[[uidevice currentdevice] systemversion] floatvalue] >= 8.0f){ [[uiapplication sharedapplication] registerusernotificationsettings: [uiusernotificationsettings settingsfortypes: (uiusernotificationtypesound | uiusernotificationtypealert | uiusernotificationtypebadge) categories:nil]]; [[uiapplication shared

IntelliJ disable Jalopy for a specific project -

how can disable jalopy specific project in intellij idea 14 or 15? it seems not friend java8, other projects in java7. so, need selectively disable jalopy. or maybe nice enable specific projects. can provide kind of tutorial. answer suggested use aliases, see how. you can configure jalopy alias, not include project in alias if don't want run jalopy configuration project/module.

c# - MVC Controller The server was not found or not accessible -

Image
i create new mvc web project in visual studio 2015, add new class, , attach mvc 5 controller entity framework it. when run index file(the 1 display list of items have in class database), gives error shown below.how solve problem? don't know since new asp.net-mvc , thought controller handle things me. edit: tried same thing in visual studio 2013 , comes out fine. edit2: run same program in visual studio 2015 again , works. da... chenge connection : data source=.;initial catalog=aspnet-webapplication3-20150819093905;integrated security=true; (.) in data source mean local server. the following link create connection string : http://www.connectionstrings.com/

bash - How to create PID for forked process in init script? -

i know problem unsure solution is. so, have uwsgi process using graphite work nginx. here background information: i installed uwsgi pip , run uwsgi -configfile (.ini): [uwsgi] processes = 1 socket = 127.0.0.1:3031 gid = root uid = root chdir = /opt/graphite/conf daemonize = /var/log/graphite/uwsgi.log #pidfile = /var/run/uwsgi.pid module = wsgi:application i have init script following (i found on internet , not done): path=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin desc="uwsgi daemon" name=uwsgi daemon=/usr/local/bin/uwsgi configfile=/opt/graphite/conf/$name.ini pidfile=/var/run/$name.pid scriptname=/etc/init.d/$name set -e [ -x "$daemon" ] || exit 0 start() { if [ -f "$pidfile" ];then echo "${name} service running" >&2 return 1 fi echo "starting $name" >&2 $daemon $configfile || echo -n "uwsgi running" } stop() { $daemon --stop $pidfile ||