Posts

Showing posts from June, 2013

rest - Python Flask persistent object between requests -

i creating web interface omxplayer on raspberry pi. i'm trying create more rest api controlling video while playing. issue i'm having how control video while playing. currently can create player object methods available start , stop video. @main.route("/video", methods=["get", "post"]) @login_required def video(): form = videoform() if form.validate_on_submit(): url = form.url.data vid_output = form.vid_output.data player = player(url=url, output=vid_output) player.toggle_pause() return redirect('/video') return render_template("video.html", form=form) now want have url can run player.toggle_pause() method again. @main.route("/video/stop", methods=["get", "post"]) @login_required def video_stop(): player.toggle_pause() my problem cannot find way have object persist between 2 requests. video start playing after sending first re...

How can I transform XML to HTML using XSL with Java Transformer class -

i can't transform xml file html. doesn't parse xml data html file, in writes table headers. i'm new xml , namespaces , uri's confuse me allot. think wrong imports. here xml file: <?xml version="1.0" encoding="utf-8"?> <banks xmlns="http://bankinfo.com/banks" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://bankinfo.com/banks banks.xsd"> <bank> <name>hkb bank</name> <country>bavaria</country> <deposit type="demand deposit" accountid="d172061"> <depositor>alissa lange</depositor> <amount>5000</amount> <profitability>7.0</profitability> <constraints>p10m</constraints> </deposit> </bank> </banks> here xsl file(both in same folder): <?xml version="1.0...

how retrieve array returned by config in zend framework 2 -

how can array returned config/autoload in zend framework 2? #config/autoload/myconfig.local.php return array('foo' => 'bar'); i noticed if file have not "return array()" exception throw this config merged automatically in whole app config. can calling $sl->get('config') on servicemanager. there config have.

mysql - SQL with group by and having clause -

i have table a id saln indicator 1 100 2 100 b 3 200 4 200 c 5 100 c 6 300 b 7 200 d i need pull saln table after grouping saln , group having indicator a,b ,c only saln 100 please let me know sql this select saln indicator in('a','b','c') group saln having sum(indicator) = 100

c - Reading ntdll.dll + offset results in an access violation -

i'm trying read byte byte memory of ntdll.dll loaded inside executable. executable compiled x32 executable on x64 windows 7 machine. i wrote function called findpattern receives specific byte array , looks byte array in ntdll.dll module. i have checked function on other modules , i'm sure works fine. now when im using function on ntdll module, crashes when reads memory ntdll + 0x1000. i checked on windbg, , windbg cant read memory well: 0:000> db ntdll + ff0 l20 77df0ff0 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................ 77df1000 ?? ?? ?? ?? ?? ?? ?? ??-?? ?? ?? ?? ?? ?? ?? ?? ???????????????? i have no clue why happen, consists 0x9000 bytes 0:000> db ntdll + fff0 l20 77dffff0 ?? ?? ?? ?? ?? ?? ?? ??-?? ?? ?? ?? ?? ?? ?? ?? ???????????????? 77e00000 8b 44 24 04 cc c2 04 00-cc 90 c3 90 cc c3 90 90 .d$............. it didnt happen in other dll checked.. problem can bypassed using readprocessmemory want understand causing it. ru...

javascript - Form doesnot post data edited from jQuery -

i'm having simple app includes form , 2 buttons.' description when user clicks first button site checks if has discount coupon , if has calculates discount ammount based on coupon. thats pretty simple. if user doesn't enter code the precess continues normaly. the problem with data i'm posting i'm posting coupon field. if user has entered valid coupon disable coupon input jquery , withit disable ammount field. causes problem makes fields edited jquery "unpostable". for example if dont enter coupon code field stays unlocked , jquery never edits it. the code <form class="form-horizontal row-fluid" action="<?= base_url() . 'transactions/new' ?>" method="post" id="form" name="form"> <div class="control-group"> <div class="alert js_hidden" id="psc_val_warning"> Παρακαλούμε...

python - environment variables not available to supervisor-run celery workers -

i have been having trouble reading environment variables in celery tasks when celery run via supervisor in /etc/supervisord.conf ... ... [program:celery] ... command = /home/myuser/mydevelopment/git/ers_data_app/env/bin/celery worker -a webapp.celery --loglevel=info stdout_logfile=/home/webdev/logs/celeryworker.log stderr_logfile=/home/myuser/logs/celeryworkererr.log environment=flask_config="testing" in myapp/myfile.py ... ... print 'the system config is', os.getenv('flask_config') dburi = app_config.config[os.getenv('flask_config')].database_uri in celeryworker.log ... the system config none in celeryworkererr.log ... ... file "/home/webdev/mydevelopment/git/ers_data_app/webapp/dbmodels/database.py", line 16, in <module> dburi = app_config.config[os.getenv('flask_config')].database_uri keyerror: none since supervisor doesn't start shell, following unnecessary, here completeness.. in /etc/pr...

android - Local and GMT Time don't give a correct result -

i'm developing im app android, want use "last seen" friends see when there friends went offline. idea is: 1. in client side, when user leave app, send server special message containing time in gmt. 2. in server side, server pass time (gmt) friends. 3. in other clients, each client converts gmt time local time. here how built message send: if (status.tolowercase().equals("offline")) { status =estools.getgmttimadate(system.currenttimemillis());//important entryactivity.currentopenchatid = "none"; } log.d("offline--","will send status = "+ status); onlinemsg.putextra("action", "com.__.message"); string nowtime = "" + system.currenttimemillis(); onlinemsg.putextra(constantsgcm.typeclm, constantsgcm.onst); onlinemsg.putextra(constantsgcm.status_on_of,status);// if offline time in gmt zone onlinemsg.putextra(constantsgcm....

html - Starting a css site but format issues -

the link of site here progerdevs.co.nf test site. when load page on android displayed horribly, on place. know called changes when theres different screen size? still have lot learn :/ changes mean example images displayed verticaly , top navigation bar. you must talking media queries. suppose want change how site looks depending on set of screen resolutions (width) 320px 768px 1024px then must define media query each resolution, , put in css rules element want adapt. example: want change font-size of document: @media screen , (min-width:0px) { body { font-size:10px; } } @media screen , (min-width:320px) { body { font-size:12px; } } @media screen , (min-width:768px) { body { font-size:14px; } } @media screen , (min-width:1024px) { body { font-size:16px; } } depending on screen resolution of device, font-size change, can same property of html element. or can use bootstrap, requires deeper knowledg...

arrays - php explode doesn't second item -

i'm trying split image string: $output = "<img typeof="foaf:image" src="http://asite.dev/sites/default/files/video/mbi_part%201_v9.jpg" width="1920" height="1080" alt="" /> i'm doing this: $split = explode('"', $output); but when print_r($split); it returns: array ( [0] => typeof="foaf:image" [2] => src="http://makingitcount.dev/sites/default/files/video/mbi_part%201_v9.jpg" [3] => width="1920" [4] => height="1080" [5] => alt="" [6] => /> ) no second value! where'd go? split[1] throws error, of course. notice " <img " part of string isn't in array either. the problem stems parsing of html tag. if remove <img @ beginning of html string, you'll notice rest of attributes parse array proper number sequence (including '1' element). can solve problem formatting quotes tell php not ...

python - Creating a custom login for user changed the login for my Admin. How to prevent that? -

i creating web application users have register , create profiles. using "abstractbaseuser" class provided django, wanted add other fields. now, when user logs in, want login credentials mobile number , password. created custom authentication function , registered in settings.py. problem changed login admin sit, want remain same. i followed tutorial add custom fields user link my models.py: from django.db import models django.contrib.auth.models import abstractbaseuser django.contrib.auth.models import usermanager class userinfo(abstractbaseuser): email = models.emailfield('email address', unique=true,) mobile = models.charfield(max_length=15, unique=true,) address = models.charfield(max_length=500) landmark = models.charfield(max_length=50) status = models.booleanfield(default=false) is_active = models.booleanfield(default=true) is_admin = models.booleanfield(default=false) username_field = 'mobile' def __un...

objective c - How can I programmatically determine if my OSX app was launched from the Applications dir? -

i've built app osx , built .dmg installer it. however, users have trouble following huge arrow in background image telling them drag app /applications folder. ;-) i nice if it's possible following: somehow detect if app launched /applications dir if wasn't, offer automatically move app dmg /applications dir, user, , launch there if #2 isn't os allow, display alert , close down app. i can figure out #3 on own, i'm wondering if #1 , #2 possible , how might go them. [nsbundle mainbundle] represents application bundle. can use app's url. you can use nsurl volume information app's url , determine if launched within dmg. e.g.: nsurl* bundleurl = [[nsbundle mainbundle] bundleurl]; nsstring* volumename = nil; if ([bundleurl getresourcevalue:&volumename forkey:nsurlvolumenamekey error:nil]) { if ([volumename isequal:@"my app installer"]) // or whatever dmg volume name { [self trymigratingtoappsfolder]; ...

php - Wordpress user id -

i have custom page submits form custom wordpress page. need check userid on page, : $user_id= get_current_user_id(); when echo variable 0. however, if access page directly (without submitting form) shows correct userid. to make stranger, when submit form admin bar disappear if wasn't logged in, again, if access page directly admin page appear. what happening when submit form cause this? i should mention page im submitting copy of page.php few lines of code submit variables database. have suggestions?

excel formula - Count values in a range comprehended between two values -

Image
at column have values 1 0 3 2 0 5 1 1 1 0 2 1 1 1 0 2 1 1 1 0 0 3 0 2 0 0 3 1 this list grows everyday. need formula put on every cell of column b counts upwards how many values bigger 1 until next value = 1 found. in words need count how many values larger 1 between 1's. pretended result this: 1 0 3 2 0 5 1 3 1 0 2 1 1 1 0 2 1 1 1 0 0 3 0 2 0 0 3 1 3 thanks in advance i use helper column, if acceptable. so create running count of numbers greater 1 resets each time encounters '1', enter starting in b2 , pull down (i'm assuming data has heading , list starts 1) :- =if(a2=1,0,b1+(a2>1)) then display counts @ each '1' value (but not repeated ones) enter in c2 , pull down:- =if(and(a2=1,a1<>1,isnumber(a1)),b1,"") it's possible array formula, not sure if it's worth effort:- =if(and(a2=1,a1<>1), countif( offset( a$1, max(row(a1:a$2)*(a1:a$2=1))-...

linux - xcode build script on Mac OS X not working because env node not found / login not working, too -

i'm using crontab this * * * * * path=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin cd /users/kaiserpatrick/documents/web-app && ./build.sh > /dev/null 2>&1 i tried things echo "1" | login kaiserpatrick or login -f command or without path variable. but nothing works. each time i've got error. env: node: no such file or directory i tried change script header thing ones. - not working. #!/bin/bash #!/usr/bin/env sh #!/usr/bin/node i dont know why apple cant use simple bashrc file or profile file ... but none of them exists in ~. no profile, no bashrc no ...... the file /etc/bashrc. if append . /etc/bashrc on crontab doesn't work, too. really bad morning :( use echo $path in normal logged in shell. then prepend path= result above cronjob/crontab , on line end ; . after ; can add script or command. then work's!

Is there a Universal Voxel Translator available? -

is there simple program anywhere knows how translate voxel type voxel type b. don't want buy voxel editor, want translate voxels same way i'd translate bmp jpg or png gif. yes. there free fair source universal voxel project named uvox. you can find here: http://tox.land/uvox/ their project goal support voxel formats.

python - Mechanisms for creating long-running process -

are there alternative mechanism(s) creating long-running process besides running infinite loop? the common pattern seems this: while true: # check condition or waiting event # processing time.sleep(0.01) i particularly interested in scenario process acts worker listens event (e.g. waiting on task queue). what performance characteristics of alternative approaches? prior art on "wait , process job" thing has been done few different ways: worker processes or threads (see multiprocessing , threading helpful primitives) event-based processing (asyncio, twisted, , few others). asyncronous io library raises event when data on stdin or whatever pipe choose. single-threaded io buffer. depending on desired load characteristics, reasonable worker processes wait on io , process when comes. no fancy queueing. let kernel buffer io , calling process block when gets full.

javascript - How do I load text from a file into a div? -

i'm designing support site business. way decided create accordion menu , allow user select list of faqs. when user clicks faq, want page pull answer text file in directory contains answer, display in div. is there way without ajax, php, or jquery? javascript okay, that's 1 i'm familiar with. when user clicks faq, want page pull answer text file in directory contains answer where text file , directory stored? presumably, somewhere on server. and process of pulling file server html page commonly called ajax. so, directly answer question: no, not possible. need ajax described.

php - Automaticlly attach to pivot table in Laravel 5 -

i have users groups relationship (manytomany) pivot table group_user. want user able create group once creating group, how make it, creator becomes member of group? currently have my pivot table (group_user): schema::create('group_user', function(blueprint $table) { $table->integer('group_id')->unsigned()->index(); $table->foreign('group_id')->references('id')->on('groups')->ondelete('cascade'); $table->integer('user_id')->unsigned()->index(); $table->foreign('user_id')->references('id')->on('users')->ondelete('cascade'); $table->timestamps(); }); my groups table (groups): schema::create('groups', function(blueprint $table) { $table->increments('id'); $table->string('name'); $table->timest...

java - How to Update JFrame Components? -

well, have code. import java.awt.eventqueue; import javax.swing.jframe; import javax.swing.jlabel; import javax.swing.imageicon; import javax.swing.swingconstants; import javax.swing.jprogressbar; import javax.swing.swingutilities; import java.awt.font; import javax.swing.jseparator; import javax.swing.jtextpane; import javax.swing.jbutton; import java.awt.event.mouseadapter; import java.awt.event.mouseevent; public class menu { private jframe frmfelps; /** * launch application. */ public static void main(string[] args) { eventqueue.invokelater(new runnable() { public void run() { try { menu window = new menu(); window.frmfelps.setvisible(true); } catch (exception e) { e.printstacktrace(); } } }); } /** * create application. */ public menu() { initialize(); } /** * initialize contents of frame. */ private void initialize() { funcoes acoes = new funcoe...

android studio won't show device when trying to run app (on Mac) -

is else having difficult time getting device when running application in android studio on mac. nexus 6 settings: usb debugging: turned on usb computer connection: tried both 'media device (mtp)' "lets transfer media files on windows, or using android file transfer on mac)" camera (ptp) lets transfer photos using camera software, , transfer files on computers don't support mtp. -android version: 5.1.1 i attempted on 2013 nexus 7 running android 5.0.2 in attempt troubleshoot tried setting environment variable tracing , received error cannot bind 'tcp: 5037' ./adb kill-server set adb_trace=all ./adb nodaemon server i'm happy report after 2 weeks of troubleshooting , talking android studio team have fixed issue simple factory reset of macbook pros' os.

java - GeoServer develop or use? How can I integrate with geoserver? -

i'm going develop map server own logic , entities. have postgres database, user management, specific layers types, wfs, wms, etc. i'm going use springframework , geoserver geoserver open source project. question whether develop or use separated server? how user management problem? how can integrate own project security geoserver? typically develop front end that's separate , have geoserver offer ogc services , other clients. in case need customize it, geoserver has pluggable architecture, e.g., can build version of has more or less modules standard one, own security subsystem, own custom data sources, , on, lot can either configured or replaced, i'd suggest options. mind 1 detail, geoserver gpl'd, code develop depends on geoserver api gpl'd. if instead develop that's based on geotools (e.g., custom data store) part can closed source.

Is it bad to have a CHEF wrapper cookbook for every environment? -

i new chef, , i'm trying setup cookbooks infrastructure. i have several types of web servers. have base webserver cookbook, , have 3 wrapper cookbooks. 1 each type of web server. base web wrappers web_mail web_scheduled web_hsm i want setup multiple environments qa , production servers can point different databases. (using variables in .erb templates). want use cookbook version promotion ensure each version tested in stage before production. production stage qa dev while put database variables in environment attributes, or in roles, this blog, suggests that anti pattern , better use environment wrapper cookbooks. however, if use environment wrapper cookbooks, have unmanageable 4x3 matrix of cookbooks (13 cookbooks total). is there way combine wrapper cookbooks, multiple environments? a better explanation of environment cookbook pattern given here: http://blog.vialstudios.com/the-environment-cookbook-pattern/ "environment...

xcode7 - Xcode 7 Library search path warning -

this warning showing: directory not found option '-f/applications/xcode-beta.app/contents/developer/platforms/iphoneos.platform/developer/sdks/iphoneos9.0.sdk/developer/library/frameworks' " can resolve warning? this how fixed problem further migration of xcode project, xcode 6.4 xcode 7, warning message below (after compilation) test target : directory not found option '-f/applications/xcode.app/contents/developer/platforms/iphonesimulator.platform/developer/sdks/iphonesimulator9.0.sdk/developer/library/frameworks' actually found when comparing new project vs older one... in old project, warning being produced test target of projects. under 'search paths' , found including 2 items under 'framework search paths' : $(sdkroot)/developer/library/frameworks $(inherited) the new project kept 'framework search paths' empty. deleting entries in older project removed warning. notes: i have not exhaustively ...

java - Using Handler across unnested thread class -

i have code written, in seperate thread connection made , data retrieved. working fine. my problem arises when try pass information main thread via handler. because code thread off main thread not nested inside main class, reference pass handler not seem hold. suggestions how can modify code allow handler data passed main thread. code main thread (stripped out leaving important bits): public class myactivity extends activity { handler mhandler = new handler(){ public void handlemessage(message msg){ bundle b; if(msg.what==1){ b = msg.getdata(); wecanmove = b.getboolean("key"); log.d("what did get", string.valueof(b.getboolean("key"))); } super.handlemessage(msg); } }; public void start(view view) throws interruptedexception { context context; boolean wehavefile = checkfile(); system.out.println(userinfo[0] + "\n" + userinfo[1]); if (wehavefi...

php - How to show pictures in a table using jQuery DataTables -

is possible can show url images in data-table? returning data in array shown here in code , returning url image with... before knew datatables using default table put table in <img src=""> how can use here? <?php class basket_report{ function show_basket_report(){ $connect_mysql= @mysql_connect($server,$username,$passwor) or die ("connection failed!"); $mysql_db=mysql_select_db("gp15",$connect_mysql) or die ("could not connect database"); $query = "select * reportbasket notifyemployee='1'"; $result=mysql_query($query) or die("query failed : ".mysql_error()); $objects= array(); while($rows=mysql_fetch_array($result)) { $objects[]= $rows; } $data_set = "["; $count_rows = count($objects); $count = 1; foreach($objects $object){ $data_set .= "['". $object['reportid'] ."', '". $obj...

python - How to find the relative path between two directories? -

i find relative path between 2 directories on system. example: if have patha == <patha> , pathb == <patha>/dir1/dir2 , relative path between them dir1/dir2 . how find in python? there tool use? if pathb contained in patha , pathb.replace(patha, '') relative path, if pathb isn't contained in patha ? os.path.relpath(path1, path2) # that's it

c# - Why is my event handler null? -

Image
i've got quite simple problem gives me headache , i'm wasting time. i've ran out of ideas anyway:) reason can't pass value of property variable event handler. here i've got , me fine won't work:( any idea why it's not passing actual value of variable? in advance:) just name suggests, propertyname should contain property's name, not value. see propertychangedeventhandler , propertychangedeventargs on msdn more details. as why event handler null , suspect haven't subscribed it. should have following somewhere in program: obj.propertychanged += new propertychangedeventhandler(obj_propertychanged); private void obj_propertychanged(object sender, propertychangedeventargs e) { .... } then when obj.moves changes obj_propertychanged called. i understand confusion, let me give little more explanations. suppose have 2 classes a , b , , want b notified when property of a changed. can make a implement inotifypropertychanged, ,...

sonarqube - Externalize the sonar configuration properties to gradle.properties file in user home -

i want externalize sonar configuration properties build.gradle file gradle.properties file. for example, apply plugin: 'sonar-runner' sonarrunner sonarproperties property "sonar.java.coverageplugin", "jacoco" property "sonar.host.url", "http://10.42.58.229:9000/" property "sonar.jdbc.url", "jdbc:mysql://10.42.58.229:3306/sonar" property "sonar.jdbc.driverclassname", "com.mysql.jdbc.driver" i want pass property values gradle.properties file, present in user home. this possible trick have use system properties (using systemprop prefix): systemprop.sonar.host.url=http://localhost:9000 systemprop.sonar.jdbc.url=jdbc:postgresql://localhost/sonar systemprop.sonar.jdbc.username=sonar systemprop.sonar.jdbc.password=sonar systemprop.sonar.login=admin systemprop.sonar.password=admin see: https://docs.sonarqube.org/dis...

php - Select data from logged in user with a mySQL query -

Image
i have nodes, nodes belongs company. users belong company can view nodes. the mysql query i'm trying use this: select nodes.mac, companys.companyname users, nodes, companys users.id='2' , nodes.owner=users.company it works - shows 1 node every user. want show $_session user nodes. you can using inner join find nodes single user way using on , where clause. select nodes.mac, companys.companyname users inner join companys on users.company=companys.id inner join nodes on companys.id=nodes.owner users.id=2 here user.id should $_session array value contains current user's id

assembly - How to generate Label debug info in GreenHills assembler? -

i'd generate debug info labels in assembly files assembled greenhills assembler visible debuggres in gas "gnu assembler" done that: .func funcname [,lablel] .endfunc but generates error in greenhills assembler is there equivalent?

c# - How to call StyleSelector on PropertyChanges of a row -

i have rowstyleselector datagrid. it's called correctly on load of window. on changes of rows when call propertychange it's not called. <datagrid grid.row="2" columnwidth="*" itemssource="{binding traceitemcollectionviewsource , mode=twoway , updatesourcetrigger=propertychanged}" enablerowvirtualization="false" rowstyleselector="{staticresource tracerowstyleselector}" isreadonly="true" name="tracedatagrid" margin="5,5,5,5" padding="5,5,5,5" autogeneratecolumns="false"> this model: public class tracedataitem : observableobject { private string _newreelid; public string newreelid { { return _newreelid; } set { if (value != _newreelid) { _newreelid = value; raisepropertychanged("newreelid"); } } } } how can make rowstyleselector call...

c# - winforms, form has been shown, event handler -

i need run code each time after form has been shown from.show(). tried form_activated(), form_loaded(), form.shown() ... nothing works how want, runs once, first time. there simple way how that? thank you. you write own method showing form , throwing event in him. public event eventhandler shownex; public void showex() { show(); onshownex(); } private void onshownex() { var eventhandler = shownex; if (eventhandler != null) eventhandler(this, eventargs.empty); }

printing - shared printer error in windows 8 "can’t install the kernel-mode print driver. " -

all other windows 8 pcs can use shared printer via desktop , hp printer. except 1 windows 8.1 pc. kernel-mode print driver issue computers in workgroup , withing same network range.. can access printer shared desktop using given credentials , made sure same credential used map printer other windows 8/8.1 in work group.. 1 pc windows 8.1 im getting below error when try connect.. cant install drives via network share.. **“windows can’t install <my hp printer> kernel-mode print driver. obtain driver compatible version of windows running, contact manufacturer.”** but know drivers compatible since other windows pcs can install shared printer without issue.. tried disabling disallow installation of printers using kernel-mode drivers via group policy yet not working after reboot well.. suggestion how fix this? found solution , fixed .. apart disallow installation of printers using kernel-mode drivers policy, had change point , printer restrictions enable , fix .. fo...

datastax enterprise - Is it possible to configure OpsCenter Backup Service differently per datacenter? -

dse 4.5.8, opscenter 5.1.3. we running multi-region cluster, 6-nodes running in 1 dc, , 1 node running backup in remote dc. rf 3 in dc1, 1 in dc2. after enabling opscenter backup service, single node in remote dc reaching high cpu every time backup running (running /bin/find of strange reasons). the question why @ want backup backup dc (dc2)? possible configure backup service confine single datacenter? a secondary question - 3 copies of data being backed in dc1? thanks! we running multi-region cluster, 6-nodes running in 1 dc, , 1 node running backup in remote dc. rf 3 in dc1, 1 in dc2. because there 6 nodes in dc1 (rf3) , 1 node in dc2 (rf1), node in rf1 has 2x data each of nodes in dc1. after enabling opscenter backup service, single node in remote dc reaching high cpu every time backup running (running /bin/find of strange reasons). it make sense node (since has 2x data) has work 2x hard. a secondary question - 3 copies of data being...

Check if array contains part of a string in Swift? -

i have array containing number of strings. have used contains() (see below) check if string exists in array check if part of string in array? itemsarray = ["google, goodbye, go, hello"] searchtosearch = "go" if contains(itemsarray, stringtosearch) { nslog("term exists") } else { nslog("can't find term") } the above code checks if value present within array in entirety find "google, google , go" try this. let itemsarray = ["google", "goodbye", "go", "hello"] let searchtosearch = "go" let filteredstrings = itemsarray.filter({(item: string) -> bool in var stringmatch = item.lowercasestring.rangeofstring(searchtosearch.lowercasestring) return stringmatch != nil ? true : false }) filteredstrings contain list of strings having matched sub strings. in swift array struct provides filter method, filter provided array based on filtering text c...

How Django finds all the migrations -

i want create elasticsearch index maintenance utility similar how django migrations behave - want each django app have 'elasticindices' package, , have index definitions there. how django (and south) scan apps , finds migrations?

fabricjs - Using fabric.js hovering lines is fired around them (not only exactely over them) -

i have made variation of stick man example allows move not circles, lines too. problem face hovering inclined lines area affect line not exact line, space around it, too. to see problem: move circle achieve line not horizontal or vertical try move line te result: see posible not exactely on line. //to save old cursor position: used on line mooving var _curx, _cury; $(function() { //create fabriccanvas object & disable canvas selection var canvas = new fabric.canvas('c', { selection: false }); //move objects origin of transformation center fabric.object.prototype.originx = fabric.object.prototype.originy = 'center'; function makecircle(left, top, line1, line2) { var c = new fabric.circle({ left: left, top: top, strokewidth: 2, radius: 6, fill: '#fff', stroke: '#666' }); c.hascontrols = c.hasborders = false; c.line1 = line1; c.line2 = ...

html - How to customize a div using css with shadow and color -

Image
i trying create form contains various customized effect box shadow etc.i trying create header of form example application i have tried , made fiddle how ?? can not achieve. here fiddle link my fiddle this effort have made create header of form #headerlabel{ background-color: #3d6cad; display: inline; float: left; font-weight: bold; margin: 33px 10px 2px; text-align: right; width: 135px; color:white; } somebody please here go code . dont use tables layout. this simple example hope asking for: css: * { margin: 0; padding: 0; box-sizing:border-box; } body { font: 100%/1.6 'open-sans',sans-serif; } { text-decoration: none; color:#f4f4f4; } .header { width: 100%; padding: 1em 3em; background:#3d6cad; color:#fff; font-size: 0.8em; } .header h3 { font-size: 1.2em; color:#f2f2f2; font-weight: normal; } .header p { color:#f4f4f4; font-size: 0.9em; } .sub-text { } html: <html> <head> <meta cha...

ios - how to retrive location from a PFGeopoint - (Parse.com and Swift) and show it on the map with Xcode 6.2 -

Image
there answer on this, related different problems , in objective-c. save in parse class "position" positions of users this: var locationmanager = cllocationmanager() var lat = locationmanager.location.coordinate.latitude var lon = locationmanager.location.coordinate.longitude let mygeopoint = pfgeopoint(latitude: lat, longitude:lon) let myparseid = pfuser.currentuser().objectid //pfuser.currentuser().objectid println("****** geopoint: \(mygeopoint)") func sendposition(userofposition: user) { let takeposition = pfobject(classname: "position") takeposition.setobject(myparseid, forkey: "who") //who takeposition.setobject(mygeopoint, forkey: "where") takeposition.saveinbackgroundwithblock(nil) } sendposition(currentuser()!) so result: then want show them on map, how? don't understand how retrive latitude , longitude "where" column cod...

ios - How can I create an array of PFObjects in a relation? -

i have relation has several pfobjects. want query relation , put of objects array. code not seem trick, however, hoping help. code: var requestsquery = pfquery(classname: "requests") requestsquery.wherekey("requested", equalto: pfuser.currentuser()!) requestsquery.findobjectsinbackgroundwithblock { (objects: [anyobject]?, error: nserror?) -> void in if error == nil { if let objects = objects as? [pfobject] { object in objects { usernames.append(object["requesterusername"] as! string) receivedoffers.append(object["cardsoffered"] as! [anyobject]) //error here: not cast value of type 'pfrelation' (0x13c3c8) 'nsarray' (0x38a26ab8). receivedrequests.append(object["cardsrequested"] as! [anyobject]) } } } else { println(error) } self.tablevie...

How can I use PHP code in a CSS file -

i want find image source mysql database , assign css style. changed .css extension .php . it work xampp , runs want, when uploaded code in cpanel didn't work correctly. i used code in css file: top of page: <?php include '../connections/base.php'; ?> <?php header("content-type: text/css; charset: utf-8"); ?> some styles: .box { overflow: hidden; display:block; border:4px solid #171717; position:absolute; cursor: pointer; float:left; display: inline-block; zoom: 1; background:url(<?php $query = "select imape_path mytable number='5' limit 1"; //echo $query; if ($result = $mysqli->query($query)) { while ($row = $result->fetch_assoc()) { echo $row['imape_path']; } } ?>) no-repeat; } how can fix problem? personally, not think right problem address. the whole point in separating mar...