Posts

Showing posts from August, 2013

ios - Save data in two persistent stores -

i having app there search feature network request. uses same model framework entire app. this means when user searches need create managed objects found data, save them , display them. messes old records user recent data. i ideally save managed objects found in search in separate in-memory persistent store doesn't make disorder in main data. i haven't done before best way approach it? thank you! as has been suggested @stevesliva, not need involve complexities of maintaining multiple partially in-memory stores. way go here create child context , fetch online data context. once not need data more, discard context. if decide save downloaded data, can "push" changes main context via save: . @ point make necessary adjustments data fit user data. depending on model, 1 feasible solution create attribute on 1 of entities marks linked objects distinct user created objects.

php - Long lasting script prevents handling new requests -

i have php script on apache web server, starts several hours running php script. right after long-lasting script started no other php script requests handled. browser hangs eternally. the background script crawls other sites , gathers data ones. therefore takes quite long time. at same time static pages got without problems. @ same time php script started locally on server bash executed without problems. cpu , ram usage low. in fact it's test server , requests ones being handled. i tried decrease apache processes in order able trace of them see requests hung. when decreased amount of processes 2 problem has gone. i found no errors neither in syslog nor in apache/error.log what else can check? though didn't find reason of apache hanging have solved task in different way. i've set schedule run script every 5 minutes. web script i'm creating file necessary parameters. script check existence of file , if exists reads content , deletes prevent furth

ios - Upload my App on Apple's App Store through Company's account -

i grateful if can me here in way possible. so scenario created app , client gave me access developer's account. have access certificates, downloaded. both developer , distribution certificate. i have access itunesconnect can upload app. my question how able use certificates , upload app on appstore. client's app id different mine, guess i'd have change mines , create new package. would use client's certificates , create provisioning profiles through developer account ? many thanks, can see questions, quite confused. best. below basic steps, recommend visit site getting started , , follow thoroughly. login developer account. install certificate on mac create new appid, should same bundle id now create development/distribution provision profile using appid created in step #3 use these profile (code signing) publish/distribute app. again, above quick view help, must follow site mentioned.

javascript - How can I slice out all of the array objects containing a value and storing them in a new array -

so have array , want make new array objects have swimming value in sports. var watchesarray = [ { model: "swim", image:"", price: 149.99, sports:["swimming", "running"] }, { model: "fr 10", image:"", price: 129.99, sports:["running"] }, { model: "fr 15", image:"", price: 199.99, sports:["running"] }, ]; so far have dont know how add on sliced array each go around in loop. how should this? (var = 0; < watchesarraylength; i++) { if (watchesarray[i].sports.indexof("swimming") > -1) { var runningwatcharray = watchesarray.slice(i); } } you can use .filter() method: watchesarray = [...]; var result = watchesarray.filter(function(watch) { retu

c# - Implementing Entity Framework for Simple Data Entry App -

this has been asked , answered 1000 times, google has not been not friend morning. i'm making switch using stored procedures , business objects using entity framework. simplicity of generating pocos generated edm (database-first approach here). , how less typing is. i'm having hard time wrapping head around suitable design common application scenario (in world, anyway). basically, picture data entry application, let's online store's administrator (i'm doing in wpf, web-based). the admin want view list of customers (manage customers view) in data grid. each row, there button edit customer or delete it. @ bottom of grid there button create new customer. if delete customer, removed (after confirmation) data grid, back-end data store. if edit customer, window pops (edit customer view), displaying current data customer. can edit data, click either submit, or cancel. submit saves changes data store, , cancel discards changes. both buttons close window.

design patterns - Android widget change alarm interval -

i have created configure activity widget, user can choose various update frequencies.. until started alarm in onenabled() method, this: intent intent = new intent(clock_widget_update); pendingintent pendingintent = pendingintent.getbroadcast(context, 0, intent, pendingintent.flag_update_current); alarmmanager alarmmanager = (alarmmanager) context.getsystemservice(context.alarm_service); alarmmanager.setrepeating(alarmmanager.rtc, system.currenttimemillis(), 1000 * 60, pendingintent); the settings saved in shared preferences unique name (widgetid) , in onenabled() method can't retrieve settings here because can't widgetid yet. there's problem, user can change frequency anytime, method called once, @ beginning. think need start alarm in onupdate(), don't know how it, don't want make multiple instances of alarm accidentally ask advice. to answer second problem, calling setrepeating multiple times not create multiple alarm far provide same

c# - EF6 Code First Key not auto incrementing -

i have class model: public class results { [key] [databasegenerated(databasegeneratedoption.identity)] public int id { get; set; } public int gameid { get; set; } public games game { get; set; } public string notes { get; set; } public virtual icollection<resultitems> resultitems { get; set; } } for reason id field not set auto increment per schema: create table [dbo].[results] ( [id] int not null, [gameid] int not null, [notes] nvarchar (max) null, constraint [pk_dbo.results] primary key clustered ([id] asc), constraint [fk_dbo.results_dbo.games_gameid] foreign key ([gameid]) references [dbo].[games] ([id]) on delete cascade ); go create nonclustered index [ix_gameid] on [dbo].[results]([gameid] asc); i've added: protected override void onmodelcreating(dbmodelbuilder modelbuilder) { modelbuilder.entity<results>().haskey(p => p.id).property(p => p.id).hasda

android - Trouble getting WebVTT captions/subtitles working on Chromecast -

i'm working on chromecast app android, , trying webvtt captions/subtitles working. i instantiate mediatrack object follows: mediatrack track = new mediatrack.builder(0, mediatrack.type_text) .setcontentid("http://www.example.com/example.vtt") .setsubtype(mediatrack.subtype_subtitles) .setcontenttype("iso-8859-1") .setlanguage(locale.english) .setname("english") .build(); and add list. i instantiate mediainfo using builder, , include reference list of tracks using .setmediatracks method: mediainfo.builder builder = new mediainfo.builder("http://www.example.com/example.m3u8") .setstreamtype(mediainfo.stream_type_buffered) .setcontenttype("application/vnd.apple.mpegurl") .setmetadata(moviemetadata) .setmediatracks(mediatracks).build(); in app start ca

c++ - What is a concise syntax for accessing the other element of two element collection? -

i have 2-element collection {a, b} , complex expression ex(_, _) involving both elements in non-commutative way. result of computation i'm looking equivalent to: ex(a, b); ex(b, a); but instead of repeating whole expression twice (defining function computing ex not acceptable), use loop this: for (auto i: {a, b}) ex(i, <other element>); what short way of writing such loop? edit since number of readers found question unclear, please have @ 2 answers below, present solutions looking for. ex(a, b) shorthand long chunk of code using a , b in order. reasons why don't want define function ex stylistic , beyond scope of question. if elements indexed 0 , 1 (such in vector v) use exclusive or ^ select alternative index: for(auto i: {0, 1}) ex(v[i], v[i ^ 1]);

android - How can I disable clicking sound for Action Menu button? -

seems straight forward, can't find in documentation how disable sound (water drop sound) plays when click button. the reason important, button records audio. , when play audio, can hear button clicking. thanks you can using attribute in xml: android:soundeffectsenabled="false" or in code by: btn.setsoundeffectsenabled(false);

MySQL, Auto Increment, Export and Import -

i'm trying import sql file mysql has auto increment values. know if replace numbers null, or skip column together, generate new values when importing. however, i'm trying keep old values. possible? reason being numbers used in other tables easy referencing between them. if need reference i'm talking about, @ wp_users , wp_usermeta in wordpress. id in wp_users used in wp_usermeta user_id. if import, example, wp_users , have generate new id's, not match wp_usermeta user_id. i looked in previous questions similar 1 , there 1 question asked close. however, it's different question , answers did not help. if not possible import , retain old increment values, best option create own script (php) import, generate new increment values, , update other tables while importing? it should possible, go mysql database , try out? stores auto increment value when export data database. you test out inserting new record database once have imported in? test auto incr

python - regular expressions: extract text between two markers -

i'm trying write python parser extract information html-pages. it should extract text between <p itemprop="xxx"> , </p> i use regular expression: m = re.search(ur'p>(?p<text>[^<]*)</p>', html) but can't parse file if tags between them. example: <p itemprop="xxx"> text <br/> text </p> as understood [^<] exception 1 symbol. how write "everything except </p> " ? you can use: m = re.search(ur'p>(?p<text>.*?)</p>', html) this lazy match, match until </p> . should consider using html parser beautifulsoup which, after installation, can used css selectors this: from bs4 import beautifulsoup soup = beautifulsoup(html) m = soup.select('p[itemprop="xxx"]')

assembly - Delphi inline assembler and class properties -

i trying rewrite tlist.indexof method in assembler (xe3). here code function tfastlist.indexofasm(item: pointer): integer; {var p: ppointer; begin p := pointer(flist); result := 0 fcount - 1 begin if p^ = item exit; inc(p); end; result := -1;} var fcnt, rslt: integer; fdata: pointer; begin fcnt := count; fdata := list; asm push edi mov ecx, fcnt mov edi, fdata mov eax, item repne scasd mov eax, fcnt sub eax, ecx dec eax mov rslt, eax pop edi end; result := rslt; end; naturally use properties count or list directly. understand why compiler refuses give access private fields fcount , flist, how access corresponding properties? count, self.count, , [eax].count give inline assembler error. jic: don't handle not found situation here intent you can't access object property via delphi assembler! delphi compiler , delphi compiled code belive fast. your code has mistake because doesn't test 0 count vel

python memory allocation when using chr() -

i new python , want have list 2 elements first 1 integer between 0 , 2 billion, other 1 number between 0 10. have large number of these lists (billions). suppose use chr() function add second argument list. example: first_number = 123456678 second_number = chr(1) mylist = [first_number,second_number] in case how python allocate memory? assume second argument char , give (1 byte + overheads) or assume second argument string? if thinks string there way can define , enforce char or make how more memory efficient? edit --> added more information why need data structure here more information want do: i have sparse weighted graph 2 billion edges , 25 million nodes. represent graph tried create dictionary (because need fast lookup) in keys nodes (as integers). these nodes represented number between 0 2 billion (there no relation between , number of edges). edges represented this: each of nodes (or keys in dictionary ) keeping list of list. each element of list of list list

json - Using Wordpress Authentication in Xcode -

i building ios app use json api content. how authenticate wordpress db set in order retrieve content available after you've logged in. <?php require_once('wp-load.php'); $username = $password = ""; // check see if email or username check if(filter_var($username, filter_validate_email)) $user = get_user_by('email',$username); else $user = get_user_by('login',$username); $validuser = false; if ( $user , wp_check_password($password, $user->data->user_pass, $user->id) ) $validuser = true; ?>

java - Is it possible to partially subclass a ParseObject? -

the parse sdk documentation points out how subclass object: // armor.java @parseclassname("armor") public class armor extends parseobject { public string getdisplayname() { return getstring("displayname"); } public void setdisplayname(string value) { put("displayname", value); } } but if wanted get/set parts of parse object? storing member information in parse in parseuser table. each user has name, email address, number of times they've done app, , possibly later on, personal information billing info, address, etc. storing storing user names in separate sql database, able store them in local datastore, if possible. problem see, since information not encrypted in datastore (i can view contents using sqlite browser), not want store personal info on device. if create parseobject called, "members", there way can fetch username/objectid each user, , not retrieve/touch other details? if not possible, suppose can st

sql server - Timeout when connecting through a TCP-Connector -

i route traffic through mule mssql database. database runs on url "internalserverurl" on port 1433. mule shall act tcp-server/proxy , re-route incoming tcp traffic on 1433 address @ "internalserverurl" on port 1433, handle response , return back. example code: <?xml version="1.0" encoding="utf-8"?> <mule xmlns:tcp="http://www.mulesoft.org/schema/mule/tcp" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" xmlns:spring="http://www.springframework.org/schema/beans" version="ce-3.3.1" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation=" http://www.mulesoft.org/schema/mule/tcp http://www.mulesoft.org/schema/mule/tcp/current/mule-tcp.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd http://www.mulesoft.org/schema/mule/c

c# - Cannot set the position of a game object after detaching it from parent -

i want player able drop gun , pick new 1 can seem reposition gun. current gun child of player , position set relative player when use transform.parent = null; it sets position of gun in world space , can change position creating new vector fr position. when player drops gun, want set position player , detach player , guess can use rigidbody apply physics , drop on floor.

arrays - C++ cin gets skipped, even after I use cin.ignore() -

just make clear, new c++. wrote small program test skill arrays , ran problem cin . if user enters number, like program expects them to , well. if string gets entered, input skipped , program ends. i set of inputs this: cin >> x;cin.clear();cin.ignore(); so awry?? here full code: #include <iostream> #include <cstdlib> using namespace std; int main() { system("cls"); int create = 1; int entry; int x; string chc; cout << "how long should array be?" << endl; cout << ":"; cin >> x;cin.clear();cin.ignore(); if(x<1){x=1;} int myarray[x]; string askcontinue; for(int x=0;x<sizeof(myarray)/sizeof(myarray[0]);x++){ system("cls"); cout << "enter value #" << x+1 << endl; cout << ":"; cin >> entry;cin.clear();cin.ignore(); myarray[x]=entry; } system(&quo

Zk get value of child component mvvm -

include component value showing null not binding. <window id="win" width="100%" border="normal" height="100%" apply="org.zkoss.bind.bindcomposer" validationmessages="@id('vmsgs')" viewmodel="@id('vm') @init('com.customer.portal.controller.motorquotationviewmodel')"> <row> <include src="basicinfo.zul"></include> </row> <row> <button id="btncalculatepremium" onclick="@command('calculatepremium')" /> </row> basicinfo.zul <window id="win" width="100%" border="normal" height="100%" apply="org.zkoss.bind.bindcomposer" validationmessages="@id('vmsgs')" viewmodel="@id('vm') @init('com.customer.portal.controller.basecontroller')"> <grid>

unit testing - Mocking Mule Variables Using JUnit -

for following mule flow, how mock random_var variable using junit? <flow name="flow1" doc:name="flow1"> <choice doc:name="choice"> <when expression="${random_var} == 'true'"> <logger message="random var true" level="debug" doc:name="logger"/> </when> <otherwise> <logger message="random var false" level="debug" doc:name="logger"/> </otherwise> </choice> </flow> i think first of need vm-endpoint in order able call test within functional test. further should have at: http://www.mulesoft.org/documentation/display/current/functional+testing for programmatically invoking vm-endpoints using unit test. describes how pass payload it. the func-test use separated set of config file can define separated configuration flow, seems thing looking for. d

Chinese font cut off in iOS app with custom font -

Image
we're localizing our iphone app various languages, 1 of them being chinese. throughout app use menlo font, when ios has display chinese characters cut off @ top. guess because menlo not feature these characters , ios has fall system font chinese has different line height? what recommended approach here? if using custom table cell try increase height of textview. if using default tableview cell can try setting font size 0, text should auto-sized appropriate. hope helps.. :)

php - mysqli_fetch_assoc dies on first row -

i have following table in mysql: ╔══════╦════╗ ║... city.....║...zip..║ ╠══════╬════╣ ║ prague. ║ 11000║ ║ brno..... ║ 34785║ ╚═══════════╝ the following code works: class mysql{ function connect(){ $this->c = new mysqli( $this->option['dbhost'], $this->option['dbuser'], $this->option['dbpass'], $this->option['dbname'] ); if($this->c->connect_errno){ exit("connect failed: ".$this->c->connect_error); } if(!$this->c->select_db($this->option['dbname'])){ exit("cannot select database: ".$this->option['dbname']); } } function query($query){ if(!$this->c->query($query)){ exit("cannot execute query: {$query}<br>mysql error: {$this->c->error}<br>mysql error code: {$this->c->errno}"); } return $this->c->query($query); } function fetch_assoc

lme4 - error message when performing Gamma glmer in R- PIRLS step-halvings failed to reduce deviance in pwrssUpdate -

i trying perform glmer in r using gamma error family. error message: "error: (maxstephalfit) pirls step-halvings failed reduce deviance in pwrssupdate" my response variable flower mass. fixed effects base mass, f1 treatment, , fertilisation method. random effects line , maternal id nested within line. when perform same analysis using integer response (ie. flower number) error not occur. here sample of data: line maternal_id f1treat flwr_mass base_mass 17 81 stress s 2.7514 9.488 5 41 control o 0.3042 1.809 37 89 control o 2.3749 6.694 5 41 stress s 3.6140 9.729 9 5 control s 0.5020 7.929 13 7 stress s 0.4914 0.969 35 88 stress s 0.4418 1.840 1 57 control o 2.1531 6.673 13 7 stress s 3.0191 7.131 here code using: library(lme4) m <- glmer(data=mydata, flw

javascript - facebook and twitter share count not updating on share -

the problem facebook , twitter count not updating on share. updating on page refresh. possible display updated count without page refresh on successful share on facebook , twitter wall. i using following code <div class="fb-share-button" data-href="<?php echo $domainurl;?>/en/blog-view.php?bid=<?php echo $bid;?>" data-type="button_count"></div> <a href="https://twitter.com/share" class="twitter-share-button" data-url="<?php echo $domainurl;?>/en/blog-view.php?bid=<?php echo $blogres['blog_id'];?>">tweet</a> and use ajax display more blogs $.ajax({ url: 'get_blogs.php', type: 'post', data: datastring, cache: false, success: function(html){ $('#loading').hide(); $('#bloglist').append(html); fb

html - Columns Appear under Each Other in Footer -

columns appear below each other in footer. tried id'ing each column , adding 'float: left' in each 1 -- didn't make difference. , appears it's not conflict there h4 header displayed paragraph... site: http://e54.5b1.myftpupload.com/ <div id="footer"> <div class="footerfloat"> <h4>header 1</h4> <p>lorem ipsum dolor sit amet, consectetur adipisicing elit, sed eiusmod tempor incididunt ut labore et dolore magna aliqua. ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p> </div> <div class="footerfloat"> <h4>header 2</h4> <ul> <li>line 1</li> <li>line 2</li> <li>line 3</li> <li>line 4</li> </ul> </div> <div class="footerfloat">

Howto Insert Into Table with Select and Order by using fetch first rows only with DB2 -

i using db2 v7.2 express-c windows , need insert number of rows table select table. im not sure, if issue of old db2 version or if there general problem statement. looking alternative it. the task insert set of ids table markierung, defined 2 columns iduser integer not null idbild integer not null straight forward insert corresponding items other tables, e.g. insert markierung select distinct xuser.id userid, xbild.id bildid user xuser, bild xbild, logbook xlogbook xbild.id = xlogbook.oid , xuser.id = xlogbook.userid this approach works fine, want insert number of rows (the newest ones). therefore this: insert markierung select distinct xuser.id userid, xbild.id bildid, xlogbook.date date user xuser, bild xbild, logbook xlogbook xbild.id = xlogbook.oid , xuser.id = xlogbook.userid order date desc fetch first 5 rows only; first problem: need add date selection using order because

java - Spinner for date of birth (Android) -

i creating registration form application. want prompt user enter date of birth through 3 spinners (dd-mm-yy). this xml sign up/registration form: <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@drawable/ic_signup" android:gravity="center_vertical" android:orientation="vertical" > <edittext android:textcolor="#ffffff" android:id="@+id/edittextemail" android:layout_width="fill_parent" android:layout_height="wrap_content" android:hint="email" /> <requestfocus /> <edittext android:textcolor="#ffffff" android:id="@+id/edittextfirstname" android:layout_width="f

android - I want code to capture 24fps in my app, any suggestions...? -

i'm trying capture 24fps of rootview of screen. need code execute this. i've tried normal method capture screen capturing 24fps @ time slows down app alot. there method so, if yes please post me answer. as mechanism isn't built-in feature, won't able nice 24fps. being said, try following , see how fps get: public class continuousscreenshottask extends asynctask<void, bitmap, void> { view view; context context; bitmap bitmap; canvas canvas; public continuousscreenshottask(view view) { this.view = view; this.context = this.view.getcontext().getapplicationcontext(); bitmap = bitmap.createbitmap(view.getwidth(), view.getheight(), bitmap.config.argb_8888); canvas = new canvas(bitmap); } @override protected void doinbackground(void... params) { while (!iscancelled()) { view.draw(canvas); savebitmap(context, bitmap); } return null; }

Emacs: how to create yasnippets for different RDBMs in sql-interactive-mode -

i using sql-interactive-mode connect 2 databases: mysql , sqlite. created yasnippets mysql in yasnippets/sql-interactive-mode folder. example add column in mysql use following snippet: # -*- mode: snippet -*- # name: add column # key: addcol # -- alter table $1 add column \`$2\` $3; but sqlite uses different syntax. how can create different yasnippets different databases? as explained here can add arbitrary emacs lisp code (enclosed in backquotes) yasnippet snippets evaluated when expand. in sql-mode , sql-interactive-mode there variable called sql-product can check determine type of database ( mysql , sqlite , postgres , etc.) working with. that's need know. here example of how modify addcol snippet: # ... alter table $1 `(if (eq sql-product 'mysql) "add" "frob")` column \`$2\` $3; this expand to alter table $1 add column \`$2\` $3; for mysql and alter table $1 frob column \`$2\` $3; for other types of databases.

android - Is there limits with Ionic Framework mobile app? -

i'm learning how code android mobile app ionic framework because want create todo list bubble facebook messenger, able send task workmates, chronometer , more don't know if ionic can , if not if need programming of app again native or not because if it'd better programming native right now. pretty available on native app possible ionic. html5 constructs give universal layout flexibility, , device apis available through cordova. that said, facebook chat heads uses lower-level android api, , there isn't cordova plugin that, you'd need develop one. take more development time going native. also, it's understandable you're opting hybrid development enormous time savings in having code works across platforms. but, far know, facebook chatheads feature works on android. , if android release target, makes sense go native.

Android - Intent manage. Old intent is resend if user open application from task-manager -

i have problem. when call finish() method activity still hold in task-manager, , if user restart task-manager activity receive old intent. if intent sent push-notification have unwanted reaction: app start process intent push-notification data. how correctly manage push-notification intent behavior in activity avoid wrong activity state? my app receive push-notification , form pending intent reaction on push: final notificationmanager mnotificationmanager = (notificationmanager) context.getsystemservice(context.notification_service); int defaultoptions = notification.default_lights; defaultoptions |= notification.default_sound; intent intentaction = new intent(context, mainactivity.class); intentaction.setflags(intent.flag_activity_clear_top | intent.flag_activity_single_top); intentaction.putextra(bundle_collapse_key, data.getstring(bundle_collapse_key)); intentaction.setaction(custom_action); final pendingin

groovy - Problems with java package names in Gradle build with IntelliJ IDEA -

Image
i have gradle project , in have groovy , java classes @ same package. build works fine when import project in intelij 13 ide tells me in java files have wrong package names. \src\main\groovy\com\example\boo\foo\problem.java with package package com.example.boo.foo; and there no error with \src\main\groovy\com\example\boo\foo\sample.groovy with package package com.example.boo.foo how remove error? you need make sure java code packaged under java , groovy code packaged under groovy . see example in screenshot below:

Iphone: media css code does not work -

i have @media setup <head> <meta name="viewport" content="width=device-width, user-scalable=no" /> </head> css: @media screen , (min-width: 769px) { /* styles here */ } @media screen , (min-device-width: 481px) , (max-device-width: 768px) { /* styles here */ } @media screen , (max-device-width: 480px) { /* styles here */ } with setup in works view on iphone not work in browser. it's irritating highly appreciated. because have device in meta , maybe have (max-width:480px) instead? your question unclear if clarify, yo mean not work in browser? not work in browser? this queries mean me: @media screen , (min-width: 769px) {} this says modern mobile device (older mobile devices don't fall under screen category newer iphones do) or desktop device screen 769 pixels wide or larger apply this. (desktop) abbreviate @media (min-width:769px) , achieve same result. note iphones fall under 'screen'

javascript - Transfering Variable Values Between Scopes -

i'm sick , tired of thinking it. okay there draggable blue box,; if touches red box, redbox changes position randomly. mixed whole codes, know; i'm dumb @ coding part. couldn't figure mistakes. need knowledge me situation. the jquery part. $(document).ready(function() { var kol = 253; var score = 0; var redboxwidth = $('#redbox').width(); var redboxheight = $('#redbox').height(); var redt = $('#redbox').position().top; var redl = $('#redbox').position().left; var redbox = $(".redbox"); var bluecoordinates = function(element1) { var top; var left; var blueboxwidth = $('#bluebox').width(); var blueboxheight = $('#bluebox').height(); element1 = $(element1); top = element1.position().top; left = element1.position().left; $('#results').text('x: ' + left + ' ' + 'y: ' + top); $('#results3').text('redl: ' + redl + 'redx: '

php - Tasks/Queues mangament in amazon aws -

i'm looking solution add items queue , execute them one-by-one in similar method google appengine's tasks manager. each task executed using http request php script. as i'm using amazon, understood best practice using sns service responsible receiving new tasks, adding them queue (amazon's sqs service) , inform php worker new task has been pushed queue can , execute it. there several issues method (like need limit number of workers instances via worker or possibility task won't in queue when call worker because add task queue in same time). i hear if there better options or nicer way of implementing tasks manager. preffer using amazon's services i'm open new suggestion, looking best method. features missing in amazon fifo , priorities support nice addition. thanks! ben i have found solution. aws beanstalk service apparently offering option define new elastic-beanstalk instance "worker" or "web server". in case define &qu

intellij idea - Pass tags via build.gradle instead thro RunCukesSpec -

when pass tags in following manner works perfectly. package features import org.junit.runner.runwith import cucumber.junit.cucumber import geb.junit4.gebreportingtest @runwith(cucumber.class) @cucumber.options(format = ["pretty", "html:build/cucumber", "json-pretty:build/cucumber-report.json"]) ,tags = ["@login_neg"]) class runcukesspec extends gebreportingtest {} but goal config same thing via build.gradle & if succeeds pass through command line. tried below initial step , hope running gradle test in command line expected results. test { testlogging.showstandardstreams = true args = ['--tags', '@login_neg', '--format', 'html:build/cucumber', '--format', 'json-pretty:build/cucumber-report.json', '--format', 'pretty'] } in case tags running though. tried well. no luck gradle test -dcucumbe

php - file code formatting lost when upload to server -

Image
i using netbeans product version: netbeans ide 8.0 (build 201403101706) java: 1.8.0_11; java hotspot(tm) 64-bit server vm 25.11-b03 runtime: java(tm) se runtime environment 1.8.0_11-b12 when deploy file server lost code formatting. lets take following snapshot of file, has code formatting, indents spaces etc but when upload server lost code formatting it happens php , js files , change cause problems me when open file using dreamweaver , save , upload file remains same, happens in netbeans, don't know why, read code formatting setting in netbeans nothing helped me you can set project level end line format right clicking on project properties > line endings

Whats the right way to use a SparseDataFrame in Pandas? -

pandas.dataframe(a) out[41]: 1 2 3 0 1 2 nan 1 1 nan 3 = [{1:1.0,2:2.0}, {1:1.0,3:3.0}] pandas.dataframe(a) out[43]: 1 2 3 0 1 2 nan 1 1 nan 3 pandas.sparsedataframe(a) --------------------------------------------------------------------------- typeerror traceback (most recent call last) <ipython-input-44-50288c1b1994> in <module>() ----> 1 pandas.sparsedataframe(a) /library/python/2.7/site-packages/pandas/sparse/frame.pyc in __init__(self, data, index, columns, default_kind, default_fill_value) 94 sdict, columns, index = self._init_dict(data, index, columns) 95 elif isinstance(data, (np.ndarray, list)): ---> 96 sdict, columns, index = self._init_matrix(data, index, columns) 97 elif isinstance(data, dataframe): 98 sdict, columns, index = self._init_dict(data, data.index, /library/python/2.7/site-packages/pandas/sparse/frame.pyc i

c# - How stop CellValueChanged firing while populating? -

i have form contains several datagridview's. being cleared , populated programmatically while program running. based on cells being altered in 1 of datagridviews user in form. user changing cell triggers clearing , repopulating datagridviews including 1 interact with. so question. can avoid cellvaluechanged being triggered everytime datagridviews cleared , repopulated programmatically? instead should triggered when user edits cell in form. i've tried searching answer no success, hope not duplicate question. i doubt can stop cellvaluechanged event being triggered, other removing handlers(events still triggered, there won't handlers it): private dgv_thatcauseschanges_cellvaluechanged(object sender, eventargs e) { this.otherdgv.cellvaluechanged -= this.dgv_otherdgvcellvaluechanged; try // make sure handlers reinstatiated on exception @steve { // change other dgvs } { this.otherdgv.cellvaluechange

MS Project VBA updating Groups - show in menu -

ms project vba. change group definition (project, group in ms project) in vba can’t find way change 1 there (i can add more groups it, can’t delete first grouping). have done delete group definition there , define 1 want, can’t find way show in menu. code have deleting group definition, defining new 1 activeproject.taskgroups.item("csr - ca").delete activeproject.taskgroups.add "csr - ca", csrfield activeproject.taskgroups("csr - ca").groupcriteria.add cawbsfield activeproject.taskgroups("csr - ca").groupcriteria.add ccnfield can me find way change group shown in menu please?

javascript - How to handle updating the navigation bar while using ajax -

i have ajax implementation on wordpress install , i'm using 'css , javascript toolbox' plugin apply additional javascript code. have tried following code in header.php file in both section , . i'm using standard 'twenty fourteen' theme , i'm referencing primary navigation bar @ top. there no subpages, normal links. http://twentyfourteendemo.wordpress.com/ the code i'm using, i'm sure problem, this <script> jquery('ul.menu li').click(function(){ // remove class on each item jquery('ul.menu li').removeclass('current-menu-item current_page_item'); // add class 1 jquery(this).addclass('current_page_item current-menu-item'); }) </script> i have tried this <script> jquery('ul.menu li').each(function() { jquery(this).removeclass('current-menu-item'); jquery(this).removeclass('current_page_item'); }); jquery(this).parents('li').addclass('current_

css - Change Webkit properties through Javascript? -

please me, might cause i'm new css animations , javascript using code suppose change properties of , when run code else in code except change properties in css of desired div. i've tried 4 of these , none of them seem work, out of date? there new way of doing or what? none of them work @ all. document.getelementbyid('playbar').style.webkitanimationduration = 20 + "s"; document.getelementbyid('playbar').style.animationduration = 20 + "s"; document.getelementbyid('playbar').style['-webkit-transition-duration'] = '50s'; value = math.floor((100 / duration) * currenttime); document.getelementbyid('playbar').setattribute("style","-webkit-filter:grayscale(" + value + "%)") css code #playbar { width: 1px; height: 12px; background: white; float:left; -webkit-animation: mymove infinite; /* chrome, safari, opera */ -webkit-animation-duration: 10s; /* chrome, safari, opera */ animat

excel - VBA vlookup in external workbook -

i trying code working still showing errors. code to, workbook1, open workbook2 , insert vlookup function in workbook1 search values workbook1 in range workbook2 code follows: application.screenupdating = false dim fnameandpath variant, wb workbook fnameandpath = application.getopenfilename(title:="wybierz plik kontroli rabatu") if fnameandpath = false exit sub set wb = workbooks.open(fnameandpath) thisworkbook.activate sheets("icos").activate set lookupvalue = thisworkbook.sheets("sheet1").cells(3, 3) set rnglookuprange = wb.worksheets("sheet1").range("$a:$p") range("c3:c300") = application.worksheetfunction.vlookup(lookupvalue, rnglookuprange, 16, false) what wrong in code? shows "unable vlookup property of worksheetfunction class" thanks there 2 problems here: lookupvalue should not object, value, such string, double, integer. change corresponding line to lookupvalue = thisworkbook.sheet

flask - Escape jinja2 syntax in a jinja2 template -

i serve dynamic pages jinja2 templates in flask. defining client-side templates in say, jinja2-clone nunjucks inside script tag. problem is, client-side templates has syntax <% %> flask's jinja2 interpreter may interpret instead of rendering verbatim . how can make entire block of scripts render verbatim? you can disable interpretation of tags inside {% raw %} block: {% raw %} in block treated raw text, including {{ curly braces }} , {% other block-like syntax %} {% endraw %} see escaping section of template documentation.

upload file in kendo ui mobile application using cordova -

how browse , upload file in kendo ui mobile application using cordova. if done before please me achieve upload file. upload should work in both android , ios platform. the cordova plugin api documentation great resource samples. recently, of cordova v3.5.0 documented on page. of v3.5.0 , higher documentation , samples maintained on github. to answer question, can use cordova camera plugin both taking picture and/or retrieve // using cordova camera plugin navigator.camera.getpicture(onsuccess, onfail, { quality: 50, destinationtype: camera.destinationtype.file_uri sourcetype: camera.picturesourcetype.xxx }); notice camera.picturesourcetype can 1 of following: camera.picturesourcetype.camera allows user take new pictures camera.picturesourcetype.photolibrary or camera.picturesourcetype.savedphotoalbum allows user selected existing image easy cake, documentation quite self explanatory.

swing - erasing dots from map pacman java -

i'm coding pacman, have pacman move, loading map txt, , collision walls. next step dot eraser when pacman on dot field. need suggestion how it, i've tried erase paiting dot @ same color background, doesnt work. here code board.java public class board extends jpanel implements actionlistener { private timer timer; private map m; private player p; public board(){ m = new map(); p = new player(); addkeylistener(new klawa()); setbackground(color.black); setfocusable(true); timer = new timer(25, this); timer.start(); } @override public void paint(graphics g){ super.paint(g); for(int x=0; x<14; x++){ for(int y=0; y<14; y++){ if(m.getmap(x,y).equals("s")){ g.drawimage(m.getwall(),x *32,y *32, this); } if(m.getmap(x,y).equals("k")){ g.drawimage(m.getdot(),x *32,y *32, this);