Thursday, 15 January 2015

php - Change all table tags with preg_match_all -



php - Change all table tags with preg_match_all -

i alter tag in string set [table1], [table2], etc.

for example,

hello there <table class="table1"><tr><td></td></tr></table> text here <table class="table2"><tr><td></td></tr></table> text here <table class="table3"><tr><td></td></tr></table>

to:

hello there [table1] text here [table2] text here [table3]

using

preg_match_all("@\<table (\s\s+)@s", $table_in_string, $match); foreach ($match[1] $key => $k) { }

my regular look here not seem work.

thanks.

pregl_replace example:

$text = preg_replace( '/<table.*?class="(table\d+)".*?<\/table>/s', '[$1]', $text );

php regex preg-match preg-match-all

message passing - What guarantees does erlang's "monitor" give? -



message passing - What guarantees does erlang's "monitor" give? -

while reading erts user's guide, found section:

the signal ordering guarantee given following. if entity sends multiple signals same destination entity, order preserved. is, if sends signal s1 b, , later sends signal s2 b, s1 guaranteed not arrive after s2.

i've happened across while doing farther research googling:

erlang reference manual, 13.5:

message sending asynchronous , safe, message guaranteed reach recipient, provided recipient exists.

that seems vague , i'd know guarantees can rely on in next scenario:

a,b processes on 2 different nodes. assume not crash , b valid node @ point. , b monitor each other. sends messages m1,m2,m3 b

in above scenario, possible b receives m1,m3 (m2 dropped), without sort of 'down'/'exit'/heartbeat timeout beingness received @ a?

there no other guarantees other ordering guarantee. note default don't know sender is, unless sender encodes in message.

your illustration happen:

a sends m1 , m2 b receives m1 the node on b resides gets disconnected the node on b resides comes again a sends m3 b b receives m3

m2 can lost on network link in scenario. highly unlikely happens, can happen. usual trick have kind of notion of such errors. either having timeout trigger, or monitoring node or pid recipient of message.

updated scenario:

in updated scenario, provided read correctly, 'down' style message @ point, , likewise, message telling node again, if monitor node.

though often, such things improve modeled using idempotent protocol if @ possible.

erlang message-passing

hadoop - How Block size varies from Cluster1 to Cluster2, if we use DistCp command? -



hadoop - How Block size varies from Cluster1 to Cluster2, if we use DistCp command? -

i processing "distcp" command move few critical files form cluster1 cluster2. these critical files residing blocksize 64mb, before. , moved cluster2 [it got 128mb blocksize).

after distcp move, how does critical files performance increment new blocksize in cluster2..performance increment or decreases..???

it depends on files. hadoop files supposed read sequentially , if files big(let's gbs or tbs) increment performance if increment blocksize, because decrease number of tasks performed. copying distcp not maintain block properties of file since block configurations varies cluster cluster.

hadoop distcp

c# - linq list of list sum of number -



c# - linq list of list sum of number -

i have code this(i have simplified real case)

public class { public list<b> list { get; set; } } public class b { public list<c> list{ get; set; } } public class c { public datetime date { get; set; } public int num { get; set; } }

i want sum num values date today. there error because have list(in class b) in list(in class a) how can do? try

a = new a(); b b1 = new b(); c c1 = new c() { date = datetime.today, num = 2 }; c c2 = new c() { date = datetime.today.adddays(1), num = 3 }; b1.list.add(c1); b1.list.add(c2); a.list.add(b1); b b2 = new b(); c c3 = new c() { date = datetime.today, num = 4 }; c c4 = new c() { date = datetime.today.adddays(1), num = 5 }; b2.list.add(c3); b2.list.add(c4); a.list.add(b2); var tot = (from l in a.list l.list.where(x => x.date == datetime.today) select l;

you can utilize selectmany outer list "flatten" inner ones, this:

var tot = a.list.selectmany(bitem => bitem.list) // point on, see "flat" ienumerable<c> .where(citem => citem.date == datetime.today) .sum(citem => citem.num);

c# linq

python - How to make a 'str' object callable using lambda functions? -



python - How to make a 'str' object callable using lambda functions? -

i have predefined functions me, : addhost, edithost, deletehost.

now based on param received, have phone call 1 of above functions. value of param same 1 of above functions.the type of param str.

for example: if param 'addhost', should able phone call addhost(). when directly, gives me error 'str' object not callable how should phone call appropriate function based on param received ??

p.s. dont want utilize conditionals, want go lambda functions.

i lean towards getattr method described here: http://stackoverflow.com/a/3071/3757019

python string lambda

android - Should i keep a local copy of remote database? -



android - Should i keep a local copy of remote database? -

i working on application will, basically, allow people create, bring together , manage groups of other people. people within groups can message each other.

i have been wondering path better:

keep remote database information, including messages sent , users. , have app query server every time needs information. info has seen before.

keep remote database information, including messages sent , users. maintain local re-create of remote database , maintain synced remote database. whenever app needs query information, query see if local table date. if not date, updates table , runs query on local table. way maintain local re-create , app have fast queries when there not update remote table.

what done mobile applications , remote databases? would "bad practice" if did number 1?

my base of operations response maintain info in 1 place , access remotely unless there major reason maintain locally. there have extenuating circumstances mandate maintain re-create of info locally. create sure queries accurate , concise. don't pull on more info need to.however, can have subset of info kept locally. items specific user (like messages), keeping info not relevant adds overhead , bloat.

android mysql database sqlite mobile

node.js - PrimaryPreferred preference for replica set not working -



node.js - PrimaryPreferred preference for replica set not working -

assume got 2 servers same mongodb replica set - 1 mongodb primary , other secondary , arbiter. im using node.js access db (https://github.com/mongodb/node-mongodb-native). after manually disconnect connection between servers, primary becomes secondary , secondary primary because of arbiter. now, want allowed read secondary. code looks like:

var mongoclient = require('mongodb').mongoclient , format = require('util').format; var url = format("mongodb://%s,%s,%s/%s?replicaset=%s&readpreference=%s" , "localhost:27017", , "localhost:27018" , "localhost:27019" , "exampledb" , "foo" , "primarypreferred"); mongoclient.connect(url, function(err db) { if(!err) { console.log("we connected"); var collection = db.collection('somecollection'); collection.find({}).toarray(function(err, items) { // done reading secondary if available }) } });

but says no replica set fellow member available query readpreference undefined , tags undefined. should ?

i think need set slaveok: "true". enable queries on secondary , able query.

regards, sheraz javed

node.js mongodb

Multiple android.intent.action.MAIN -



Multiple android.intent.action.MAIN -

in android app demos, have seen multiple android.intent.action.main statements in mainfest.xml. every activity declared in manifest.xml had android.intent.action.main , android.intent.category.sample_code 1 activity had android.intent.action.main , android.intent.category.launcher.

can explain why mainfest.xml has multiple android.intent.action.main statements? in scenarios supposed have multiple mains in manifest.xml? , why android.intent.category.sample_code needed?

android

ios7 - How to debug app without rebuilding -



ios7 - How to debug app without rebuilding -

i have crash not happen after app built , run, occurs when close , re-open it. how run app in debug mode without building every time?

found it. option+command+r. didn't solve problem though, i'll have seek else.

ios7 xcode5

Simple C# server to stream video over HTTP -



Simple C# server to stream video over HTTP -

i trying create simple console application in c #. need create streaming video , must accessible straight browser.

i reviewing link streaming big video files .net, seems code asp.net

another thing trying, tcpcliente, have problems when sending big files.

var fs = file.open("../../video.mp4", filemode.open); outheaders.add("content-type", "video/mp4"); outheaders.add("accept-ranges", "0-" + fs.length); long size = fs.length; long length = size; long startbytes = 0; long endbytes = size - 1; if (headers["range"] != null) { var msg = system.text.encoding.ascii.getbytes("http/1.0 206 partial content" + "\n"); stream.write(msg, 0, msg.length); var range = parserange(size, headers["range"].tostring()); startbytes = range.start; endbytes = range.end; fs.seek(startbytes, seekorigin.begin); length = endbytes - startbytes + 1; } else { var msg = system.text.encoding.ascii.getbytes("http/1.0 200 ok" + "\n"); stream.write(msg, 0, msg.length); } outheaders.add("content-length", length); outheaders.add("content-range", string.format("bytes {0}-{1}/{2}", startbytes, endbytes, size)); sendheader(stream, outheaders); int bytesread = 0; byte[] buf = new byte[client.sendbuffersize]; while (fs.position <= endbytes && (bytesread = fs.read(buf, 0, buf.length)) > 0) { stream.write(buf, 0, bytesread); stream.flush(); } fs.close();

the problem in:

while (fs.position <= endbytes && (bytesread = fs.read(buf, 0, buf.length)) > 0) { stream.write(buf, 0, bytesread); stream.flush(); }

when fs.position = 425984 error:

no se controló system.io.ioexception hresult=-2146232800 message=no se pueden leer los datos de la conexión de transporte: se ha forzado la interrupción de una conexión existente por el host remoto. source=system stacktrace: en system.net.sockets.networkstream.write(byte[] buffer, int32 offset, int32 size) en httpserver.program.main(string[] args) en j:\httpserver\httpserver\program.cs:línea 85 en system.appdomain._nexecuteassembly(runtimeassembly assembly, string[] args) en system.appdomain.executeassembly(string assemblyfile, evidence assemblysecurity, string[] args) en microsoft.visualstudio.hostingprocess.hostproc.runusersassembly() en system.threading.threadhelper.threadstart_context(object state) en system.threading.executioncontext.runinternal(executioncontext executioncontext, contextcallback callback, object state, boolean preservesyncctx) en system.threading.executioncontext.run(executioncontext executioncontext, contextcallback callback, object state, boolean preservesyncctx) en system.threading.executioncontext.run(executioncontext executioncontext, contextcallback callback, object state) en system.threading.threadhelper.threadstart() innerexception: system.net.sockets.socketexception hresult=-2147467259 message=se ha forzado la interrupción de una conexión existente por el host remoto source=system errorcode=10054 nativeerrorcode=10054 stacktrace: en system.net.sockets.socket.send(byte[] buffer, int32 offset, int32 size, socketflags socketflags) en system.net.sockets.networkstream.write(byte[] buffer, int32 offset, int32 size) innerexception:

in line stream.write(buf, 0, bytesread);

what can do? thx

c# http video streaming

content management system - Umbraco DropDown List -



content management system - Umbraco DropDown List -

i have requirement store list of designers logos , bio info in umbraco cms. created document type called 'designer' properties. i'd create dropdown list designer names can associate other document types. how create dropdown? i'm using v7 of umbraco.

checkout nupickers umbraco v7. should have need.

http://our.umbraco.org/projects/backoffice-extensions/nupickers

http://github.com/ucomponents/nupickers/wiki

http://www.nuget.org/packages/nupickers

look here help creating custom labels using macros http://github.com/ucomponents/nupickers/wiki/custom-labels

content-management-system umbraco umbraco7

How can I make a TDate parameter optional in Delphi? -



How can I make a TDate parameter optional in Delphi? -

my class looks this;

type tbatchfilter = class(tobject) private fbatchno: string; fline: string; fcutoffdate: tdate; public constructor create(abatchno, aline: string; acutoffdate: tdate); overload; constructor create(abatchfilter: tbatchfilter); overload; property batchno: string read fbatchno; property line: string read fline; property cutoffdate: tdate read fcutoffdate; end;

i want create acutoffdate:tdate parameter optional. thing of calling constructor this;

mybatchfilter := tbatchfilter('batch1', 'line1', nil);

then in constructor have this;

if (acuttoffdate = nil) dosomething else dosomethingelse;

but can't pass nil parameter. don't want overload constructor further.

there 2 obvious ways tackle this:

add overloaded constructor omits date parameter. make date parameter have default value sentinel value has no meaning.

you've attempted utilize nil sentinel, sentinel has valid value type. , nil not. you'll need pick suitable value. perhaps zero. or big positive or negative value. whatever choose, declare named constant give code semantic clarity.

delphi parameters

r - indexing through values of a nested list using mapply -



r - indexing through values of a nested list using mapply -

i have list of lists, each sub-list containing 3 values. goal cycle through every value of nested list in systematic way (i.e. start list 1, go through 3 values, go list 2, , on), applying function each. function hits missing values , breaks , i've traced problem indexing itself, doesn't behave in way expecting. lists constructed as:

pop <- 1:100 treat.temp <- null treat <- null ## generate 5 samples of pop (i in 1:5){ treat.temp <- sample(pop, 3) treat[[i]] <- treat.temp } ## create list index mapply iterations <- (1:5)

illustrative function , results.

test.function <- function(j, k){ (n in 1:3){ print(k[[n]][j]) } } results <- mapply(test.function, iterations, treat) [1] 61 [1] 63 [1] 73 [1] na [1] na [1] na [1] na [1] na <snipped>

for first cycle through 'j', works. after throws nas. if manually, returns values expect.

> print(treat[[1]][1]) [1] 61 > print(treat[[1]][2]) [1] 63 > print(treat[[1]][3]) [1] 73 > print(treat[[2]][1]) [1] 59 > print(treat[[2]][2]) [1] 6 > print(treat[[2]][3]) [1] 75 <snipped>

i'm sure basic question, can't seem find right search terms find reply here or on google. in advance!

edited add: mrflick's reply works problem. have multiple list inputs (hence mapply) in actual use. more detailed example, few notes.

pop <- 1:100 years <- seq.int(2000, 2014, 1) treat.temp <- null treat <- null year.temp <- null year <- null ## generate 5 samples of treated states, command states , treatment years (i in 1:5){ treat.temp <- sample(pop, 20) treat[[i]] <- treat.temp year.temp <- sample(years, 1) year[[i]] <- year.temp } ## create list index mapply iterations <- (1:5) ## define function test.function <- function(j, k, l){ (n in 1:3){ ## cycles treat through each value of jxn print(k[n]) ## holds treat (k) fixed each 3 cycle set of n (using first value in each treat sub-list); cycles through sub-lists j changes print(k[1]) ## same above, 2nd value in each sub-list of treat print(k[2]) ## holds year (l) fixed each 3 cycle set of n, cycling through values of year each time j changes print(l[1]) ## functionally equivalent print(l) } } results <- mapply(test.function, iterations, treat, year)

well, might misunderstanding how mapply works. function loop through both of iterations pass parameters, means treat subset each iteration. essentially, functions beingness called are

test.function(iterations[1], treat[[1]]) test.function(iterations[2], treat[[2]]) test.function(iterations[3], treat[[3]]) ...

and seem treat k variable if entire list. also, have indexes backwards well. test working, can do

test.function <- function(j, k){ (n in 1:3) print(k[n]) } results <- mapply(test.function, iterations, treat)

but isn't super awesome way iterate list. trying accomplish?

r mapply

meteor - Deps.autorun based on chaning value in database. -



meteor - Deps.autorun based on chaning value in database. -

i seek deps.autorun function based on changing value in database. goal run function everytime value changes, instead of having create lot of method calls in code.

with session.set , session.get setting deps.autorun gives no problems , it's pretty straightforward.

my code (simplified);

newnotification = function() { var game = games.find({}, {fields: {lastaction: 1}}).fetch(); console.log('log: ' + game); // [object, object] console.log('log: ' + game._id); undefined console.log('log: ' + game.lastaction); undefined } deps.autorun(function() { newnotification(); })

how accomplish this? there other (better) way this, working session objects example?

you should take @ observechanges in meteor documentation. seek this.

games.find({}, { fields: { lastaction: 1 } }).observechanges({ changed: function(id, fields) { newnotification(); } });

meteor

java - How to use FlexibleOptionGroup inside vaadin table? -



java - How to use FlexibleOptionGroup inside vaadin table? -

i need utilize optiongroup within table cell of 1 column. if 1 item selected other item should deselected. in general optiongroup cannot add together item different cells of table. using flexibleoptiongroup. don't know how utilize using table field mill this. if propertyid.equals("option") optiongroup item should add together table cell.

resulttable.setimmediate(true); resulttable.settablefieldfactory(new defaultfieldfactory() { public field<?> createfield(container container, final object itemid, object propertyid, component uicontext) { if (propertyid.equals("option")) { } field field = super.createfield(container, itemid, propertyid, uicontext); field.setreadonly(true); homecoming field; } });

java maven vaadin vaadin7

Crispy Forms: Default selected value for FieldSet -



Crispy Forms: Default selected value for FieldSet -

i have list of items i'm populating crispy forms choicefield

for life of me, can't figure out how set item in region_choice selected default.

regions = { 'us': 'us value', 'ch': 'ch value' } region_choice = list(regions.items()) part = forms.choicefield(label='', choices=region_choice, required=true)

layout:

self.helper.layout = layout( field('request', placeholder='begin value...'), field('region'), submit("submit", "submit"), html('<a href="{% url \'rush\' %}" class="btn btn-primary btn-md right">rush history</a>') )

how can select default value input?

you need default parameter in field attributes, set value. sample:

region = forms.choicefield(default='us')

django-crispy-forms

python - Can we efficiently pull objects out of an array in cython? -



python - Can we efficiently pull objects out of an array in cython? -

i've timed next sample code cprofile, , these results.

ncalls tottime percall cumtime percall filename:lineno(function) 1 3.283 3.283 3.283 3.283 {comparison.addition_with_arrayview} 1 0.000 0.000 0.000 0.000 {comparison.simple_addition}

with help of others, i've managed cython near c speeds using objects, structs, , other methods, can't find way deal array of objects.

is there way farther cut down python overhead incurred when pulling object out of array in cython? (i've used cdef much know how.)

sample code:

import numpy np cimport cython @cython.boundscheck(false) @cython.wraparound(false) cdef class additionclass: cdef long int value def __init__(self, value): self.value = value cpdef int add_one(self): self.value += 1 homecoming 0 def get_value(self): homecoming self.value cdef: int loops = 10 long int a_big_number = pow(10, 7) def simple_addition(): cdef long int value = 0 in range(loops): ii in range(a_big_number): iii in range(10): value += 1 print "loop ", i, " out of ", loops, '. value: ', value homecoming none def addition_with_arrayview(): cdef additionclass addinstance cdef long int value = 0 addition_classes = np.array([none] * 10) in range(len(addition_classes)): addition_classes[i] = additionclass(0) cdef additionclass[:] arrayview = addition_classes in range(loops): ii in range(a_big_number): iii in range(10): addinstance = arrayview[iii] addinstance.add_one() print "loop ", i, " our of ", loops, '. value: ', \ arrayview[i].get_value(), " split between 10 arrays." homecoming none

profile script:

import cprofile import comparing def calling_all(): comparison.simple_addition() comparison.addition_with_arrayview() if __name__ == "__main__": cprofile.run('calling_all()', sort='time')

thank much time , advise!

python performance optimization cython

c++ - Why does gcov report in-class function definitions as not executable? -



c++ - Why does gcov report in-class function definitions as not executable? -

it seems gcov not study inline definitions of class methods executable lines. example:

#include <iostream> struct foo { void bar() {} void baz() {} }; int main() { foo foo; foo.bar(); }

if compile above programme g++ -g -o0 -ftest-coverage -fprofile-arcs -o main main.cpp, run it, , phone call gcov on it, next report:

-: 0:source:main.cpp -: 0:graph:main.gcno -: 0:data:main.gcda -: 0:runs:1 -: 0:programs:1 -: 1:#include <iostream> -: 2: -: 3:struct foo { 1: 4: void bar() {} -: 5: void baz() {} -: 6:}; -: 7: 1: 8:int main() { -: 9: foo foo; 1: 10: foo.bar(); 4: 11:}

why line 5 reported non-executable, though method above reported correctly executed once?

update

according gcov documentation (https://gcc.gnu.org/onlinedocs/gcc/invoking-gcov.html#invoking-gcov), - denotes non-executable line while ##### , ==== mark lines can executed weren't.

gcov reporting after linking binary, there never possibility of foo::baz() beingness executed.

the linker removed function, no executable code associated line anymore.

c++ g++ code-coverage gcov

ads - Chartboost Integration -



ads - Chartboost Integration -

i have app in xcode has no ads built in , want add together chartboost. downloaded sdk stuck. have latest chartboost sdk , when add together xcode, issue says cannot initialize parameter of type id<chartboostdelegate' ivalue of type 'appcontroller*

it looks need add together chartboostdelegate appcontroller interface. should this:

@interface appcontroller : nsobject <uiaccelerometerdelegate, uialertviewdelegate, uitextfielddelegate,uiapplicationdelegate, chartboostdelegate>

you should have @ top: #import "chartboost.h"

ads chartboost

android - Admob Banner Ad not displaying in App -



android - Admob Banner Ad not displaying in App -

my app in not show ad, pls help, below code. searched lot can see no error in code or may dont know error.

activity_main

<android.support.v4.view.viewpager xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/pager" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".mainactivity" > <relativelayout xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" > <com.google.android.gms.ads.adview xmlns:ads="http://schemas.android.com/apk/res-auto" android:id="@+id/adview" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignparentbottom="true" ads:adsize="smart_banner" ads:adunitid="ca-app-pub-33xxxxxxxxxxxxxxxxxxxxx"/> <listview android:id="@+id/list" android:layout_width="match_parent" android:layout_height="match_parent" android:divider="@null" android:dividerheight="0dp"> </listview> </relativelayout> </android.support.v4.view.viewpager>

mainactivity

package com.nyt.ilm.ilmsarf; import java.util.arraylist; import java.util.list; import com.google.android.gms.ads.adrequest; import com.google.android.gms.ads.adview; import com.nyt.ilm.ilmsarf.p1.onfragmentinteractionlistener; import android.content.context; import android.content.intent; import android.content.sharedpreferences; import android.net.uri; import android.os.bundle; import android.preference.preferencemanager; import android.support.v4.app.fragment; import android.support.v4.app.fragmentactivity; import android.support.v4.app.fragmentmanager; import android.support.v4.app.fragmentpageradapter; import android.support.v4.view.viewpager; import android.support.v4.view.viewpager.layoutparams; import android.view.viewtreeobserver; import android.widget.listview; import android.widget.relativelayout; public class mainactivity extends fragmentactivity implements onfragmentinteractionlistener { viewpager viewpager; context mcontext = mainactivity.this; sharedpreferences apppreferences; boolean isappinstalled = false; /* advertisement unit id. replace actual advertisement unit id. */ public boolean adviewheightset = false; @override protected void oncreate(bundle arg0) { // todo auto-generated method stub super.oncreate(arg0); apppreferences = preferencemanager.getdefaultsharedpreferences(this); isappinstalled = apppreferences.getboolean("isappinstalled", false); if (isappinstalled == false) { // add together shortcuticon code here intent shortcutintent = new intent(getapplicationcontext(), mainactivity.class); shortcutintent.setaction(intent.action_main); // shortcutintent added addintent intent addintent = new intent(); addintent.putextra(intent.extra_shortcut_intent, shortcutintent); addintent.putextra(intent.extra_shortcut_name, "ilmsarf"); addintent.putextra(intent.extra_shortcut_icon_resource, intent.shortcuticonresource.fromcontext( getapplicationcontext(), r.drawable.ic_launcher)); addintent.setaction("com.android.launcher.action.install_shortcut"); // broadcast new intent getapplicationcontext().sendbroadcast(addintent); // isappinstalled should true. sharedpreferences.editor editor = apppreferences.edit(); editor.putboolean("isappinstalled", true); editor.commit(); } setcontentview(r.layout.activity_main); viewpager = (viewpager) findviewbyid(r.id.pager); fragmentpageradapter fm = new mypageadapter(getsupportfragmentmanager()); viewpager.setadapter(fm); viewpager.setcurrentitem(fm.getcount() - 1); // advertisement banner adview adview = (adview) this.findviewbyid(r.id.adview); adrequest adrequest = new adrequest.builder().build(); adview.loadad(adrequest); adview.getviewtreeobserver().addongloballayoutlistener( new viewtreeobserver.ongloballayoutlistener() { @override public void ongloballayout() { if (adviewheightset) { return; } adview adview = (adview) findviewbyid(r.id.adview); listview list = (listview) findviewbyid(r.id.list); relativelayout.layoutparams params = new relativelayout.layoutparams(layoutparams.match_parent,layoutparams.match_parent); params.setmargins(0, 0, 0, adview.getheight() + 15); list.setlayoutparams(params); adviewheightset = true; } }); } @override public void onfragmentinteraction(uri uri) { // todo auto-generated method stub } } class mypageadapter extends fragmentpageradapter { private list<fragment> fragments; public mypageadapter(fragmentmanager fm) { super(fm); // todo auto-generated constructor stub this.fragments = new arraylist<fragment>(); fragments.add(new p1()); fragments.add(new p2()); fragments.add(new p3()); fragments.add(new p4()); fragments.add(new p5()); fragments.add(new p6()); fragments.add(new p7()); fragments.add(new p8()); fragments.add(new p9()); fragments.add(new p10()); fragments.add(new p11()); fragments.add(new p12()); fragments.add(new p13()); fragments.add(new p14()); fragments.add(new p15()); fragments.add(new p16()); fragments.add(new p17()); fragments.add(new p18()); fragments.add(new p19()); fragments.add(new p20()); fragments.add(new p21()); fragments.add(new p22()); fragments.add(new p23()); fragments.add(new p24()); fragments.add(new p25()); fragments.add(new p26()); fragments.add(new p27()); fragments.add(new p28()); fragments.add(new p29()); fragments.add(new p30()); fragments.add(new p31()); fragments.add(new p32()); fragments.add(new p33()); fragments.add(new p34()); fragments.add(new p35()); fragments.add(new p36()); fragments.add(new p37()); fragments.add(new p38()); fragments.add(new p39()); fragments.add(new p40()); fragments.add(new p41()); fragments.add(new p42()); fragments.add(new p43()); fragments.add(new p44()); fragments.add(new p45()); fragments.add(new p46()); fragments.add(new p47()); fragments.add(new p48()); fragments.add(new p49()); fragments.add(new p50()); fragments.add(new p51()); fragments.add(new p52()); fragments.add(new p53()); fragments.add(new p54()); fragments.add(new p55()); fragments.add(new p56()); fragments.add(new p57()); } @override public fragment getitem(int position) { // todo auto-generated method stub homecoming fragments.get(position); } @override public int getcount() { // todo auto-generated method stub homecoming fragments.size(); } }

and manifest is

<?xml version="1.0" encoding="utf-8"?> <manifest package="com.nyt.ilm.ilmsarf" android:versioncode="3" android:versionname="1.3" xmlns:android="http://schemas.android.com/apk/res/android"> <uses-sdk android:minsdkversion="8" android:targetsdkversion="19" /> <uses-permission android:name="com.android.launcher.permission.install_shortcut"/> <uses-permission android:name='com.android.launcher.permission.uninstall_shortcut'/> <uses-permission android:name="android.permission.internet"/> <uses-permission android:name="android.permission.access_network_state"/> <application android:allowbackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/apptheme" > <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version"/> <activity android:label="@string/app_name" android:name="adview" /> <activity android:name="com.nyt.ilm.ilmsarf.mainactivity" android:label="@string/app_name"> <intent-filter> <action android:name="android.intent.action.main"/> <category android:name="android.intent.category.launcher" /> </intent-filter> </activity> <activity android:name="com.google.android.gms.ads.adactivity" android:configchanges="keyboard|keyboardhidden|orientation|screenlayout|uimode|screensize|smallestscreensize"/> </application> </manifest>

thanks in advance.

you went through steps of integrating ads sdk

the meta-data tag there , looks correct com.google.android.gms.ads.adactivity declared you added network , net permissions

then looks called advertisement sdk load ad

// adview. adview adview = (adview) this.findviewbyid(r.id.adview); // create advertisement request. check logcat output hashed device id // test ads on physical device. adrequest adrequest = new adrequest.builder() .addtestdevice(adrequest.device_id_emulator) // alter if using real device test .addtestdevice("insert_your_hashed_device_id_here") .build(); // start loading advertisement in background. adview.loadad(adrequest);

but never told advertisement play.

/* function gets called when activity played * , should tell advertisement play too. * illustration if phone goes sleep wakes phone call function. */ @override public void onresume() { super.onresume(); if (adview != null) { adview.resume(); } } @override public void onpause() { if (adview != null) { adview.pause(); } super.onpause(); }

android android-fragments

matrix - Eigen Library : real time processing -



matrix - Eigen Library : real time processing -

i'm trying utilize eigen no heap allocation real time processing.

as far know:

matrix<double, dynamic, dynamic> allocates on stack matrix<double, dynamic, dynamic, autoalign, 1, 1> allocates on heap , matrix<double, 1, 1> allocates on stack;

one way utilize eigen in real time resize matrices at startup, big size, using fraction of size.

my question : functions : rm.colpivhouseholderqr().solve(rhs), how can perform such computation dynamic matrices? function take whole size of matrix operation not want portion of size treated. can't use .resize()

so how perform operations real-time processing?

real-time processing involves same work beingness done repeatedly, on fixed schedule. 1 approach dynamic memory allocation have contiguous chunk (a pool) of memory linearly allocate from. mark of memory free @ end of processing period. allocation cost o(1), deallocation cost o(1), , given amount of work can guarantee memory allocations satisfied. so, 1 solution utilize custom allocator.

matrix real-time eigen

perl error when passing DBI->execute values for IN clause -



perl error when passing DBI->execute values for IN clause -

i have query calculate objects within radius of point based on document here: http://www.plumislandmedia.net/mysql/haversine-mysql-nearest-loc/

it works nicely want search objects of particular type, , causing problem;

the code looks this:

my $sql = "select * ( select b.*, pr.postcode, pr.prize, pr.title, pr.collection, pr.redeemed, pr.delivery, pr.archived, bt.category, p.radius, p.distance_unit * degrees(acos(cos(radians(p.latpoint)) * cos(radians(b.lat)) * cos(radians(p.longpoint - b.lng)) + sin(radians(p.latpoint)) * sin(radians(b.lat)))) distance bubbles b, bubble_prizes pr, bubble_types bt bring together ( /* these query parameters */ select ? latpoint, ? longpoint, ? radius, ? distance_unit ) p b.lat between p.latpoint - (p.radius / p.distance_unit) , p.latpoint + (p.radius / p.distance_unit) , b.lng between p.longpoint - (p.radius / (p.distance_unit * cos(radians(p.latpoint)))) , p.longpoint + (p.radius / (p.distance_unit * cos(radians(p.latpoint)))) , pr.bubble = b.id , b.type in ? , b.type = bt.type ) d distance <= radius order distance";

i do

my $points = $y->dbh->prepare($sql); $results = $points->execute($lat, $lng, $rad, $units, '(type1, type2)');

where '(type1, type2)' should passed

b.type in ?

(which near bottom of sql).

i've tried every way can think of escape string works (including lots of ways insane i'm getting desperate) inc

'(type1, type2)' '\(\'type1\', \'type2\'\)' '(\'type1\', \'type2\')' "('type1', 'type2')"

etc (i've tried many things can't remember them all.)

no matter seek sql error of form

dbd::mysql::st execute failed: have error in sql syntax; check manual corresponds mysql server version right syntax utilize near ''(type1, type2)' , b.type = bt.type ) d distance <= radius'

depending on how i've tried escape string, error message different relating same part of sql.

i'm thinking escaping isn't problem , i'm missing execute. if run code in db works fine normal in statement i.e. b.type in ('type1', 'type2') works fine.

can enlighten me? how supposed this?

thanks

you need utilize placeholders within in (...) statement. entire point of execute() avoid sql injection, , you're attempting inject sql there. can create dynamic list of placeholders so:

my @types = qw(type1 type2); $placeholders = bring together ", ", ("?") x @types; $sql = "... b.typeid in ($placeholders) ..."; $points = $y->dbh->prepare($sql); $results = $points->execute($lat, $lng, $rad, $units, @types);

perl dbi

css - Html not displaying correctly in email -



css - Html not displaying correctly in email -

html:

<div id="container"> <div id="social-links"> <img src="http://www.collegify.com/emailer/roads/delhi/images/promotional_03.jpg" alt=""> www.twitter.com/roadsprep <br /> <img src="http://www.collegify.com/emailer/roads/delhi/images/promotional_09.jpg" alt=""> www.facebook.com/roadsprep </div> <div id="website-link">www.roadsprep.com</div> <div id="now-at-gurgaon"> @ <br /> gurgaon </div> <div id="gray-box"> specialize in <br /> sat, gre, gmat, deed <br /> ielts , toefl coaching! </div> <div id="pointers"> <ul> <li>over 6 years of test prep experience!</li> <li>over 300 students 2100 + scores</li> <li>on average, improvement of 400 point improvement in scores</li> </ul> </div> <div id="contact-info"> <strong>roads academy private limited</strong> <br /> office no. 4001, basement, dlf phase iv, near, galleria market, gurgaon - 122 009, haryana <br /> <strong>phone:</strong> +91 85100 66662 <strong>email:</strong> support@roadsprep.com </div> </div>

css:

class="lang-css prettyprint-override">* { font-family: 'open sans condensed', sans-serif; } #container { background-image: url(http://www.collegify.com/emailer/roads/delhi/images/promotional-flyer-for-delhi-front-1.jpg); background-repeat: no-repeat; width: 600px; height: 910px; margin: 0 auto; padding-top: 31px; } #social-links { margin: 0 0 0 32px; float: left; width: 200px; height: 57px; font-size: 13px; font-weight: bold; } #website-link { margin: 0 21px 0 0; float: right; width: 200px; text-align: right; font-size: 22px; font-weight: bold; } #now-at-gurgaon { margin: 230px 0 0 128px; color: #454b4f; font-size: 25px; font-weight: bold; text-align: center; width: 181px; line-height: 22px; font-family: arial, helvetica, sans-serif; } #gray-box { background-color: #454a4e; width: 280px; height: 80px; border-top: solid 1px #1b1d21; margin-top: 315px; padding-left: 40px; font-size: 22px; font-weight: bold; line-height: 25px; color: #fbc911; } #pointers { width: 280px; padding: 0 0 0 20px; font-size: 16px; font-weight: bold; line-height: 20px; color: #454a4e; } #contact-info { border-top: solid 1px #2f3337; width: 537px; margin: 10px auto 0 auto; text-align: center; padding-top: 10px; line-height: 20px; font-size: 17px; }

code in head web font:

<link href='http://fonts.googleapis.com/css?family=open+sans+condensed:300,700' rel='stylesheet' type='text/css'>

this displays in browser, not working in email. know cannot paste code in email, , need preview in browser, re-create straight there, , paste in email body, not displaying correctly. using gmail.

emails tend strip header content, unlikely able add together external link new font.

as rule, maintain html in emails simple possible ability render html limited (especially outlook). remember (probably) sending variety of email clients - different.

this should help : https://www.campaignmonitor.com/css/

html css html-email

javascript - Cannot add Id tag using JQuery -



javascript - Cannot add Id tag using JQuery -

i add together custom id tag e.g. id = keys[key][each]as part of html that's beingness appended new_resumes class e.g.

<div class = "filtered_results" id = keys[key][each] ...

instead code below - when utilize attr or prop tag adds id new resumes class. appreciate code not greatest.

for (var key in keys) { $(".new_resumes").append("<div class='filtered_results' style='color:white; background-color:red; text-align:center; height:20px; line-height: 20px'>" + key + "</div>"); (var each in keys[key]) { $(".new_resumes").append("<div class='filtered_results' style ='height:60px; text-align:center; height:60px; line-height: 60px;'>" + keys[key][each][0] + "</div>").prop('id',keys[key][each][0]);

if understand question, want add together id filtered_results div creating?

you should concatenate so:

$(".new_resumes").append("<div class='filtered_results' id='" +keys[key][each][0] +"' style ='height:60px; text-align:center; height:60px; line-height: 60px;'>" + keys[key][each][0] + "</div>")

take note of part: id='" +keys[key][each][0] +"'

right now, calling .prop on current element still .new_resumes element.

javascript jquery html

objective c - iOS open source smart controller push/pop lib for uinavigationcontroller? -



objective c - iOS open source smart controller push/pop lib for uinavigationcontroller? -

i have application user can force infinitely deep views (pushing onto nav stack). @ point, there memory warning. i'd remove view controllers navigation controller , dealloc them. if user goes view controllers, i'd recreate view controllers , force them right position in stack.

is right way thinking problem?

is there open source project this? doesn't seem uncommon issue , i'd rather not reinvent wheel.

there time needed create sure calls viewdidload , viewdidunload matched memory warnings handled way. since ios 6 no longer necessary.

as says in documentation viewdidunload:

in ios 5 , earlier, when low-memory status occurred , current view controller’s views not needed, scheme opt phone call method after view controller’s view had been released. method chance perform final cleanup. if view controller stored separate references view or subviews, utilize method release references. utilize method remove references objects created back upwards view no longer needed view gone. not utilize method release user info or other info cannot recreated.

in ios 6 , later, clearing references views , other objects in view controller unnecessary.

if you're manually keeping big objects in memory, such image or video data, can override didreceivememorywarning release objects necessary.

ios objective-c uinavigationcontroller

jquery - Fit text perfectly inside a div (height and width) without affecting the size of the div -



jquery - Fit text perfectly inside a div (height and width) without affecting the size of the div -

i apologise in advance know question has come many times before can't seem find right solution (and believe me i've tried few!)

basically it's old "fit text within div without affecting size of div". , unless i'm finish numpty, believe css has no way of doing this. mean rather doing like:

#somediv { font-size: 12px; }

or...

#somediv { font-size: 1em; }

...i want able this:

#somediv { font-size: fluid; }

...meaning whatever text div contains, scale fit left right , top bottom no overflow or whitespace.

after trawling through countless websites looking css solution, i've accepted css isn't capable of ...so, come in jquery.

i've found several jquery solutions online scale text fit width, want scale height well. want jquery:

"jquery, find $(this) div , whatever text within want scale fills entire height , width of div tightly possible".

in case haven't explained myself well, i've attached graphic explaining problem i'm facing , solution i'm looking for.

any help much appreciated. give thanks you.

here's same answer, in javascript

var autosizetext; autosizetext = function() { var el, elements, _i, _len, _results; elements = $('.resize'); console.log(elements); if (elements.length < 0) { return; } _results = []; (_i = 0, _len = elements.length; _i < _len; _i++) { el = elements[_i]; _results.push((function(el) { var resizetext, _results1; resizetext = function() { var elnewfontsize; elnewfontsize = (parseint($(el).css('font-size').slice(0, -2)) - 1) + 'px'; homecoming $(el).css('font-size', elnewfontsize); }; _results1 = []; while (el.scrollheight > el.offsetheight) { _results1.push(resizetext()); } homecoming _results1; })(el)); } homecoming _results; }; $(document).ready(function() { homecoming autosizetext(); });

by way...if ever need convert coffeescript javascript, go js2coffee.org

jquery css font-size

c++ - Android NDK - Event for app enters background -



c++ - Android NDK - Event for app enters background -

i know if there way identify app entered background ndk.

i have application spawns pthread with

pthread_create(&_thread, null, methodtocall, null); //create thread

now working fine. problem need thread run while app active. on ios not problem since created thread suspended system. on android continues run on lock screen until stop app.

this of course of study not battery life. know utilize jni phone call activities onstop() method. seems rather complicated.

so there improve way detecting within jni / c++ app has become inactive?

i think cannot access android app state c++ thread without using message passing function. since app suspends (when user closes app or screen) cannot pass messages android c++ thread.

i can think of 2 possible solutions might work you: 1. when activity "suspends" - "onpause()" method called, , there can "stop" thread or create sleep. in "onresume()" method can start 1 time again or wake up, depends on thread (how utilize it).

2.you can have flag checks whether app has suspended or not. create c++ thread sleep few seconds/milisecs , check flag - if flag on - stop thread, otherwise continue. in case can't wake thread, unless perform action similar first (make sleep/wakeup whenever app suspends/reactivates).

hope helps, tom.

android c++ multithreading android-ndk jni

java - libgdx Cutting an image -



java - libgdx Cutting an image -

i have been trying "cut" image time now, ll explain why , tried. wanted create hp "bar" except it's not bar heart , though easy had have 2 pictures draw them on top of each other , cutting 1 create appear in hp beingness lost, not able find way cutting image.

setting height resizes image might have guessed i tried using textureregion kind of hack didn't go well i found method called clip begin uses scissors reason doesn't seem working.

i might using clip begin wrong can't find real documentation on it, i'm doing is:

image.clipbegin(x,y,height,weight); image.clipend();

i forgot, i'm using scene2d image, might improve way go around not sure be.

i appreciate ideas on how this, give thanks you.

you want utilize opengl scissor back upwards libgdx exposes. see libgdx clipping wiki , libgdx scissorstack documentation.

the api isn't particularly friendly (its designed back upwards dynamically pushing multiple constraining rectangles, far i've seen, isn't used often).

the of import point remember scissor stack applies actual draw commands issued. since apis seek batch draw commands, means actual drawing might not happen when looks should happen. ensure clipping happening must flush buffered draws before pushing scissor (otherwise wrong thing might clipped) , must flush draw calls before popping scissor (otherwise things want clipped might avoid scissors).

see libgdx scissorstack not working expected or libgdx - how clip or how draw on portion of screen spritebatch in libgdx? or making grouping hide actors outside of bounds.

java image libgdx crop clipping

php - Remove string contained within a specific starting and ending string -



php - Remove string contained within a specific starting and ending string -

i want remove whole substring string when substiring starts "stringa" , ends "/r".

fx original string:

"peterstringanone/rgriffin"

should be

"petergriffin"

demo

$re = '/stringa[\w\d]+\/r/'; $str = 'peterstringanone/rgriffin'; $result = preg_replace($re, '', $str);

php regex

c - Length of a multibyte sequence in bytes, (unicode) code points, characters and cursor positions -



c - Length of a multibyte sequence in bytes, (unicode) code points, characters and cursor positions -

i not sure if assumptions correct, sense 4 kinds of length of multibyte sequence can different, illustrate:

say, multibyte encoding utf-8, , have string "\xc3\xb8 \xe2\x86\x82 e\xcc\x88", utf-8 encoding of "\u00f8 \u2182 e\u0308", "ø ↂ ë"

this string has length of:

10 bytes 6 unicode code-points 5 characters 6 screen positions (with monospaced font) (ↂ takes 2 positions)

1.) returned strlen , 2.) can determined <wchar.h> functions.

but there portable way of determining 3.) , 4.)? not sure, if ↂ taking 2 cursor positions defined font-independently codepoints or font in use, sense “monospaced font” , “some characters take more 1 space” contradictional. @ least, in monospace character cover 2 cursor positions. unicode chart u2150 doesn't cursor positions.

lastly, number of positions negative character (i mean, character putting cursor position left in left-to-right script or vice versa)?

the posix interface wcwidth can used find number of "cursor positions" of wchar_t. in order wchar_t values (one @ time), can utilize c99 standard library function mbtowc, extracts single multibyte character string , returns number of bytes consumed. (repeatedly calling mbtowc on string , updating string pointer each time tell how many multibyte characters nowadays in string, @ to the lowest degree if multibyte coding utf-8.)

the combination of wcwidth , mbtowc can more or less tell how many glyphs have in string (your question #3). wchar_t wcwidth returns 0 either zero-width format command or combining character , wchar_t wcwidth returns -1 either non-character or command character (like \n). either way, can ignored, glyph count count of wchar_t width >0.

that makes clear 4 questions have different answers:

number of bytes.

number of multibyte codepoints.

number of multibyte codepoints wcwidth greater 0.

sum of wcwidth of multibyte codepoints wcwidth greater 0.

having said that, there no guarantee value returned wcwidth corresponds either actual character widths of current console font or unicode version beingness used application. (i've had problem both of these.) values returned wcwidth extracted current locale, can edit , recompile locale files prepare errors. see, example, reply here: how ncurses output astral plane unicode characters

c unicode encoding

jquery - Get a php file and show contents on hover -



jquery - Get a php file and show contents on hover -

when hovers on div.lol want show contents within profile.php on div.sdf

$(document).ready(function(){ $('.lol').hover(function(){ $(this).parent().next().find('.sdf').get('profile.php'); },function(){ $(this).parent().next().find('.sdf').get(); }) });

i tried nil loads.

here jfiddle http://jsfiddle.net/csbvw/93/

you using get method wrong. here documentation of get. way used get makes phone call this function. utilize ajax get method retrieve info server , inject result dom element want displayed in.

jquery

mysql - SQL SELECT query, tables with no column in common -



mysql - SQL SELECT query, tables with no column in common -

i'm working 2 databases: relation between 2 tables db1.tab1.model_id=db2.tab2.id_element

delete db1.tab1 db1.tab1.model_id in ( select db1.tab1.model_id db1.tab1 db1.tab1.model_id = db2.tab2.id_element in ( select db2.tab2.id_element db2.tab2 db2.tab2.deleted='1' ) );

i'm not surprised doesn't work since 4th line sucks, thing know can't put

where db1.tab1.model_id in (select db2.tab2.id_element .....)`

i mean where clause should same in select!

can seek query? looking @ query seems want delete records tab1 marked deleted in tab2.

delete db1.tab1 db1.tab1 bring together db2.tab2 on db1.tab1.model_id = db2.tab2.id_element db2.tab2.deleted='1';

mysql sql select delete-row

magento - Move static block to top of each category page -



magento - Move static block to top of each category page -

currently when add together cms static block category pages via category display settings shows inline left column. appear above, left column , products under.

so visually,

instead of:

left column | static block

| products

i it:

static block

left column | products

any ideas?

assuming using 2 columns left-bar.phtml

you have create new structural block layout

modify 2columns-left.phtml file

..... <div class="wrapper"> <?php echo $this->getchildhtml('global_notices') ?> <div class="page"> <?php echo $this->getchildhtml('header') ?> <div class="main-container col2-left-layout"> <div class="main"> <?php echo $this->getchildhtml('breadcrumbs') ?> <?php echo $this->getchildhtml('categorystaticblock'); //<---new block ?> <div class="col-main"> <?php echo $this->getchildhtml('global_messages') ?> <?php echo $this->getchildhtml('content') ?> </div> <div class="col-left sidebar"><?php echo $this->getchildhtml('left') ?></div> </div> </div> <?php echo $this->getchildhtml('footer') ?> <?php echo $this->getchildhtml('before_body_end') ?> </div> </div> .....

now in catalog.xml declare what's within new structural block

<catalog_category_default translate="label"> <label>catalog category (non-anchor)</label> <reference name="categorystaticblock"> <block type="catalog/category_view" name="categorystatickblock" as="categorystatickblock" template="catalog/category/staticblock.phtml"> </reference> <reference name="left"> <block type="catalog/navigation" name="catalog.leftnav" after="currency" template="catalog/navigation/left.phtml"/> </reference> <reference name="content"> ....

now create new file catalog/category/staticblock.phtml

<?php if($this->iscontentmode() ||$this->ismixedmode()): ?> <?php echo $this->getcmsblockhtml() ?> <?php endif; ?>

now remove or coment out catalog/category/view.phtml the

<?php echo $this->getcmsblockhtml() ?>

lines echo cms block otherwise twice on page

hope helps

bye giuseppe

magento

javascript - Issue with Jquery load functionality -



javascript - Issue with Jquery load functionality -

i trying run page jquery functionality insside it, happening when ajax post, shows me message in alert box , afterwards reloads whole page 1 time again , unable run 1 time again , @ point shows error

$fancybox in undefined, shows t undefined

but other functionality update page 1 time again not work. here below code tried

<html> <head> <title>view images</title> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" type="text/javascript"></script> <script type="text/javascript" src="/js/fancybox/jquery.fancybox-1.3.4.pack.js"></script> <script type="text/javascript" src="/js/fancybox/jquery.easing-1.3.pack.js"></script> <script type="text/javascript" src="/js/fancybox/jquery.mousewheel-3.0.4.pack.js"></script> <link rel="stylesheet" type="text/css" href="/js/fancybox/jquery.fancybox-1.3.4.css"> <script type="text/javascript"> $(document).ready(function() { $("a.zoom2").fancybox({ 'zoomspeedin' :500, 'zoomspeedout' :500, 'overlayshow' :false, 'width' :800, 'height' :600 }); $(".mychecks").click(function(e) { var info = $("#frmimages").serialize(); var mainid = $("#mainid").val(); $.ajax({ type:"post", url:"actionimages.cfm?action=update", cache:false, data:data, success:function(html) { var = $("#msg").html(html).text().replace('/\s+/g', ' '); alert(i); $('#reloadimages').load('viewimages.cfm?id=' + mainid + '&user=myname'); } }); }); }); function checkboxes(theelement) { var theform = theelement.form, z = 0; for(z=0; z<theform.length;z++){ if(theform[z].type == 'checkbox' && theform[z].name != 'checkall'){ theform[z].checked = theelement.checked; } } } </script> </head> <body style="background:white;"> <div id="reloadimages"> <form name="frmimages" id="frmimages"> <table align="center" width="100%" cellpadding="1" cellspacing="2"> <tr> <td colspan="4" align="center"><div style="display:none;" id="msg"></div></td> </tr> <tr> <td colspan="4" align="left" class="blackbold20"><strong>view images</strong></td> </tr> <td height="30" valign="middle" class="dropdownb"><a class="zoom2" rel="group" title="bigger image" href="/small/5643-freshy_fresh_oval_oval.jpg"> <img src="/small/5643.jpg" border='0'></a><br> <a title="delete image - 5643.jpg" style="cursor:pointer;" id="del~47780~5643" class="del">[x]</a>&nbsp;&nbsp; <br> show image: yes <input type="radio" name="display_47780" id="display_1_47780" checked="checked" value="1" title="check radio show image on front end screen"> &nbsp;&nbsp; no <input type="radio" name="display_47780" id="display_0_47780" value="0" title="check radio not show image on front end screen"> <br> <br> <select name="submitter_47780" id="submitter_47780"> <option value="none" selected="selected">(select one)...</option> <option value="cdm" selected="selected">cdm</option> </select> <br> header image&nbsp;&nbsp; <select name="headerimage_47780" id="headerimage_47780"> <option value="0" >no</option> <option value="1" selected="selected">yes</option> </select></td> <td height="30" valign="middle" class="dropdownb"><a class="zoom2" rel="group" title="bigger image" href="/small/5643-chrysanthemum_13d4294a55.jpg"> <img src="/small/5643-chrysanthemum_13d4294a55.jpg" border='0'></a><br> <a title="delete image - 5643-chrysanthemum_13d4294a55.jpg" style="cursor:pointer;" id="del~47787~5643" class="del">[x]</a>&nbsp;&nbsp; <br> show image: yes <input type="radio" name="display_47787" id="display_1_47787" checked="checked" value="1" title="check radio show image on front end screen"> &nbsp;&nbsp; no <input type="radio" name="display_47787" id="display_0_47787" value="0" title="check radio not show image on front end screen"> <br> <br> <select name="submitter_47787" id="submitter_47787"> <option value="none" selected="selected">(select one)...</option> <option value="cdm" selected="selected">cdm</option> </select> <br> header image&nbsp;&nbsp; <select name="headerimage_47787" id="headerimage_47787"> <option value="0" selected="selected">no</option> <option value="1" >yes</option> </select></td> <td height="30" valign="middle" class="dropdownb"><a class="zoom2" rel="group" title="bigger image" href="/small/5643-desert_73a8b513fa.jpg"> <img src="/small/5643-desert_73a8b513fa.jpg" border='0'></a><br> <a title="delete image - 5643-desert_73a8b513fa.jpg" style="cursor:pointer;" id="del~47788~5643" class="del">[x]</a>&nbsp;&nbsp; <br> show image: yes <input type="radio" name="display_47788" id="display_1_47788" checked="checked" value="1" title="check radio show image on front end screen"> &nbsp;&nbsp; no <input type="radio" name="display_47788" id="display_0_47788" value="0" title="check radio not show image on front end screen"> <br> <br> <select name="submitter_47788" id="submitter_47788"> <option value="none" selected="selected">(select one)...</option> <option value="cdm" selected="selected">cdm</option> </select> <br> header image&nbsp;&nbsp; <select name="headerimage_47788" id="headerimage_47788"> <option value="0" selected="selected">no</option> <option value="1" >yes</option> </select></td> <td height="30" valign="middle" class="dropdownb"><a class="zoom2" rel="group" title="bigger image" href="/small/5643-hydrangeas_b1ae8a300e.jpg"> <img src="/small/5643-hydrangeas_b1ae8a300e.jpg" border='0'></a><br> <a title="delete image - 5643-hydrangeas_b1ae8a300e.jpg" style="cursor:pointer;" id="del~47789~5643" class="del">[x]</a>&nbsp;&nbsp; <br> show image: yes <input type="radio" name="display_47789" id="display_1_47789" checked="checked" value="1" title="check radio show image on front end screen"> &nbsp;&nbsp; no <input type="radio" name="display_47789" id="display_0_47789" value="0" title="check radio not show image on front end screen"> <br> <br> <select name="submitter_47789" id="submitter_47789"> <option value="none" selected="selected">(select one)...</option> <option value="cdm" selected="selected">cdm</option> </select> <br> header image&nbsp;&nbsp; <select name="headerimage_47789" id="headerimage_47789"> <option value="0" selected="selected">no</option> <option value="1" >yes</option> </select></td> <span class="dropdownb"> </tr> </span> <td height="30" valign="middle" class="dropdownb"><a class="zoom2" rel="group" title="bigger image" href="/small/5643-jellyfish_bfeb8f8d8f.jpg"> <img src="/small/5643-jellyfish_bfeb8f8d8f.jpg" border='0'></a><br> <a title="delete image - 5643-jellyfish_bfeb8f8d8f.jpg" style="cursor:pointer;" id="del~47790~5643" class="del">[x]</a>&nbsp;&nbsp; <br> show image: yes <input type="radio" name="display_47790" id="display_1_47790" checked="checked" value="1" title="check radio show image on front end screen"> &nbsp;&nbsp; no <input type="radio" name="display_47790" id="display_0_47790" value="0" title="check radio not show image on front end screen"> <br> <br> <select name="submitter_47790" id="submitter_47790"> <option value="none" selected="selected">(select one)...</option> <option value="cdm" >cdm</option> </select> <br> header image&nbsp;&nbsp; <select name="headerimage_47790" id="headerimage_47790"> <option value="0" selected="selected">no</option> <option value="1" >yes</option> </select></td> <td height="30" valign="middle" class="dropdownb"><a class="zoom2" rel="group" title="bigger image" href="/small/5643-koala_3bf9d36d8f.jpg"> <img src="/small/5643-koala_3bf9d36d8f.jpg" border='0'></a><br> <a title="delete image - 5643-koala_3bf9d36d8f.jpg" style="cursor:pointer;" id="del~47791~5643" class="del">[x]</a>&nbsp;&nbsp; <br> show image: yes <input type="radio" name="display_47791" id="display_1_47791" checked="checked" value="1" title="check radio show image on front end screen"> &nbsp;&nbsp; no <input type="radio" name="display_47791" id="display_0_47791" value="0" title="check radio not show image on front end screen"> <br> <br> <select name="submitter_47791" id="submitter_47791"> <option value="none" selected="selected">(select one)...</option> <option value="cdm" selected="selected">cdm</option> </select> <br> header image&nbsp;&nbsp; <select name="headerimage_47791" id="headerimage_47791"> <option value="0" selected="selected">no</option> <option value="1" >yes</option> </select></td> <td height="30" valign="middle" class="dropdownb"><a class="zoom2" rel="group" title="bigger image" href="/small/5643-lamborghini-82a_05f51070ab.jpg"> <img src="/small/5643-lamborghini-82a_05f51070ab.jpg" border='0'></a><br> <a title="delete image - 5643-lamborghini-82a_05f51070ab.jpg" style="cursor:pointer;" id="del~47792~5643" class="del">[x]</a>&nbsp;&nbsp; <br> show image: yes <input type="radio" name="display_47792" id="display_1_47792" checked="checked" value="1" title="check radio show image on front end screen"> &nbsp;&nbsp; no <input type="radio" name="display_47792" id="display_0_47792" value="0" title="check radio not show image on front end screen"> <br> <br> <select name="submitter_47792" id="submitter_47792"> <option value="none" selected="selected">(select one)...</option> <option value="cdm" >cdm</option> </select> <br> header image&nbsp;&nbsp; <select name="headerimage_47792" id="headerimage_47792"> <option value="0" selected="selected">no</option> <option value="1" >yes</option> </select></td> <td height="30" valign="middle" class="dropdownb"><a class="zoom2" rel="group" title="bigger image" href="/small/5643-lighthouse_5d01293fff.jpg"> <img src="/small/5643-lighthouse_5d01293fff.jpg" border='0'></a><br> <a title="delete image - 5643-lighthouse_5d01293fff.jpg" style="cursor:pointer;" id="del~47793~5643" class="del">[x]</a>&nbsp;&nbsp; <br> show image: yes <input type="radio" name="display_47793" id="display_1_47793" checked="checked" value="1" title="check radio show image on front end screen"> &nbsp;&nbsp; no <input type="radio" name="display_47793" id="display_0_47793" value="0" title="check radio not show image on front end screen"> <br> <br> <select name="submitter_47793" id="submitter_47793"> <option value="none" selected="selected">(select one)...</option> <option value="cdm" >cdm</option> </select> <br> header image&nbsp;&nbsp; <select name="headerimage_47793" id="headerimage_47793"> <option value="0" selected="selected">no</option> <option value="1" >yes</option> </select></td> <span class="dropdownb"> </tr> </span> <td height="30" valign="middle" class="dropdownb"><a class="zoom2" rel="group" title="bigger image" href="/small/5643-penguins1_714bcabe16.jpg"> <img src="/small/5643-penguins1_714bcabe16.jpg" border='0'></a><br> <a title="delete image - 5643-penguins1_714bcabe16.jpg" style="cursor:pointer;" id="del~47794~5643" class="del">[x]</a>&nbsp;&nbsp; <br> show image: yes <input type="radio" name="display_47794" id="display_1_47794" checked="checked" value="1" title="check radio show image on front end screen"> &nbsp;&nbsp; no <input type="radio" name="display_47794" id="display_0_47794" value="0" title="check radio not show image on front end screen"> <br> <br> <select name="submitter_47794" id="submitter_47794"> <option value="none" selected="selected">(select one)...</option> <option value="cdm" selected="selected">cdm</option> </select> <br> header image&nbsp;&nbsp; <select name="headerimage_47794" id="headerimage_47794"> <option value="0" selected="selected">no</option> <option value="1" >yes</option> </select></td> <td height="30" valign="middle" class="dropdownb"><a class="zoom2" rel="group" title="bigger image" href="/small/5643-sameera-reddy-77a_1c7f77be41.jpg"> <img src="/small/5643-sameera-reddy-77a_1c7f77be41.jpg" border='0'></a><br> <a title="delete image - 5643-sameera-reddy-77a_1c7f77be41.jpg" style="cursor:pointer;" id="del~47795~5643" class="del">[x]</a>&nbsp;&nbsp; <br> show image: yes <input type="radio" name="display_47795" id="display_1_47795" checked="checked" value="1" title="check radio show image on front end screen"> &nbsp;&nbsp; no <input type="radio" name="display_47795" id="display_0_47795" value="0" title="check radio not show image on front end screen"> <br> <br> <select name="submitter_47795" id="submitter_47795"> <option value="none" selected="selected">(select one)...</option> <option value="cdm" selected="selected">cdm</option> </select> <br> header image&nbsp;&nbsp; <select name="headerimage_47795" id="headerimage_47795"> <option value="0" selected="selected">no</option> <option value="1" >yes</option> </select></td> <td height="30" valign="middle" class="dropdownb"><a class="zoom2" rel="group" title="bigger image" href="/small/5643-tulips_f832f5324b.jpg"> <img src="/small/5643-tulips_f832f5324b.jpg" border='0'></a><br> <a title="delete image - 5643-tulips_f832f5324b.jpg" style="cursor:pointer;" id="del~47796~5643" class="del">[x]</a>&nbsp;&nbsp; <br> show image: yes <input type="radio" name="display_47796" id="display_1_47796" checked="checked" value="1" title="check radio show image on front end screen"> &nbsp;&nbsp; no <input type="radio" name="display_47796" id="display_0_47796" value="0" title="check radio not show image on front end screen"> <br> <br> <select name="submitter_47796" id="submitter_47796"> <option value="none" selected="selected">(select one)...</option> <option value="cdm" >cdm</option> </select> <br> header image&nbsp;&nbsp; <select name="headerimage_47796" id="headerimage_47796"> <option value="0" selected="selected">no</option> <option value="1" >yes</option> </select></td> <input type="hidden" name="mainid" value="5643" id="mainid"> <input type="hidden" name="updmode" id="updmode" value="codes"> <tr> <td colspan="4" align="left"><input type="button" name="update" value="update" class="mychecks" ></td> </tr> </table> </form> </div> </body> </html>

after submit info via ajax, reload dom $('.mychecks') , other direct element references useless because deleted them saying $('#reloadimages').load(...)

to prepare this, replace of $('selector').event() $(document).on('event', 'selector', function() {...}); , same non-event ones utilize .find('selector') instead of .on('event'...etc) of course.

example:

$(".mychecks").click(function(e) {

turns into

$(document).on('click', '.mychecks', function(e) {

and this

$("#frmimages").serialize();

can this

$(document).find('#frmimages').serialize();

you should upgrade jquery more current (at to the lowest degree >1.7) functionality give here. can replace event ones .delegate() @ point .on() has superseded it.

however

i must advise against of this (even if works) because method very sloppy , lead someone's browser crashing on old pc, etc. need update each element individually , instead of grabbing whole webpage using ajax, grab actual data needed using json or other manageable format.

this create life much simpler , info manipulation , display snap you.

javascript jquery ajax

javascript - Priority and hierarchy of execution of services in angularjs -



javascript - Priority and hierarchy of execution of services in angularjs -

what priority of services in angularjs , order of execution? please explain concepts below examples: service, provider, factory, config, controller, constant, value , run execute first, sec , on.

thanks in advance.

it's easy see hierarchy of execution playing console.log(). can see in this snippet, execution order is:

=> run => factory => service => provider

run gets executed after injector created , used kickstart application. it's closest thing main method in angular.

the illustration contains other angularjs components too, showing order of execution in general. check out console more details. code below same 1 in js bin, maybe you'll find more convenient analyze here.

class="snippet-code-js lang-js prettyprint-override">angular.module('app', []); /* * configuration blocks - executed during provider registrations , configuration phase. providers , constants can injected configuration blocks. prevent accidental instantiation of services before have been configured. */ angular.module('app').config(function(){ console.log('1. config: cannot inject $rootscope here'); }); /* * run blocks - executed after injector created , used kickstart application. instances , constants can injected run blocks. prevent farther scheme configuration during application run time. */ angular.module('app').run(function($rootscope){ console.log('2. run: close "main" method'); $rootscope.counter = 1; $rootscope.components = []; $rootscope.components.push({ 'name': 'run', 'order': $rootscope.counter }); }); /* * controller - scope-augmenting constructor */ angular.module('app').controller('ctrl', function($rootscope, factory, service, provider) { console.log('7. controller: set initial state & add together behavior $scope'); $rootscope.counter ++; $rootscope.components.push({ 'name': 'controller', 'order': $rootscope.counter }); }); /* * directive - used attach specified behavior dom element */ angular.module('app').directive('directive', function($rootscope) { console.log('3. directive: utilize manipulate dom'); $rootscope.counter ++; $rootscope.components.push({ 'name': 'directive', 'order': $rootscope.counter }); homecoming { controller: function() { console.log('* directive controller'); }, compile: function(){ console.log('* directive compile'); homecoming { pre: function(){ console.log('* directive pre link'); }, post: function(){ console.log('* directive post link'); } }; } }; }); /* * filter - formats value of look display user. */ angular.module('app').filter('low', function($rootscope) { homecoming function filteroutput(input) { console.log('8. filter: utilize format value'); $rootscope.counter ++; $rootscope.components.push({ 'name': 'filter', 'order': $rootscope.counter }); homecoming input.tolowercase(); }; }); /* * mill - mill recipe constructs new service using function 0 or more arguments */ angular.module('app').factory('factory', function($rootscope) { console.log('4. mill - before controller'); $rootscope.counter ++; $rootscope.components.push({ 'name': 'factory', 'order': $rootscope.counter }); homecoming 'factory'; }); /* * service - service recipe produces service value or mill recipes, invoking constructor new operator. */ angular.module('app').factory('service', function($rootscope) { console.log('5. service - before controller'); $rootscope.counter ++; $rootscope.components.push({ 'name': 'service', 'order': $rootscope.counter }); homecoming 'service'; }); /* * provider - provider recipe core recipe type , other recipe types syntactic sugar on top of it. */ angular.module('app').factory('provider', function($rootscope) { console.log('6. provider - before controller'); $rootscope.counter ++; $rootscope.components.push({ 'name': 'provider', 'order': $rootscope.counter }); homecoming 'provider'; }); class="snippet-code-html lang-html prettyprint-override"><link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css" rel="stylesheet"/> <script src="//ajax.googleapis.com/ajax/libs/angularjs/1.3.2/angular.js"></script> <section ng-app="app" ng-controller="ctrl" class="jumbotron"> <ul directive> <li ng-repeat="item in components | orderby:'order'"> <b>{{item.order}}</b> => {{item.name}} </li> </ul> <p>a quick overview of {{'angular flow' | low}}.</p> </section>

javascript angularjs html5 angular-services

javascript - why save value come "null" (trying to save image in encode64)? -



javascript - why save value come "null" (trying to save image in encode64)? -

i trying save image in encoded64 , value of image local storage .but getting null value why ?

here fiddle: http://jsfiddle.net/sah8w/7/

function getbase64image(img) { // create empty canvas element var canvas = document.createelement("canvas"); canvas.width = img.width; canvas.height = img.height; // re-create image contents canvas var ctx = canvas.getcontext("2d"); ctx.drawimage(img, 0, 0); // data-url formatted image // firefox supports png , jpeg. check img.src // guess original format, aware using "image/jpg" // re-encode image. var dataurl = canvas.todataurl("image/png"); seek { localstorage.setitem("elephant", dataurl); } grab (e) { alert('error') console.log("storage failed: " + e); } //return dataurl.replace(/^data:image\/(png|jpg);base64,/, ""); }

this minor alter prepare issue:

$('#save').click(function(){ var image = new image(); image.src = "https://dl.dropboxusercontent.com/s/t2ywui846zp58ye/plus_minus_icons.png?m="; getbase64image(image); }) working fiddle: http://jsfiddle.net/robertrozas/sah8w/15/ update(get button): http://jsfiddle.net/robertrozas/sah8w/17/

javascript jquery

PowerShell Global variables local variables -



PowerShell Global variables local variables -

i have global variables , want utilize them in function.

i don't utilize local variables same name within functions!

class="lang-powershell prettyprint-override"># global vars: $var1 = @{ .. } $var2 = @( .. ) function testing{ $var1.keyx = "kjhkjh" $var2[2] = 6.89768 }

i , works, safe or have use:

class="lang-powershell prettyprint-override">$global:var1.keyx = "kjhkjh"

thanks, gooly

in function, modifying contents of hashtable there no need utilize $global unless function (or function caller between function , global scope) happens have local variables $var1 , $var2 (btw aren't missing $). if own code i'd leave is. however, if code allows other folks' code phone call function, utilize $global:var1 specifier create sure you're accessing global variable , not inadvertently accessing variable of same name within function calling function.

another thing know dynamic scoping in powershell when assign value variable in function , variable happens global e.g.:

$someglobal = 7 function foo { $someglobal = 42; $someglobal } foo $someglobal

powershell "copy-on-write" operation on variable $someglobal within function. if intent modify global utilize $global: specifier:

$someglobal = 7 function foo { $global:someglobal = 42; $someglobal } foo $someglobal

powershell global-variables

javascript - How to in-place edit boolean value with x-editable -



javascript - How to in-place edit boolean value with x-editable -

i want display boolean value on page (actually it'll cells in table), , has editable. furthermore, it's not checkbox, spell out "false" , "true". utilize bootstrap 3, , latest knockout. decided utilize x-editable bootstrap 3 build. utilize knockout custom binding: https://github.com/brianchance/knockout-x-editable.

i figured implement need configure x-editable in popup mode, , select type. supply selections ("true" , "false" in case) in parameter. fine , dandy, except in-place dialog doesn't display current value when pops up. how can prepare that? tried 'defaultvalue' parameter, didn't help.

here fiddle: http://jsfiddle.net/csabatoth/7ybvh/4/

<span data-bind="editable: value, editableoptions: { mode: 'popup', type: 'select', source: '[{ value: 0, text: &#34;false&#34; }, { value: 1, text: &#34;true&#34; }]' }"> </span>

simple model:

function viewmodel() { var self = this; self.value = ko.observable(false); }

the problem have true , false boolean values in observable x-editable uses 0 , 1 values represent "true" , "false" selection.

this causes 2 problems:

when initialized x-editable not know "false" means 0 no default value selected if select in pop-up editor value observable contain "0" , "1" strings , not false , true boolean values...

you can solve both problems intoroducing computed property translates between boolean , numerical values:

self.computed = ko.computed({ read: function() { homecoming self.value() ? 1 : 0 }, write: function(newvalue) { self.value(newvalue == '1') } });

and need utilize property in editable binding:

<span data-bind="editable: computed, editableoptions: { mode: 'popup', type: 'select', source: '[{ value: 0, text: &#34;false&#34; }, { value: 1, text: &#34;true&#34; }]' }"> </span>

demo jsfiddle.

javascript knockout.js twitter-bootstrap-3 x-editable

Android TextureView OpenGLRenderer﹕ GL_INVALID_OPERATION -



Android TextureView OpenGLRenderer﹕ GL_INVALID_OPERATION -

i have 2 fragments has textureview show photographic camera preview or play video.

after using app while, playing screens, error in logcat

openglrenderer﹕ gl_invalid_operation

i release fragments, members set null.

@override public void ondestroyview() { logg.debug(tag, "ondestroyview"); super.ondestroyview(); if (mmediaplayer != null) { mmediaplayer.stop(); mmediaplayer.release(); mmediaplayer = null; } nextbutton = null; pausebutton = null; backbutton = null; playbutton = null; fronttextview = null; backtextview = null; surface = null; videoview = null; }

and see whole view become weird...

what missing?

your screenshot shows situation when scheme opengl context corrupted / broken. please check on thread release resouces. glcontext should destroyed same thread allocated. in case setsurface/setdisplay calls made wrong thread.

if have stable , easy steps reproduce can seek capture gl log using tracer opengl es, slows application a lot during capturing

android android-camera android-mediaplayer textureview

c# - Reading text file one line at a time -



c# - Reading text file one line at a time -

i have got text file number of commands parse through system. each line within text file command.

i read text file, 1 line @ time, each line command me deed on.

i have reached state lines read using streamreader.readline(), lines not read completely. within notepad, there appears nil wrong commands, , each 1 appears in 1 line supposed to.

however, when opening file notepad++, notice lf symbols within commands, instructs text editor start new command, so:

those lf misplaced (i.e. not want start new line when lf part of command). there way create streamreader interpret file notepad? there no line breaks in middle of commands within notepad.

if text 1 line skip using streamreader. instead can utilize

string sline = file.readalltext("test.txt"); sline = sline.replace("\n", "");

c# .net file stream ascii

aggregate - Multiple aggregation with arithmetic on LHS in R formula -



aggregate - Multiple aggregation with arithmetic on LHS in R formula -

anybody have bright ideas on how multiple aggregations such sum , mean arithmetic on left hand side of formula, this:

aggregate(a+b ~ c, data=d, fun=c(sum, mean))

i expect 3 column result c, mean(a+b) , sum(a+b).

i've looked @ summaryby 'doby' bundle fails arithmetic.

the closest i've found create custom function taking param , applying 2 aggregation functions within it, however, result still bit messy work there 2 columns, sec containing list both aggregations.

aggregate(a+b ~ c, info = d, fun=function(x) c(s=sum(x), m=mean(x)))

it's tedious, verbose , more computationally expensive doing 2 aggregations across same info , merging aggregations.

like this?

set.seed(1) d <- data.frame(a=rpois(100,1),b=rpois(100,1),c=rep(1:10,each=10)) result <- aggregate(a+b ~ c, info = d, fun=function(x) c(s=sum(x), m=mean(x))) result <- data.frame(result[,1],result[,2])

there indeed step 3-column info frame, not require multiple aggregation or merge.

incidentally, problem point out, regarding way aggregate(...) deals functions homecoming vectors, applies not formulas look on lhs.

result <- aggregate(a ~ c, info = d, fun=function(x) c(s=sum(x), m=mean(x)))

returns 2 column info frame, each element in sec column contains vector of length 2, if display result led believe result has 3 columns

head(result) # c a.s a.m # 1 1 11.0 1.1 # 2 2 13.0 1.3 # 3 3 8.0 0.8 # 4 4 10.0 1.0 # 5 5 12.0 1.2 # 6 6 7.0 0.7 str(result) # 'data.frame': 10 obs. of 2 variables: # $ c: int 1 2 3 4 5 6 7 8 9 10 # $ a: num [1:10, 1:2] 11 13 8 10 12 7 9 13 6 12 ... # ..- attr(*, "dimnames")=list of 2 # .. ..$ : null # .. ..$ : chr "s" "m"

r aggregate

javascript - How to find out what event is firing on what element -



javascript - How to find out what event is firing on what element -

is there tool (or in firebug) tell me events fired , more importantly on elements bound to?

i have number of javascript "includes", minified, not. experiencing odd behaviour want turn off, cannot find causing it.

i have form showing in "popup" , when seek click on 1 of input boxes, "popup" closes, event bind somewhere causing this.

the problem is, don't know element has spurious event bound it. problem occurs if click anywhere within popup (and on background mask covering rest of page, that's acceptable)

i using firefox, can type in console option. eventys in multiple javascript files done in various ways, through jquery, using inline attributes (eg. onclick="..."), using javascript.

i don't want go , add together line of code every possible event in every javascript file.

i have spent on hr trying hunt downwards dom element , have eliminated obvious ones divs containing popup , body tag.

dom modifications can tracked downwards using break on mutate option within firebug. can activated clicking related button ( ) within html panel. note script panel has enabled work.

there several other break on ... features, may help finding right position within code specific event.

furthermore firebug 2.0 introduced events side panel, displays events bound element selected within html panel. if libraries jquery used, allow investigate user-defined function wrapped library function in case enable alternative show wrapped listeners described in the reply related question.

javascript jquery firefox firebug

ruby on rails - Load Only Part of an Ember App at Once -



ruby on rails - Load Only Part of an Ember App at Once -

i building ember app , starting large. there way lazy loading of ember files take 10+ seconds load when user first hits site? illustration since have several logically separate modules part of site, load modules accessed. using ruby on rails , ember-rails gem.

if think ember doing render code, can understand why slow. suppose you're creating 2k view instances, , rendering 2k templates. templates part doing little. if don't care info binding.

for first stab, let's stop rendering through templates. code uses itemviewclass render each item custom view instead of view used internally each.

// utilize {{each item in items itemviewclass=app.spanview}} app.spanview = em.view.extend({ render: function(buffer) { buffer.push("<span>"+this.get('content')+"</span>\n"); } });

jsbin: http://jsbin.com/enapec/35/edit66

with render over-ridden, need interact render buffer ourselves.

even faster getting rid of view entirely. think there 2 ways this. create custom view render method loops on items, , pushes each element onto buffer. think given previous illustration can going yourself.

another simple alternative utilize helper. dumb helper more hard wire re-rendering when list changes, right solution.

// utilize {{eachinspan items}} em.handlebars.registerboundhelper('eachinspan', function (items) { homecoming ( new handlebars.safestring( items.map(function (i) { homecoming '<span>'+i+'</span>'; }) ) ); });

live jsbin: http://jsbin.com/enapec/34/edit

lastly, in jquery didinsertelement , afterrender queue. don't recommend though.

ember.renderbuffer gathers info regarding view , generates final representation. ember.renderbuffer generate html can pushed dom.

fyi here renderbuffer api

defined in

module : ember-views

i new bee got resource. thanks.

ruby-on-rails ember.js