Posts

Showing posts from May, 2013

Assigning elements of a python list to a string -

how pass element of list string? str = categories[0] thanks. firstly; in case trying declare "i" string...python weakly typed language means not need declare variable types. instead of writing "int = 5" write "i = 5" if categories list of strings following: categories = ["categorya", "categoryb", "categoryc"] = categories[0] if categories not list of strings want convert value of 1 of index's of categories string following: categories = [128, 240, 380] = str(categories[0]) if ever need convert int (or possibly convert float) can use int(i) or float(i)

Extract values from raster ArcGIS 10.x -

i got vegetation raster. pixels have several fields (i.e. basal area oaks, density of oaks, volume of oaks, pixel value, etc). how extract selected field values set of xy points? the primary tool you'll working raster point (conversion toolbox). includes parameter pick field pull data from: the field parameter allows choose attribute field of input raster dataset become attribute in output feature class. if field not specified, cell values of input raster (the value field) become column heading grid_code in attribute table of output feature class. if want exclude values or subset data, can done either before converting (using con or similar) or after (select attribute , export or delete). doing afterwards gives bit more flexibility, leads larger point datasets.

javascript - Trying to make a button switch between two different values -

i don't know if sort of loop protection, want button when clicked toggles image on or off , code not working: <script> document.getelementbyid('standbybutton').onclick = function() { if (document.queryselector('#standby img').style.visibility = 'hidden'){ document.queryselector('#standby img').style.visibility = 'visible' } else { document.queryselector('#standby img').style.visibility = 'hidden' } return false; } </script> what missing? if image hidden, make visible. if else, make hidden. no? you're using assignment operator ( = ) , not comparison operator ( == or === ). edit: fyi, jslint (or similar) have caught this.

c# - Custom message box show time expiring before it runs out WinForms -

i have custom message box class : public class autoclosemsb { readonly system.threading.timer _timeouttimer; readonly string _caption; private autoclosemsb(string text, string caption, int timeout) { _caption = caption; _timeouttimer = new system.threading.timer(ontimerelapsed, null, timeout, system.threading.timeout.infinite); messagebox.show(text, caption); } public static void show(string text, string caption, int timeout) { new autoclosemsb(text, caption, timeout); } private void ontimerelapsed(object state) { intptr mbwnd = findwindow("#32770", _caption); if (mbwnd != intptr.zero) sendmessage(mbwnd, wmclose, intptr.zero, intptr.zero); _timeouttimer.dispose(); } private const int wmclose = 0x0010; [system.runtime.interopservices.dllimport("user32.dll", setlasterror = true)] private static extern intptr findwindow(string

evaluate the value of a expression in java using beanshell by passing variable to Math.pow( ) -

i trying evaluate expression in java directly, though easy expression , seems difficult me using beanshell anyway , problem: i can directly evaluate value of exponential using in java double c = math.pow(2,3); or way int a=2,b=3; double c = math.pow(a,b); in beanshell trying same , works: import bsh.interpreter; interpreter interpreter = new interpreter(); int a1=2, b1=3; string equation = "math.pow(2,3)"; object checkit = interpreter.eval(equation); system.out.println(checkit.tostring); but these lines dont work: string equation = "math.pow(a1,b1)"; object checkit = interpreter.eval(equation); system.out.println(checkit.tostring); **this progress ** update : code shows me error message sourced file: inline evaluation of: ``math.pow(finalstr,2);'' : undefined argument: the beanshell script not have access java local variables. script can see values have been given beanshell interpreter using of set() methods: import bsh

ios - Why the two CGRect don't intersect when they do visually? -

Image
i building app. needs accept user input uitextfield s. , keyboard hide text field need move view when keyboard cgrect intersects text field's frame . i followed this tutorial added of own logic because have multiple text fields. here relevant code: (the whole thing in vc conforms uitextfielddelegate ) var focusedtextfield: uitextfield? var viewmovedup = false var keyboardsize: cgrect! override func viewdidappear(animated: bool) { super.viewdidappear(animated) nsnotificationcenter.defaultcenter().addobserver(self, selector: selector("keyboardwillshow:"), name:uikeyboardwillshownotification, object: nil); nsnotificationcenter.defaultcenter().addobserver(self, selector: selector("keyboardwillhide:"), name:uikeyboardwillhidenotification, object: nil); nsnotificationcenter.defaultcenter().addobserver(self, selector: selector("onrotate:"), name:uideviceorientationdidchangenotification, object: nil); } override func viewdiddisapp

Angular 2 Quickstart App Throwing Errors -

when run code "5 min quickstart" https://angular.io/guide/quickstart here code i'm running , npm-debub.log https://gist.github.com/140173804bb527b5ed20 file structure: 2angular/ tsconfig.json package.json index.html app/ app.components.ts boot.ts do know what's going on? get both ts files inside of app folder or change system configuration not them in there: system.import('app/boot') and make sure running npm install before npm start

ios - UIImage Caching cause memory high -

Image
consider: +(nullable uiimage *)imagenamed:(nsstring *)name; i use method so: uiimage *image = [uiimage imagenamed:@"test"]; but image's type png. in project, loads lot of different images. so, cache hight your images huge. 3001*4057 12 million pixels. theres 3 bytes in 1 pixel (one byte red, green , blue each), image size have 12million * 3 bytes, 36mb per image. i scale down image size if can.

javascript - create dynamically buttons to show dialog -

i have button (create) , when it's clicked, creates new button (change coordinates) should able open dialog when it's clicked. first of created body of dialog window, created via javascript, how looks in html: <div id="dialog-form" title="change coordinates"> <p class="validatetips">both fields required.</p> <form> <fieldset> <label for="lon">longitude (decimal)</label> <input type="text" name="lon" id="lon" value="" class="text ui-widget-content ui-corner-all"> <label for="lat">latitude (decimal)</label> <input type="text" name="lat" id="lat" value="" class="text ui-widget-content ui-corner-all"> <input type="submit" tabindex="-1" style="position:absolute; top:-1000px"> </fieldset>

javascript - Handlebars loop to assign value to attribute -

i have values of array length dynamic. have image holder of 4. means if length of array 2, have 2 filled holder , left 2 empty holder. unfilled holder div i've tried below code doesn't suite needs, because produce div according length of arrays. {{#each product.image}} <div style="background-image:url(http://example.com/{{this}})"></div> {{/each}} <div></div> <div></div> <div></div> if want max number of 4 divs, filled data there , left empty if no data can use custom helper function: handlebars.registerhelper('times', function (index, options) { var result = ''; for(var = 0; < 4; i++) { if(options.data.root.product.image[i]){ result += '<div style="background-image:url(https://upload.wikimedia.org'+options.data.root.product.image[i]+')"></div>'; } else { result += '<div>empty div</div&g

Generating big sitemap, using MySQL and PHP -

i've made simple sitemap.php , generates sitemap.xml , using sitemap.xsl theme - it's populated mysql database. everything works, have 4,000,000+ products, , takes long time, , lot of memory, generate it. does have idea, how can make better performance? sitemap.php: http://pastebin.com/gm3sa4bs sitemap.xsl: http://pastebin.com/wvuuwt99

python - Use argparse to parse a list of objects -

i have program function takes class initializer , list of objects. each object consists of 3 variables id, value, , tag. class package(): def __init__(self, id, value, name): if (value <= 0): raise valueerror("amount must greater 0") self.id = id self.value = value self.tag = tag class purchase(): def submit(some_list): //do stuff def main(): //help here! parser = argparse.argumentparser() parser.add_argument("id", help="id") parser.add_argument("value", help="value") parser.add_argument("tag", help="tag") args = parser.parse_args() some_list = [args.id, args.value, args.tag] submit(some_list) i'm trying implement argparse in main() can run program doing like: python foo.py "int0 [(int1, float1, int2), (int3, float2, int4) ....]" . number of objects in list variable , depends on user input. i

java - Why doesn't pass-by-refernce work? -

this question has answer here: is java “pass-by-reference” or “pass-by-value”? 74 answers i understand passed reference in java. why doesn't work in case? had thought should print out "hate" instead of "love". class test { static class str { public string str; public void set(string str) { this.str = str; } } public static void main(string[] args) { str s = new str(); string str = "love"; s.set(str); str = "hate"; system.out.println(s.str); } } in main function, str stores reference string. when doing str = "hate" , reference changes original object "love" has been stored in s.str , remains there. see this more clarification.

javafx - Intelliguard, the YGuard based Obfuscation plugin for IntelliJ, seems totally awesome, but fails to work, and gives "Icon cannot be found" error -

intelliguard, yguard based obfuscation plugin intellij, seems totally awesome, fails work, , gives "icon cannot found" error. https://plugins.jetbrains.com/plugin/4511?pr=idea https://code.google.com/p/intelliguard/ after installing intelliguard plugin, awesome way, @ last step of configuration steps, there error: icon cannot found in '/nodes/moduleclosed.png', aclass='class com.github.intelliguard.ui.jaroptionsform' there material on error: https://github.com/ronniekk/intelliguard/issues/1 that material, @ bottom, mentions newest commit, , 1 guy able create working plugin.jar it. newest commit: https://github.com/olehrgf/intelliguard/tree/intellijidea13.1 this seems great solution current obfuscators, because free , configurations handled simple use gui. any in getting work appreciated.

python - turtle delete writing on Screen and Rewrite -

in code, under function, do: t = turtle.turtle() t.write(name, font=("arial", 11, "normal"), align="center") but when change screen, want delete text, , rewrite somewhere else. know "easy way out" of clearing whole screen. there way delete writing? i have tried drawing white square on text, did not work. has tried different? at first, thought simple matter of going same location , rewriting same text in same font using white ink. surprisingly, left black smudge , took 10 overwrites in white make presentable. however, came upon better solution, use separate turtle write text want dispose of , clear turtle before rewriting text in new position, else on screen, drawn different turtle, remains: import turtle import time def erasablewrite(tortoise, name, font, align, reuse=none): eraser = turtle.turtle() if reuse none else reuse eraser.hideturtle() eraser.up() eraser.setposition(tortoise.position()) eraser

php - Facebook connect api cannot get email -

i've set scope on login button, asks permission email can't email info. i'm testing fyi have main email , it's approved. i did this, didn't solve problem: facebook email field return null (even if “email” permission set , accepted) this code: define('your_app_id', 'x'); define('your_app_secret', 'x'); include_once 'facebook/facebook.php'; $facebook = new facebook(array( 'appid' => your_app_id, 'secret' => your_app_secret, )); $userid = $facebook->getuser(); <script> window.fbasyncinit = function() { fb.init({ appid : <?=your_app_id?>, status : true, cookie : true, xfbml : true, oauth : true, }); fb.event.subscribe('auth.login', function(response) { loading(1); <? if ($userid) { $userinfo = $facebook->api('/' + $userid + '?locale=en_us&fields=id,name,email'); } ?> var mail

java - Apache Tomcat 9.0 error in loading localhost -

Image
apache tomcat server starts console, generates error when try open localhost page in web browser.i done setting paths in environment variables , working fine started generate error here screenshot displaying error and full error message- type exception report message java.lang.noclassdeffounderror: javax/el/elresolver description server encountered internal error prevented fulfilling request. exception javax.servlet.servletexception: java.lang.noclassdeffounderror: javax/el/elresolver org.apache.jasper.servlet.jspservlet.service(jspservlet.java:338) javax.servlet.http.httpservlet.service(httpservlet.java:729) org.apache.tomcat.websocket.server.wsfilter.dofilter(wsfilter.java:53) root cause java.lang.noclassdeffounderror: javax/el/elresolver java.lang.classloader.defineclass1(native method) java.lang.classloader.defineclass(unknown source) java.security.secureclassloader.defineclass(unknown source) java.net.urlclassloader.defineclass(unknown source) java.net.urlclassl

python - Replace values in a ctypes c_char array -

i have program creates array of 8192 bytes of data. want change value below returnbuffer array: serialbuff = returnbuffer[0x14:0x28] datatowrite = "15510580029600000000" returnbuffer = returnbuffer.replace(serialbuff, datatowrite) but result got : attributeerror: 'c_char_array_8192' object has no attribute 'replace' can please me? the error because arrays don't have replace method. know have no public facing methods. in order replace contents either perform 1 1 assignement (no need write counters in hex, it's allowed why not): for in range(0x14, 0x28): returnbuffer[i] = datatowrite[i - 0x14] or use slicing (as suggested @eryksun): returnbuffer[0x14: 0x28] = datatowrite.encode('utf-8') one of these should trick. as example more simple values: in [71]: arr = 5 * ctypes.c_char in [72]: c_arr = arr("0", "1", "2", "3", "4") in [73]: print c_arr[:] 01234 i

uitableview - iOS Swift - TableView Delete Row Bug -

the error: 'invalid update: invalid number of rows in section 0. number of rows contained in existing section after update (1) must equal number of rows contained in section before update (1), plus or minus number of rows inserted or deleted section (0 inserted, 1 deleted) , plus or minus number of rows moved or out of section (0 moved in, 0 moved out).' looking @ many related posts, still cannot find answer. here relevant code snippets (does not contain of code): var todoitems : [assignment] = [] var sections = dictionary<string, array<assignment>>() var sortedsections = [string]() override func tableview(tableview: uitableview, commiteditingstyle editingstyle: uitableviewcelleditingstyle, forrowatindexpath indexpath: nsindexpath) { if editingstyle == uitableviewcelleditingstyle.delete { var tablesection = sections[sortedsections[indexpath.section]] tablesection!.removeatindex(indexpath.row) tableview.deleterowsatindexpaths(

javascript - How to set value in p tag using jq? -

i trying search bank name onkeyup , want put result in p tag it's not happening. can me anyone? this jq : //search bank name $('input[name^="acc_voucher_bank[]"]').live('keyup',function(){ var acc_voucher_bank=$(this).val(); $(this).closest('tr').find('p.banknameresult').show(); $.post("../accounting_model/cash_receive_daily_date_wise.php",{ acc_voucher_bank:acc_voucher_bank, rand:math.random() },function(data){ $(this).closest('tr').find('p.banknameresult').html(data); }) }) html code : <table width="100%" id="mytable"> <tr class="tr_view"> <td style="width:25%;">bank name</td> <td style="width:30%;">branch name</td> <td style="width:15%;">a/c. no</td> <td style="width:15%;&

Bootstrap - Carousel | Links not working -

i have been using video tutorial bootstrap carousel , somehow code same per video yet links not working... the code... <!doctype html> <html> <head> <meta charset="utf-8"> <title>portfolio document</title> <link rel="stylesheet" type="text/css" href="css/bootstrap.css"> <script src="js/bootstrap.min.js"></script> <script src="https://code.jquery.com/ui/1.11.4/jquery-ui.min.js"> </script> </head> <body> <nav class="navbar navbar-default"> <div class="container"> <div class="navbar-header"> <div class="navbar-brand">photo gallery</div> </div> <ul class="nav navbar-nav"> <li><a href='#'>home</a></li> <

susy - Nest elements has different padding value -

i spent couple hours figure out no luck, i've configuration $susy: ( columns: 12, gutters: 54px/53px, container: 1230px ); in layout file _layout.scss , i've this @include layout( $susy inside ); .content-area { padding-top: gutter( 6 ); .layout-2c-l & { @include span( 8 of 12 no-gutters ); @include gutters(5); // 62.0625px } .archive.layout-2c-l &, .search.layout-2c-l & { padding-left: 0; padding-right: 0; } } in case, on archive , search page i've remove gutters re-added via it's child elements in _archives.scss file .page-header { @include gutters(5); // 41.375px } as can see code above beside gutters add pixel value, first gutters resulting 62.0625px , the second 1 41.375px . if how susy works, there way same result? unless set math: static in susy config, susy output % values based on context give it. if tell in context of 5 both places, same %

How to share an existing facebook post to user timeline from an iOS app? -

our app shows facebook posts artists our users follows. want enable our users share posts timeline (like share button see under each post in facebook feed). we tried using facebook web dialogs, keep running errors. example: when trying share post of type photo: if set parameter "picture" picture url, error feed dialog should not use picture coming form fbcdn. we can share photo link, photo doesn't appear on user timeline. is there way mimic functionality of built in share button? concerning "feed dialog should not use picture coming form fbcdn" -problem: might want fetch image url (use https://graph.facebook.com/post_id post object containing url) , forward image data via own server. there ways hide original url client (read this post ) if facebook still complains.

java - Can an Actor handle click and key down events? -

i'm trying make actor handle both click , key down events. initialized actor (in case, image ) following: stage = new stage(); texture = new texture("badlogic.jpg"); image image = new image(texture); image.addlistener(new clicklistener() { @override public void clicked(inputevent event, float x, float y) { gdx.app.log("image clicklistener", "clicked"); } @override public boolean keydown(inputevent event, int keycode) { gdx.app.log("image clicklistener", "keydown. keycode=" + keycode); return true; } }); stage.addactor(image); gdx.input.setinputprocessor(stage); when click on image , clicked event fired expected, i.e., see respective log. however, no matter key press, key down event not fire. question is: why? can't actor able handle both click , key down events? by default should rather attach keyboard listener stage since stage has keyboard focus on it s

timer - combine or add values in Action Script 2.0? -

i'm new , trying add values using either arrays of functions combine values keep showing nan. function combine(a, b, c):number{ return + b + c; } var total = combine(mytimer1, mytimer2, mytimer3); totaltimers.text = total; without seeing part of code generates mytimer1 , mytimer2 , mytimer3 can't sure why happening, seems variables either not of type number or have values of null or undefined . i recommend starting tracing out values of mytimer1 , mytimer2 , mytimer3 (or inspecting them in debugger) see of these causing problem.

javascript - Angular/ Node.js Website - Automatic mail notification -

i want check every 12hours, if new things available users. if so, email should send automatically server. took @ https://nodemailer.com , don't know if thats right tool; important thing is, server e.g. @ midnight runs job automatically , sends mails. can give me advice? yes, can use nodemailer sure, there other mailing modules mailgun. need use 1 of these module send mails. it's easy use. can use event module fire event @ midnight check updates , send mail.

c# - Fill and Refresh Datagridview upon button click -

i upon button click retrieve , place data onto datagridview. however, after change "location", location , execute button click receive error. below code have , error receive. code: private void button1_click(object sender, eventargs e) { updatedg(); } private void updatedg() { con = new oledbconnection("provider=microsoft.ace.oledb.12.0;data source=f:\\dbfile\\masterdata.accdb"); con.open(); datatable dt = new datatable(); oledbdataadapter da = new oledbdataadapter(); da = new oledbdataadapter("select inc1, inc2 mtable loc='" + location+ "'", con); da.fill(dt); dg.datasource = dt; dg.columns[0].headertext = "inctest1"; dg.columns[1].headertext = "inctest2"; con.close(); error: the microsoft access database engine cannot find input table or query 'mastertable'.

Javascript: How to execute a code after multiple events have happened? -

i want run function after several events has happened event listener like: listento(eventa occurred && eventb occured && eventc occurred) { something. } how can accomplish that? please try promise.all var p1 = new promise(function(resolve, reject) { listento(eventa, resolve); }); var p2 = new promise(function(resolve, reject) { listento(eventb, resolve); }); var p3 = new promise(function(resolve, reject) { listento(eventc, resolve); }); promise.all([p1, p2, p3]).then(function(value) { // 3 events triggered. dosomething... });

javascript - jQuery - How to evaluate two select option values for an if/else statement? -

i have continue button class "options-btn" on page (it's multi-step booking process), 2 select fields on page. 1 of these dropdown select fields needs have value selected user before can click submit button on page while disabling click event? each dropdown field has default select option 0, other choice of "1". how can write function "if neither 1 of these options has value of 1 selected - alert message "please select option" , disable button. the 2 id's associated these select fields are: #extra_units_7 & #extra_units_4 this wrote far, it's not working: jquery(document).ready(function($) { $(".options-btn").click(function() { if ( $('#extra_units_7').val() === 0 || $('#extra_units_4').val() === 0 ) alert("please select option"); return false; } else { $('.options-btn').trigger('click'); } }); i re-factored html in order enable feedbac

spring security - Retrieve user role and group from jboss container using JAAS API CALL -

in current project, have scenario user login portal , authenticated via tam(tivoli). after login portal there link user redirected our application (spring mvc) hosted on jboss. information have is, user role , group info available within our container , have make jaas api call retrieve user roles , group info further used spring security authorization purpose. can imagine spring pre-authentication scenario user been authenticated (sso) , authorization need retrieve role , group info . please assist me correct understanding , how user role/group jboss container using jaas api? code snippet or link (spring implementation) helpful. thanks, cd it seems need create sso structure, isn't spring documentation useful enough? you can find sso part here: spring security reference: chapter 9 what applicationserver using? can more specific question on implementation instead?

asp.net mvc - Inner join using ado.net is not working properly -

inner join using ado.net not working properly. please see attached code , let me know. receiving string array values in "values". think have problem in code itself. public jsonresult searchdata(string[] values,string[] values1,string[] values2) { //string str; //for (int = 0; <= values.length; i++) //{ // str = values[i]; // console.writeline(str); //} using (sqlconnection connection = new sqlconnection("data source=.; database=srivatsava; integrated security=sspi")) { dataset ds = new dataset(); connection.open(); sqlcommand cmd = connection.createcommand(); string str= "select accntname,bu,salesop,isdormant fourth_page fg"+ " inner join linked ld on ld.productid=fg.productid"+ "inner join is

How to remove loading product images from cache in magento? -

due problems product images in cache folder turned empty (file there empty).magneto loads product images cache folder only. example: http://example.com/media/catalog/product/cache/54/small_image/295x295/9df78eab33525d08d6e5fb8d27136e95/b/r/br7462vi_1.png here br7462vi_1.png turned empty.(0 bytes). but http://example.com/media/catalog/product/b/r/br7462vi_1.png works fine. how can stop magento loading product images cache? no need worry. login admin panel. goto admin ->system ->cache management click on flush catalog images cache and flush magento cache. now image urls should work. if have still problem give 777 permission on media/catalog/product directory. i hope works.

c - Dereferencing this pointer gives me -46, but I am not sure why -

this program ran: #include <stdio.h> int main() { int y = 1234; char *p = &y; int *j = &y; printf("%d " , *p); printf("%d" , *j); } i confused output. i'm seeing is: -46 1234 i wrote program experiment , wasn't sure going output. expecting possibly 1 byte y . what happening "behind-the-scenes" here? how dereferencing p give me -46? update pointed out other had explicit casting not cause ub.i not changing line char *p = &y char *p = (char *)&y not invalidating below answers. there couple of issues code written. first of all, invoking undefined behavior trying print numeric representation of char object using %d conversion specifier: online c 2011 draft , §7.21.6.1, subclause 9: if conversion specification invalid, behavior undefined.282) if argument not correct type corresponding conversion specification, behavior undefined. yes, objects of type char promoted int

Pass Parameter ALong with Json Query android -

json query fetch user data : http://abcd.in/getallusers.php but in query user need pass usertype. i tried : http://abcd.in/getallusers.php/usertype but response { "status":false,"message":"send required parameters"} can 1 me this. have 2 types of user (simple , vip) how can pass usertype in json query

Android: Padding not working in RelativeLayout -

Image
i want have padding between description text , switch paddingright property not working. why? <relativelayout android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/layoutlayout" android:layout_below="@+id/layoutheader" android:layout_margintop="15dp" android:layout_marginleft="15dp" android:layout_marginright="15dp"> <switch android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/widgetshortswitch" android:layout_centervertical="true" android:layout_alignparentright="true" /> <textview android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="this long description text should not overlay." android:textcolor=&qu

EXIF image in php -

i have page image gets uploaded image not right way. know need use exif new , lost start on in while loop can 1 me thx jason here code <section class ="box_1"> <form id="evaluations" method="post" action="comments_page_add.php" enctype="multipart/form-data">`enter code here` <table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#cccccc"> <tr> <td bgcolor="#ffffff">&nbsp;</td> <td colspan="4" bgcolor="#ffffff"><strong>parent entered</strong> </td> </tr> <tr> <td align="center" bgcolor="#ffffff">#</td> <td align="center" bgcolor="#ffffff"><strong>name</strong></td> <td align="center" bgcolor="#ffffff"><strong>lastname</strong></td> <

python - Unable to connect to local Postgresql server using django -

i'm getting following error when try connect postgresql server locally same ec2 instance postgresql server: django.db.utils.operationalerror: fatal: ident authentication failed user "django" i checked pg_hba.conf make sure allowed local connections: # "local" unix domain socket connections local trust # ipv4 local connections: host 127.0.0.1/32 trust my settings.py has following settings: databases = { 'default': { 'engine': 'django.db.backends.postgresql_psycopg2', 'name': 'famtest', 'user': 'django', 'password': '', 'host': 'localhost', 'port': '5432', } } these settings work when run project on machine(i change 'localhost' ip address) not when try run project same ec2 instance. real

android - Can't rotate marker using google maps v.2 -

the goal make marker rotate towards next coordinate point. here method angle: private double computeanglebetween(latlng from, latlng to) { double fromlat = from.latitude; double fromlng = from.longitude; double tolat = to.latitude; double tolng = to.longitude; double dlat = fromlat - tolat; double dlng = fromlng - tolng; return 2 * asin(sqrt(pow(sin(dlat / 2), 2) + cos(fromlat) * cos(tolat) * pow(sin(dlng / 2), 2))); } and here code, create marker: @override public void onmapready(googlemap googlemap) { //unnecessary code deleted float bearing = (float)computeanglebetween(theroute.get(0),theroute.get(1)); marker theairplane = gmap.addmarker(new markeroptions() .position(start) .icon(bitmapdescriptorfactory.fromresource(r.drawable.airplane)) .flat(true) .anchor(0.5f, 0.5f) .rotation(bearing) .draggable(true)); theairplane.setrotation(bearing); m

java - Criteria Query 2, query through 3 entities level -

i learning criteria api, encounter issue create query. here structure : an admin has list of groups, group has list of admins (so manytomany relationship) a group has list of companies, company has 1 group (so onetomany) to find groups of admin created request : @override public list<group> getallgroupsmanagedbyadmin(admin admin) { final criteriabuilder cb = entitymanager.getcriteriabuilder(); final criteriaquery<group> query = cb.createquery(group.class); final root<admin> admins = query.from(admin.class); query.where(cb.equal(admins.get(admin_.id), admin.getid())) .select(admins.join(admin_.groups)); return this.entitymanager.createquery(query).getresultlist(); } now i'm trying find companies of 1 group sure group managed admin provided in parameter, method definition : public list<company> getcompaniesbygroupidmanagedbyadmin(string groupid, admin admin) but drafts failed @ moment. give me ? thank ! finally find myself, s

Custom module in drupal 8, tab not created in admin section -

Image
i created custom module in drupal 8. module should create tab in admin/content. unfortunately tab not display in admin/content section. while can able access module. link access module 'localhost/demo/admin/content/book' here code:- book.routing.yml # book.routing.yml snippet book.admin: path: '/admin/content/book' defaults: _form: '\drupal\book\form\bookform' _title: 'books' requirements: _permission: 'book access' book.links.menu.yml # book.links.menu.yml snippet book.admin: route_name: book.admin title: books base_route: system.admin_content for more information attaching screenshot, want tab expecting 1 you should rename file book.links.task.yml because want "task" of content instead of real menu link. here's great explanation , guide how create custom modules: http://www.sitepoint.com/build-drupal-8-module-routing-controllers-menu-links/ note of file namings outdate

c# - WPF - put the name of every textblock in an array -

i want know if it's possible let code scan every name of every textblock in xaml file , put array. for example: xaml: <textblock x:name="textblock1" /> c#: string[] textblocknames = new string[] { "textblock1", "2", ... }; i know how scan controls type, has been explained here: find controls in wpf window type . don't know how find names , put in array. i want use put borders around it, , similiar this: (int = 0; < textblocknames.length; i++) { border brd = new border(); brd.name = string.format("border_{0}", i); brd.borderthickness = new thickness(0, 0, 1, 1); brd.borderbrush = brushes.black; brd.child = textblocknames[i] } can me this? thanks in advance! you can search texblocks in way: solution . can names every textblock in foreach loop like: tb.text , , put them array. can add border in way: (int = 0; <

Sorting and separating code in Node.js -

how sort text in node.js. scrape webpage , console log this: 22.777.000.1794219rcnvndsfdsgreg2 rnc 99 aiknx aha i cant scrape specific parts of this, comes in 1 peace. want separate , specific parts of it. it's console log message. check code printing this. apply breaks wherever required

html - display inline doesnt work correctly -

i have code: the image placed behind input element , not next (with small margins). this how works now: inline doesnt work i not every item 1 followed other without overlap css .mfc-number-step { margin: 10px; input { width: 202; height: 41px; } } .mfc-number-step__status--error { border-color: red; background: #fff3f2; } .mfc-number-step__status--disabled { color: #8b8b8b; } .mfc-number-step__button { width: 41px; height: 41px; } input, img { display: inline; } html <div class="mfc-number-step"> <input type="text" ng-class="{'mfc-number-step__status--error' : mfcnumberstepstatuserror === 'true' , '.mfc-number-step__status--disabled' : mfcnumberstepstatusdisabled === 'true'}" ng-disabled="mfcnumberstepstatusdisabled === 'true'" value="{{mfcnumberstepunitmeasure}}" class="mfc-number-step__input"/> <img src=&quo

plone - Solr schema.xml changes not recognized by Solr -

i made tiny change in schema.xml file. thing did changing stopwords file stopfilter uses: <filter class="solr.stopfilterfactory" ignorecase="true" words="stopwords.txt" /> changed <filter class="solr.stopfilterfactory" ignorecase="true" words="stopwords_de.txt" /> stopwords_de.txt predefined set of stopwords provided solr. however, problem changes in schema won't applied when reindex. checked solr admin ui schema browser field , stopfilter still uses old stopwords file after reindexing. do need reload core or restart solr these changes apply? far reindexing did job fine. i using collective solr 4.1.0 search on our plone 4.2.6 system. restart server. also, have @ documentation reloading core. http://localhost:8983/solr/admin/cores?action=reload&core=yourcorename reload core without restarting server. please note since solr 4.0, not reload (e.g. changes in <datadir>

c# - Windows 10 Universal App - Geofence Background task not being triggered -

i'm trying create windows uap (c#) log location data in background task, i'm trying start background task off of geofence trigger. i've followed lot of guides how this, i've added entry point in package.appxmanifest "backgroundtask.locationbackgroundtask" , selected location property. i'm registering task using following: var result = await backgroundexecutionmanager.requestaccessasync(); var builder = new backgroundtaskbuilder(); builder.name = backgroundtaskname; builder.taskentrypoint = backgroundtaskentrypoint; builder.settrigger(new locationtrigger(locationtriggertype.geofence)); var geofencetask = builder.register(); i use following code verify if background task registered , returns true indicate task registered: public bool istaskregistered() { var registered = false; var entry = backgroundtaskregistration.alltasks.firstordefault(keyval => keyval.value.name == backgroundtaskname); if (entry.value != null) regist

php - When does an ajax request in jquery consider an http post request successful? -

here excerpt w3.org on http responses: 10.2 successful 2xx this class of status code indicates client's request successfully received, understood, , accepted. 10.2.1 200 ok the request has succeeded. information returned response dependent on method used in request, example: get entity corresponding requested resource sent in response; post entity describing or containing result of action; is considered "received, understood, , accepted" when $_post[] variables stored in other variable? edit: here ajax call calls empty php file. $.ajax({ url: 'process.php', data: 'type=new&title='+title+'&startdate='+start+'&zone='+zone, type: 'post', datatype: 'json', success: function(response){ event.id = response.eventid; $('#calendar').fullcalendar('updateevent',event); }, error: function(e){

math - Calculate sound value with distance -

i have more mathematical programming question, sorry if i'm not in right section. in 2d game, can move camera on map there objects can emit sound, , sound volume (defined float 0 1) must increase when screen center near object. example, when object @ screen center, sound volume 1, , when move away, volume must decrease. each object has own scope value. (for example 1000 pixels). i don't know how write method can calculate it. here of code (which not right calculation) : private function setvolumewithdistance():void { sound.volume = getdistancefromscreencenter() / range; // volume 0 1 float, range scope in pixels , // , getdistancefromscreencenter() distance in pixels } i have method calculates distance of object center screen : public function getdistancefromscreencenter():float { return math.sqrt(math.pow((cameraman.getinstance().getfocusposition().x - position.x), 2) + math.pow((cameraman.getinstance().getfocusposition().y

jquery - Display time duration as hourly in Javascript? -

i have program calculate downtime want start calculating starting point end downtime finish. e.g (0 5minutes ,49minutes, 1hr : 36minutes) methods can try ? to time (in milliseconds) can call date.now() . store somewhere , call function again @ end. subtract start end , total time elapsed, in milliseconds. after that, rest simple math transform milliseconds seconds, minutes, hours , forth.

html - Div does't scale to child image's scaled width (Firefox issue) -

i have images in horizontally scrolling div so: html <div id="sg-container" > <div id="sg-scroll"> <div class="sg-pic_wrap"><img src="#" class="sg-pic"></div> <div class="sg-pic_wrap"><img src="#" class="sg-pic"></div> <div class="sg-pic_wrap"><img src="#" class="sg-pic"></div> <div class="sg-pic_wrap"><img src="#" class="sg-pic" ></div> <div class="sg-pic_wrap"><img src="#" class="sg-pic"></div> <div class="sg-pic_wrap"><img src="#" class="sg-pic"></div> </div> </div> css #sg-container{ margin:0px; width:100%; left:0; top:0; bottom:50px; position:fixed; ove

sql - SUM of COUNTS MySQL -

i have following sql query select (select count(cid) uid=45 group cid) cats (select count(cid) uid=45) cats_total the first sub-select produces 4 rows , counts number of items in each cid. second sub-select produces 1 row , counts numbers of items total. my problem lies in second sub-select. sql producing error because have different amounts of rows. there adjustment can make second sub-select has 4 rows, or whatever amount of rows first sub-select produces? update: let me clarify further table need produce +------+------------+ | cats | cats_total | +------+------------+ | 2 | 17 | | 5 | 17 | | 1 | 17 | | 9 | 17 | +------+------------+ alternative, can use union all , select sum(totals) grandtotal ( select count(cid) totals uid=45 group cid union select count(cid) totals uid=45 ) s