Posts

Showing posts from September, 2011

javascript - images leave there place after on click -

Image
well there wiered issue website, don't know reason. have hyperlinks on images, when click on images, leave place. sharing screen shot better understanding. before click after click kindly tell me else have share. on't know reason not sharing css or js regards since fixed in comments i'll post here others know. when image starts jumping around when clicked means there border around active state. fix set : a:active{border: none!important;} //!important may overkill the same holds true if dances around when hover on it

winapi - Prevent splash-screen showing an icon in the start-bar -

for game project, found old win32 code on web display splash-screen, , noticed puts icon on start-bar. looks weird because when app creates own window, see icon in startbar disappear , reappear splash window destroyed , main app window created. is possible make splash-screen hwnd not shown on start-bar style or window class setting? for splash screens use these extendes window styles: ws_ex_toolwindow|ws_ex_topmost , these window styles: ws_popup|ws_visible no taskbar icon shows combination of styles.

Is it possible to write a complete research paper in R? -

i know using knitr 1 can generate reports, etc possible write complete paper in r? is, including diagrams, citation of referred works, heading styles, etc in microsoft word. asking non r research i.e. analyses done in r (for example road traffic engineering analyses) not related r or programming. i think citations , header styles seem problem. might want have @ brew package , in opinion better mixing output r (presentation) . think there tools render r objects specific formatting ( pander , xtable , stargazer , etc).

c - Can't get loop to stop running -

i trying write program rolls 2 dice, calculates number of rolls each side of dice, calculates actual , expected percents asks user roll again. however, loop wont ask user if want continue or stop looping after 5 rolls. not allowed use arrays yet. beginner. :) #include <stdio.h> #include <stdlib.h> #include <time.h> #include <math.h> int main(void) { int i; int number; float expected_percent; int val2=1, val3=1,val4=1,val5=1,val6=1,val7=1; int val8=1,val9=1,val10=1,val11=1, val12=1 ; int val; int rolldice; int roll_1, roll_2; float perc2, perc3, perc4, perc5, perc6, perc7, perc8; float perc9, perc10, perc11, perc12; float exp2, exp3, exp4, exp5, exp6, exp7, exp8, exp9; float exp10, exp11, exp12; char ans, y, y, n, n; srand(time(null)); do{ printf("how many times want roll dice ? \n \n "); scanf("%d/n/n",&number); (i = 0; < number; i++) { roll_1 = rand() %

sql - Can't check null value with these 2 ways C# datareader Null value Error -

the problem ; use code inside class , call class main form. got error datareader cant null value. how can check coming data sp not null. inside code if see null change , return outval (0000) public string opt() { string strng= ""; string outval= ""; sqlconnection conn = new sqlconnection(); conn.connectionstring = configurationmanager.connectionstrings["nmrbg"].connectionstring; conn.open(); sqlcommand cmd = new sqlcommand("nmp_sp_sy", conn); cmd.commandtype = commandtype.storedprocedure; sqldatareader rdr = cmd.executereader(); // if (rdr.hasrows) // { // while (rdr.read()) // { // int nm= rdr.getint32(0); // strng= convert.tostring(nm); // outval= strng; // } // } while (rdr.read()) { int nm= rdr.getint32(0); strng= convert.tostring(nm); outval= strng; } if (!rdr.hasrows) { outval= "0000"; } rdr.cl

excel vba - Looping through an array in VBA -

in sheet1, cell a1 have following text: a-b-c-d-e-f i need loop through text , have written following code works fine: dim w worksheet dim s variant dim p integer set w = worksheets(1) p = 0 each s in split(w.range("a1").value, "-") p = p + 1 msgbox split(w.range("a1").value, "-")(p - 1) next s the above code pops message box showing each of letters 1 after other, expected. but not happy repeating of split(w.range("a1").value, "-"), declaring array loop , once again every occurrence within loop. so have tried with: msgbox s.value but throws error object being requested. why can not use value property given "s" variant? you can this dim w worksheet dim s string set w = worksheets(1) each s in split(w.range("a1").value, "-") msgbox s next when assign object variant behaves object assigned , has properties present in object. in each split assigned stri

java.lang.ClassNotFoundException, although the class exists -

i got java.lang.classnotfoundexception : exception in thread "main" java.lang.noclassdeffounderror: consts/sortofpages @ java.lang.class.getdeclaredmethods0(native method) @ java.lang.class.privategetdeclaredmethods(unknown source) @ java.lang.class.getmethod0(unknown source) @ java.lang.class.getmethod(unknown source) @ sun.launcher.launcherhelper.getmainmethod(unknown source) @ sun.launcher.launcherhelper.checkandloadmain(unknown source) caused by: java.lang.classnotfoundexception: consts.sortofpages @ java.net.urlclassloader$1.run(unknown source) @ java.net.urlclassloader$1.run(unknown source) @ java.security.accesscontroller.doprivileged(native method) @ java.net.urlclassloader.findclass(unknown source) @ java.lang.classloader.loadclass(unknown source) @ sun.misc.launcher$appclassloader.loadclass(unknown source) @ java.lang.classloader.loadclass(unknown source) ... 6 more and class of sortofpages: package c

Magento: checkout doesn't work in Internet Explorer 10 with Windows 8 -

my magento working fine in following environment giving problem in checkout. (cart remain empty) operating system : windows 8 browser : ie 10 i have checkout http://demo.magentocommerce.com , not working. anyone has idea ? to resolve bug please follow following steps : login magento administration go system >> configuration >> general >> web >> session cookie management >> cookie lifetime increase cookie life time refresh cache now bug resolved.

c# - Deep copy of a List -

this should simple problem solve i've tried several ways of doing results same. i'm trying copy list containing gameobjects list. problem seems i'm copying references since changes done gameobjects of original list, affect ones on new list, don't want happen. i've read i'm doing shallow copy instead of deep copy, tried use following code clone each object: public static class objectcopier { /// <summary> /// perform deep copy of object. /// </summary> /// <typeparam name="t">the type of object being copied.</typeparam> /// <param name="source">the object instance copy.</param> /// <returns>the copied object.</returns> public static gameobject clone<gameobject>(gameobject source) { if (!typeof(gameobject).isserializable) { throw new argumentexception("the type must seria

php - Connetions with another database and server on subquery -

how can connect db1 , server1 sub query ? thanks! $link1 = mysql_connect("server1","user1","pas1"); mysql_select_db('db1', $link1); $link2 = mysql_connect("server2","user2","pas2") or die(mysql_error()); mysql_select_db("db2", $link2) or die(mysql_error()); $sql="select db2.`e`.`entity_id` , db2.a.value klantnr, db2.b.value voornaam,db2.c.value achternaam, db2.`t`.`value` telfnr, db2.ce.email db2.`tablename` e left outer join db2.customer_entity_varchar on db2.a.entity_id = db2.e.parent_id , db2.a.attribute_id = '133' db2.ce.email not in(select db1.email_addresses.email_address db1.tablename) , db2.a.value in (select db1.accounts_cstm.custid_c db1.accounts_cstm ) group db2.ce.email"; $result = mysql_query($sql,????) or die(mysql_error()); i have solution (way) error(operand should contain 1 column(s)) $link1 =mysql_connect("server1","user1","pas1&

android - Unable to load libavcodec -

i've compiled ffmpeg on ubuntu using gcc-arm-linux-androideabi , ndk , copied resulting directories android project (jni) on windows. in android make file, i've declared following: local_path := $(call my-dir) ffmpeg_dir := ffmpeg include $(clear_vars) local_module =: libavcodec local_src_files := $(ffmpeg_dir)/lib/$(local_module).a local_export_c_includes := $(local_path)/include include $(prebuilt_static_library) the project builds fine, call system.loadlibrary("libavcodec") , following exception gets thrown: unsatisfiedlinkerror [...] findlibrary returned null [...] what wrong in here? edit i noticed make returned following: make.exe: nothing done `all'. what mean?

c# - on_click event and timeout server -

the context : working on website/wep app in company containing page used send 280 e-mails users. all working fine in test server on production server got timeout in middle of function (it take 5 min send everything) users received mail, others no. in test server, working , 1 received mails, no error, no exception, no timeout. by looking @ of our site has same functionality using same code, i saw @ beginning of pageload : server.scripttimeout = 600 the question : my function sending mail looks : onclick() { foreach() { sendmail() } } as foreach takes 5 min iterate entirely, possible on_click event button trigs timeout ? thanks helping note : it's custom button whith confirmmessage block page until event clic over. note 2 : don't see problem in code since important sending part copied on 1 of our working application, tried code while commenting message.send() function , there no problem @ all. problem our mail address in database c

python - Decorators influencing sys._getframe(1) -

a.py import d d.funcme('blah') d.py import sys import errors def argcheck(in_=(), out=(type(none),)): def _argcheck(function): # here def __argcheck(*args, **kw): print '+++++++++ checking types before calling func' # here res = function(*args, **kw) return res return __argcheck return _argcheck @argcheck((str)) <----- def funcme(name): try: f = sys._getframe(1) except valueerror, err: raise errors.usererror(err) # stack deep filename, lineno = f.f_globals['__name__'], f.f_lineno print filename, lineno output without argcheck decorator (comment out @argcheck((str)) ): $ python a.py __main__ 3 output argcheck decorator: $ python a.py +++++++++ checking types before calling func defines 9 questions: what's decorator doing it's changing values _getframe ? how can preserve information captures

expandablelistview - Having trouble with scroll in 3-level expandable list view Android -

i have 3-level expandable list view. , pull refresh control on top of list view. now, when try browse list top bottom, pull refresh menu detected. instead of appearing on first cell of list, may appear on cell browsing top bottom. please refer screenshot

weird number conversion in Java -

i testing , calling stringtokenizer , getting weird conversion... forget fact should delimiting \ in "\7767546" i'm curious what's \11 until \77 in java here code: string path = "c:\\temp\\\\7800000\7767546.pdf"; string delimeter = "\\"; string[] values = new string[3]; int counter = 0; stringtokenizer st = new stringtokenizer(path,delimeter); while(st.hasmoretokens()){ values[counter] = st.nexttoken(); system.out.println(" values[counter]" + values[counter]); ++counter; } here's output: values[counter]c: values[counter]temp values[counter]7800000?67546.pdf if notice, \77 in original string became ? .....is unicode thing? as java language specification states octalescape: \ octaldigit \ octaldigit octaldigit \ zerotothree octaldigit octaldigit octaldigit: 1 of 0 1 2 3 4 5 6 7 zerotothree: 1 of 0 1 2 3 the following string or character lite

ios - UIView mask transparent. -

Image
i use cashapelayer create filled circle (image #1). now mask circle smaller circle, looks image #2. later animate filling (image #3) circle reducing scale of mask. how can achieve this? i'm not sure how correct following approach is; might better work calayer s directly... however, if views/layers you're working quite simple, following code might enough need. it's based around using subview inner/smaller circle - , animating transform property on uiview . just in case it's useful, here's link apple's doc on animating views . here's code: @implementation viewcontroller { uiview* _innercircleview; } - (void)viewdidload { [super viewdidload]; uiview* outercircleview = [[uiview alloc] initwithframe:cgrectmake(50, 50, 200, 200)]; uibezierpath* bigcircle = [uibezierpath bezierpathwitharccenter:cgpointmake(100, 100) radius:100 startangle:0 endangle:(m_pi * 2) clockwise:yes]; [bigcircle closepath]; casha

c# - Calling a user control from a back end page -

i have input text box , button runs on myapppage.aspx , when user clicks button want populate user control page. how call control in embedded usercontrol.ascx file in .net? you can provide public property in usercontrol exposes control controller (f.e. page ). since you've mentioned literal control: public string text { get{ return myliteral.text; } set{ myliteral.text=value; } } now can use page: myusercontrol.text = "hello world"; i provide as necessary. not return control itself. still change control type without breaking code. example if want replace literal textbox or label .

How would I repeat a block of code in Javascript? (asking users for a username and password) -

i want have repeat function around bit of javascript code: <script language="javascript"> var usernamecheck="username"; var passcheck="password"; var username=prompt ('enter username',' '); var password=prompt ('enter password',' '); if (username+password==usernamecheck+passcheck) ; else {window.location="http://www.google.com";} </script> i want bit of code repeat 3 times if user inputs incorrect username or password in. i want inform user password or username have entered incorrect , tell them try again. when have had 3 tries sent webpage e.g." http://www.google.com " . how this? (please help) can't use loop? for example: <script language="javascript"> var usernamecheck="username"; var passcheck="password"; var username=prompt ('enter username',' '); var password=pro

vb.net - How to get text inside the quotation mark from string? -

i have string this: +cops:0,0,"xl",2 or +csq: "15",99 how can "xl" or "15" string. on second one, i've tried using replace , remove +csq: , ,99 can't on first one. for first string use string.split split on commas string.trim remove quotes: dim line = "+cops:0,0,""xl"",2" ' split fields on comma dim fields = line.split(",") ' quote literal dim quote = """"c ' use trim remove quotes dim value = fields(2).trim(quote)

sql - Get biggest tables and check if column exists in these tables (one query) -

i want list biggest tables , check if tables have column logsys. like: db2 "select t.tabname,t.npages,(select count(c.colname) syscat.columns c c.tabname = t.tabname , c.colname = 'logsys') syscat.tables t t.tabschema = 'own' order t.npages desc fetch first 3 rows only" is way? there better way? the execution running without ending (or end days later... :-( ) the output should show if 1 of these biggest tables, has column named logsys (all tables should list in output of sql statement). this version might bit more efficient, since there can 1 column specified name in each table: select t.tabname, t.npages, case when exists (select 1 syscat.columns c c.tabname = t.tabname , c.tabschema = t.tabschema , c.colname = 'logsys') 1 else 0 end syscat.tables t t.tabschema = 'own' order t.npages desc fetch first 3 rows note both tabname , ta

javascript - Declarative 2D columns type dojo chart (custom axis label) -

i'm new dojo charting. i'm using dojo version 1.6. i need create 2d chart custom x axis labels. for have written below code <div dojotype="dojox.charting.widget.chart2d" id="chart1" style="width: 300px; height: 300px;" theme="dojox.charting.themes.miaminice"> <div class="axis" name="x" font="italic normal normal 8pt tahoma" fixupper="major" > <!-- --> </div> <div class="axis" name="y" vertical="true" fixupper="major" includezero="true" font="italic normal normal 8pt tahoma"><!-- --></div> <div class="plot" name="default" type="columns" markers="true" gap="4"><!-- --></div> <div class="action" type="tooltip"><!-- --></div> <div class="

python - Why does my Scrapy spider not run as expected? -

when run code below, end file has expected data second code block nothing first. in other words, of data eventlocation eventurl present nothing eventartist eventdetails. need modify working correctly? import urlparse scrapy.http import request scrapy.spider import basespider scrapy.selector import selector #from nt.items import nowtorontoitem scrapy.item import item, field class nowtorontoitem(item): eventartist = field() eventtitle = field() eventholder = field() eventdetails = field() eventlocation = field() eventorganization = field() eventname = field() eventaddress = field() eventlocality = field() eventpostalcode = field() eventphone = field() eventurl = field() class myspider(basespider): name = "ntspider" allowed_domains = ["nowtoronto.com"] start_urls = ["http://www.nowtoronto.com/music/listings/"] def parse(self, response): selector = selector(response) listi

php - foreach trying to make 3 parameters -

is there way make happen? foreach 3 paramaters something this foreach ($value $v,$value2 $v2,$value3 $v3) <?php echo $v->name?> <?php echo $v->actual?> <?php echo $v2->estimated?> <?php echo $v3->projected?> i think want foreach ($value $v) { foreach($value2 $v2) { foreach($value3 $v3) { echo $v->name; echo $v->actual; echo $v2->estimated; echo $v3->projected; } } } or: foreach ($value $v,$value2 $v2,$value3 $v3) { echo $v->name; echo $v->actual; } foreach($value2 $v2) { echo $v2->projected; } foreach($value3 $v3) { echo $v3->estimated; } which may have known, don't think it's possible put 3 1 you're asking. edit: bit more information on $value arrays contain, may easier provide solution can more accomplish you're trying do.

ios - Best way to parse comma separated list -

i receiving json packet server communicating with, 1 of requests has item in json array returnes string of comma separated strings. it looks when nslog json packet array. ( "\"completed\",\"uncompleted value\",\"damaged value\"", "", 0 ) i can access first item of json array this nsstring *firstjsonstring = [jsonarray objectatindex:0]; i parse best/most efficient way going store values coredata object. so question how can parse comma separated string? nsarray *items = [firstjsonstring componentsseparatedbystring:@","]; or nsarray *items = [firstjsonstring componentsseparatedbystring:@"\",\""]; and delete \" first item , \" in last one

ruby - Link tag in Sinatra -

ok, brand new ruby , sinatra , embarrassed cannot life of me find out how use link tag in sinatra. need link, index.erb, static page, about.html. <a href="about.html">about</a> not working. how can this? lot! i think you're looking like: <a href="/about.html">about</a> you're going want locate about.html file in /public folder of application. if want overwrite using location one, can :public_folder , described at: http://www.sinatrarb.com/configuration.html i hope helps.

c++ - Providing Q_PROPERTY in subclass of Q_OBJECT result in Error 1 -

i need solving following problem: i have base class, derives qobject , has q_object macro. in class want subclass base class , provide properties use in qml ( q_property ). but seems missing basic piece of information, because cannot going baseclass: #ifndef a_h #define a_h #include <qobject> class a: public qobject { q_object q_property(qstring name read getname constant) ... subclass: #ifndef b_h #define b_h #include "classpath/a.h" class b: public { q_object q_property(qstring type read gettype write settype notify typechanged) ... furthermore have registered type qml qmlregistertype<b>("customclasses",1,0,"b"); in qml file creating b item b{ type: "b" } the error following: [debug/moc_b.cpp] error 1 not informative me , qt knowings if remove q_object macro geht cannot assign non-existent property type i hope 1 of can explain im doing wrong! thanks in advance! thanks hin

jQuery click on clone and in a window see/change name or delete -

i'm new in programming in jquery , need help. basically, far have code dragging toolbox , dropping clones. html: <div id="toolbox"> <div class="exponat" ></div> <div class="bluetooth" ></div> <div class="wall1" ></div> <div class="wall2" ></div> <div class="wall3" ></div> <div class="wall4" ></div> </div> <br> <div id="droppable"></div> jquery: $("#droppable").droppable({ // accept draggables #toolbox, // prevent cloning of draggables(inside drop event handler), // have been dropped inside #container accept: "#toolbox .exponat, #toolbox .bluetooth, #toolbox .wall1, #toolbox .wall2,#toolbox .wall3,#toolbox .wall4", drop: function (event, ui) { var $clone = ui.helper.clone(); if (!$clone.is('.inside-droppable'))

ssh commands and password requests in a bash script -

i trying make script sync folder on ssh connection. want sync local folder folder on ssh , perform ssh login. these 2 commands need enter same password , it's little annoying trying make script put password temporary variable , pass variable 2 spots requested. have. read -s -p "enter password: " mypassword && echo "$mypassword" | rsync -vz -r `~/desktop/market_maker/market_maker xxx@xxx.edu:~/281_projects && echo | "$mypassword" ssh xxx@xxx.edu` what ends doing gives me 3 password prompts , not work @ all. wrong script? consider using sshpass store password specific login. once installed can run command: sshpass -p 'password' ssh xxx@xxxx.edu to login server. think might functionality looking for. might consider setting rsync_password variable password in script. if want avoid storing password in script can prompt using: read -s rsync_password this store password duration of scripts execution.

computer algebra systems - Can I substitute using a symbolic equation in Sage? -

i using following map in sage: f = lambda x: sgn(x)*sgn(x); which evaluates f(x) = 0 x=0 , f(x)=1 x!=0 ; in symbolic results, sgn(x)^2 , sgn(x)^4 , sgn(x)^8 , etc. being treated unequal, though equal values of x . there way can substitute like: sgn(x)^2 == sgn(x)^4 == sgn(x)^8 for occurrences of these relations, , symbolic values of x ? i create new substitution rule every symbol, e.g. result.subs(sgn(c)^2 == sgn(c)^4).subs(sgn(d)^2 == sgn(d)^4)... and on, seems hard control. this perhaps dumb question me ask... nature of result 1 factor? sage: f(x) = sgn(x)^2 sage: f x |--> sgn(x)^2 sage: z = (1+f)^3 sage: z = z.expand() sage: z x |--> sgn(x)^6 + 3*sgn(x)^4 + 3*sgn(x)^2 + 1 sage: z.factor() x |--> (sgn(x)^2 + 1)^3 in case makes question moot, hopefully: sage: z.subs(sgn(x)^2==x) x |--> (x + 1)^3 not that subs, example.

c++ - C2679 compiler error constructing const int member variable from std::istream -

why can not construct integer member variable istream in code below? there way? #include <iostream> // std::cout #include <fstream> // std::ifstream class { public: a(std::istream& strm) : n(strm >> n) {} // error on line*** void get_number(std::istream& strm) { int a; strm >> a; std::cout << "you retrieved: " << << " stream\n"; } private: const int n; }; int main() { std::ifstream ifs ("test.txt", std::ifstream::in); a(ifs); // works int n; ifs >> n; std::cout << n; return 0; } here error message vs2008: 1>------ build started: project: stream_test, configuration: debug win32 ------ 1>compiling... 1>main.cpp 1>c:\cpp\stream_test\stream_test\main.cpp(7) : error c2679: binary '>>' : no operator found takes right-hand operand of type 'const int' (or there no acceptable conversion) 1&

How to write a complex average equation in android? -

i have application calculates 2 types of average, 1 simple, , second more complex , can't figure out how write equation of it. way have written how should calculated, error on syntax "{". equation should this: sum of values divided number of how many entered, result multiplied 3 plus value, , then, result divided 4. hope understood exactly. ! ! here my: equation: double total2 = {[(i + j + k + l + m + n + o + p + q + r)/numarvalori2] x 3 + r}/(double)4; happens when try calulate first average, not second !!! medii.java: package com.cngcnasaud.orar; import android.app.activity; import android.os.bundle; import android.view.view; import android.widget.*; public class medii extends activity { edittext txtnum1; edittext txtnum2; edittext txtnum3; edittext txtnum4; edittext txtnum5; edittext txtnum6; edittext txtnum7; edittext txtnum8; edittext txttotal; edittext txtnum10; edittext txtnum11; edittext txtnum12;

javascript - How to implement reliable smooth scroll for hash links -

i'm trying implement smooth scrolling on site when clicking anchor links (links hash, #something ). the problem can't figure out how implement without something not working properly. current solution i have several pages representing weeks headers each weekday, ( #1 , #2 , ...) , links them ( #1-marker , #1-marker , ...). since don't match, built-in browser scrolling disabled. use following script make them work both on load , on link clicks: $(function() { // handle anchor reference links $('a[href*=#]') .click(onanchorclick); // smooth school hash on load if in url if(location.hash) $(location.hash+'-marker') .smoothscroll(); }); function onanchorclick(event) { // scroll 0 if hash #top if(this.hash == '#top') { scrollto(0); return false; } // try smooth scroll. return true default behavior if hash // isn't on current page return $(this.hash+&

excel - Using Individual Columns to Map Data to a Table Array -

suppose have 2 columns, c1 , c2, each of contains real valued data. create two-dimensional table these columns each row specific range of values in c1 (e.g. 400-500) , each column specific range of values in c2 (e.g. 10-14). easy enough sorting c1 , c2 , determining reasonable ranges. key issue have third column c3 values fill table with. in particular, able select c3 , have check associated values in c1 , c2 , use information place value in appropriate cell @ intersection of 2 values of table. require vba? if understand correctly, c3 has (c1, c2) coordinates. original coordinates in c1 number in matrix non-overlapping range , e.g., c1 can 413 falls under range 401-500 in new matrix. possible without vba using vlookup data mapping , transformation. of course, method gets more , more complex, facilitate future reuse, amendments , readability, recommended use vba, simpler add comments , see algorithm @ work in continuous flow. if want avoid using vba, derive range i

lookahead - A regex for the last use of a word in a string -

i'm trying figure out how grab tail end of string using word delimiter, word can used anywhere in string. last use start grab. example: go office , pickup milk safeway tomorrow i want grab by tomorrow , not other by s this regex i'm trying make robust: $pattern = '/^(.*?)(@.*?)?(\sby\s.*?)?(@.*)?$/i'; i think negative lookahead it, i've never used 1 before thanks! i'm not sure other things have in regex for, here's 1 use: $pattern = '/\bby\s(?!.*\bby\b).*?$/i'; regex101 demo \b word boundary , match between \w , \w character or @ string beginning/end. by matches by literally. \s matches space (also matches newlines, tabs, form feeds, carriage returns) (?!.*\bby\b) negative lookahead , prevent match if there word by ahead. .*?$ remaining part of string till end of string.

javascript - Call function so this not needed -

i have application uses v8 javascript engine, , within add functions namespace objects execute lines of code database. contents of these functions need not have this added before every function call. following example code of problem var obj = {}; obj.method = function(a) { return a; } obj.executor = function() { return method(5); } obj.executor() referenceerror: method not defined var caller = function() { return method(5); } caller.call(obj) referenceerror: method not defined as can see, neither way allows me call method without first adding this . there way of executing function it's context set in such way this not need added? edit this did work in previous version of v8 engine, seems recent 1 not allowing now. "the client's write rules strings loaded database, , requirement (who knows why) need write function names , application sorts out scoping." if you're not running in strict mode, can use with statement. var obj = {}; ob

java: check if WGS84 point is within a polygon if not get the distance -

as mentioned in title i'm searching possibillity check if given point in wgs84-format within given polygon , if not want find shortest distance point polgon. maybe there exists library. thank help greetings check out java topology suite. has point in polygon function, , distance functions, among many others. check if point inside polygon doesn't matter coordinate system is. http://www.vividsolutions.com/jts/jtshome.htm http://en.wikipedia.org/wiki/jts_topology_suite if want convert 1 coordinate system another, have at: http://en.wikipedia.org/wiki/jts_topology_suite both of these libraries (jts in guise of c++ port, geos) form part of popular postgis extension postgres, if ever want move spatial analysis database.

Memory leak detection in C and Xcode -

say write plain c code using xcode 5. facilities xcode 5 have developer find/detect memory leaks (for c code)? heard there static analysis tool - come automatically xcode 5? how reliable is? in menu bar, product > profile window open, select leaks.

javascript - Load event of an element with a directive -

suppose have made new directive in angularjs attribute restriction, my-directive . suppose have following html code: <img src="..." my-directive /> now, load event of <img> triggered when code of my-directive executed , dom completly loaded, or when information of natively <img> tag loaded (for example src data, style, ...)? i want know information because want understand effect intercept load event inside code of directive. as comment mentions, you'll want use pre-compile link funciton, aided using ng-src instead of native src attribute, allows angular insert process. can interception prior compilation so: module.directive('interceptimg',function(){ //other functions on directive template , controller compile:{ return: { pre: function prelink(scope, ielement, iattrs, controller){ //you can listen/bind events here accessing ielement } } } }) check

calculus - R - how do I find the second derivative of a numeric array -

i have array of numeric data (as happens option call prices organized strike). i'd compute second deriviative in r. i able fit smooth curve e.g. call.lo <- loess(mid ~ strike, df.x, model=t) but stuck going differentiation. any appreciated, thanks. do want discrete second derivative ? mid <- 1:100; strike <- (1:100)^3 + 2*(1:100)^2 + 1:100 + 5 deriv <- function(x, y) diff(y) / diff(x) middle_pts <- function(x) x[-1] - diff(x) / 2 second_d <- deriv(middle_pts(mid), deriv(mid, strike)) smooth_second_d <- loess(second_d ~ midpts, data.frame(second_d = second_d, midpts = middle_pts(middle_pts(mid))), model = t) example: plot(middle_pts(middle_pts(mid)), deriv(middle_pts(mid), deriv(mid, strike))) i see 6x + 4 expected.

java - spring Aspectj within pointcut expression -

i tried add benchmarking aspect java app , configure using xml, reason can't within designator work. the aspect should work methods in components package , sub packages instead of aspect package (in order avoid endless loops). <aop:aspect id="aspectbenchmark" ref="benchmarkaspect" > <aop:around method="logaround" pointcut="within(com.app.components.**) &amp;&amp; !within(com.app.components.aspect.**)"/> </aop:aspect> </aop:config> btw, when changed pointcut expression "execution(@javax.ws.rs.post * *(..))" (just because wanted make sure have nothing wrong aspect class), worked... appreciated.

android - Remotely activate GPS function -

i asked question implementation of toast message when gps not enabled. of knew possible. is possible automatically activate gps function in background. when remotely activate application in background. can activate the gps phone aswell without other phone reporting user ? the situation this. we have project named parentalcontrol application. parent has able track child remotely. does have suggestion or ideas ... ? if of anyhelp code i'm using @ moment. import android.app.activity; import android.content.context; import android.location.location; import android.location.locationlistener; import android.location.locationmanager; import android.os.bundle; import android.widget.textview; import android.widget.toast; public class mainactivity extends activity { textview txtlat; textview txtlong; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_m

javascript - "Union" with "order by" and "limit" in sqlite not working -

i developing mobile application , store data offline uses local database using sqlite. in order synchronize local database remote database, querying last 10 favorites, , last 10 match. using following query: select user_id users is_favorite>0 order is_favorite desc limit 10 union select user_id users is_auto_match>0 order is_match desc limit 10 note below query working fine,which confirm there no error in local database: select user_id users is_favorite>0 union select user_id users is_auto_match>0 order not allowed inside compound queries; place allowed @ end of entire query, affects all records. to able use order 2 individial queries, have to use subqueries: select * (select user_id users is_favorite > 0 order is_favorite desc limit 10) union select * (select user_id users is_auto_match > 0 order is_match desc limit 10)