Posts

Showing posts from July, 2011

javascript - Same hover function for multiple paths in Raphael -

so i've got canvas , paths: var paper1 = raphael(10, 50, 960, 560); var mapshape1 = paper1.path("m339.098,175.503c0,0-55.555,58.823-16.34,75.163s227.451,49.02,227.451,49.02s67.321-25.49,47.713-50.98s-71.896-78.432-71.896-78.432l339.098,175.503z"); var mapshape2 = paper1.path("m548.902,306.876c0,0-209.15-32.026-228.758-46.405s-27.451-27.451-20.262-42.484s26.797-44.444,26.797-44.444l-41.83-86.928l-76.471,77.125c0,0-25.49,169.935,48.366,171.242s292.157-4.575,292.157-4.575v306.876z"); var mapshape3 = paper1.path("m296.614,86.614l38.562,83.66l194.771-7.843l75.817,81.7c0,0,130.066-84.967,73.203-118.301s503.15,48.706,463.935,51.974s296.614,86.614,296.614,86.614z"); and style them this: (i believe improved, there way paths @ once???) function style1(shape){ shape.attr({ "fill": "#33ccff", "stroke": "000000", "stroke-width": "5" }); } style1(map

c# - Iterating through object types in a list of parent type -

i trying iterate through list of objects , change ones match particular type. current code looks this. (platform extension of entity, , entities list of type entity) foreach (platform p in entities.oftype<platform>) { p.dostuff() } i getting error "foreach cannot opperate on 'method group'" anyone's help. :) alright : foreach (platform p in entities.oftype<platform>()) //will loop through object of platform type in entites.oftype<platform>()

c# - Need help finishing or rewriting this algorithm for navigating a Generic Collection -

i trying come code algorithm set current object based on whether or not user clicks "forward" button or "backward" button. public step currentstep { { return _currentstep; } set { if (_currentstep != value) { _currentstep = value; onpropertychanged("currentstep"); } } } private int currentstepindex { get; set; } private void nextstep() { currentstepindex++; gotostep(); } private void previousstep() { currentstepindex--; gotostep(); } private void gotostep() { var query = step in currentphase.steps ???? select step; currentstep = query.first(); } currentphase.steps observablecollection<step> steps {get; set;} . , in constructor class have means of setting default value property " currentstep " there 1 spring-board off of. given collection hoping use index of currentstep object stored in currentstepindex go

c# - A Star Search Algorithm -

here have query regarding star search algorithm. i'm building known 8 piece puzzle. game 9 places (1 empty) , have arrange tiles in correct order meet goal position. i need verify have written algorithm correctly can seek elsewhere in code issue. i believe algorithm correct because able solve first pre-set puzzle have created requires 1 move reach goal position. however, unable solve puzzles require more moves. i've tried work in 3 different ways , bring same issue. attempt 1: while (openlist.count() > 0) { puzzlenode currentnode; var orderedopenlist = openlist.orderby(puzzlenode => puzzlenode.getpathcost()); currentnode = orderedopenlist.first(); if (compare(currentnode.getpuzzle(), goalarray) == true) { //openlist.removeat(0); //poll break; // otherwise push currentnode onto closedlist & remove openlist } else

sql - MySQL - rand from the defined values -

i'm trying insert random values tables. don't want make new values totally random (like eg: random numbers or characters),i want take random value set of values defined earlier. example: defined values: xyz, abc, edf random value: abc i programming languages it's easy, in sql don't know, how store defined values , how take random value. put random values in table. then, can insert them 1 @ time doing: insert tables(val) select val randomtable order rand() limit 1 the order rand() limit 1 chooses random value list.

c# - Why can't I use format specifier on DataGrid Value? -

string foo = selectedrow.cells["foo"].value.tostring("d5"); gives me error of no overload method 'tostring' takes 1 arguments so had use string foo = selectedrow.cells["foo"].value.tostring().padleft(5,'0'); anyone can explain why? datagridviewcell.value of type system.object . object.tostring() method not take arguments. therefore, cannot provide format specifier.

Unchecked and runtime exceptions in java -

this question has answer here: difference between java.lang.runtimeexception , java.lang.exception 11 answers in java, have checked exceptions , unchecked exceptions. also, have runtime exceptions. question - runtime exceptions unchecked exceptions , unchecked exception runime excepions? means can these 2 words used interchangeably? all runtime exceptions (e.g. nullpointerexception) unchecked exceptions. since errors (e.g. stackoverflowerror) unchecked exceptions, not unchecked exceptions runtime exceptions. the java language specifications define unchecked exception: "the unchecked exception classes run-time exception classes , error classes."

Android: Activity onResume -

i have 2 activities, homework , closer. have song playing in homework when button pressed, media player pauses , closer opened. in onresume function homework, i'm trying start media player again no sound plays. can me out this? package com.cis.lab4; import java.io.ioexception; import android.media.mediaplayer; import android.os.bundle; import android.app.activity; import android.content.intent; import android.content.res.assetfiledescriptor; import android.view.menu; import android.view.view; import android.view.view.onclicklistener; import android.widget.button; public class homework extends activity { final mediaplayer mediaplayer = new mediaplayer(); int media_length; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_homework); setcontentview(r.layout.activity_homework); assetfiledescriptor afd; try { afd = getassets(

php - How to link new Sub Accounts in Twilio with Application SMS url -

i working on portal each new customer gets twilio sub account , phone number linked it, when creates account on portal. now want link these new phone numbers in new sub accounts twiml application in parent account, new numbers able use twiml application's voice , sms urls. i have studied twilio documentation , not able figure out way done. language: php twilio developer evangelist here! twiml applications scoped each sub account, cannot assign sub account's phone number use voice , sms urls associated twiml application not directly owned sub account. however, can create new twiml applications via rest api part of setup process create sub account, create new twiml application owned sub account , assign numbers purchase them.

javascript - jquery.data API and event binding[Unable to understand] -

please explain following snippet [read on internet , couldn't understand]: var $this = $(this); $this.data('key', $this); $this.on('click.key', function(e) { // }); i know jquery.data dumps in jquery cache can accessed via $.cache how can use key css selector when binding event. edit found out answer question. doesn't have data api, rather, more related event namespacing. jquery api reference here

c++ - What is causing deleted function error message? -

i have main program uses 2 templates classes trans , travel, , generates compilation error use of deleted function 'makecolor::makecolor() , , also: note: 'makecolor::makecolor()' implicitly deleted because default definition ill-formed . how can fix this? class travel: #include "trans.hpp" template<typename a, typename b, typename c> class travel { public: typedef trans<a, b> cartype; typedef trans<c, int> boattype; typedef typename cartype::newest newestcar; typedef typename boattype::newest newestboat; }; class trans: template<typename a, typename b> class trans { public: class newest; }; main program: #include "travel.hpp" #include "trans.hpp" travel<makecolor, makematerial, makesize> struct makecolor { cartype::newestcar model; // error }; int main(){ ... } makecolor not have default constructor because cartype::newestcar not have default cons

Finding a Prime Sieve Inconsistency in Python -

i'm attempting learn python , thought trying develop own prime sieve interesting problem afternoon. when required far, import version of sieve of eratosthenes found online -- it's used benchmark. after trying several different optimizations, thought had written pretty decent sieve: def sieve3(n): top = n+1 sieved = dict.fromkeys(xrange(3,top,2), true) si in sieved: if si * si > top: break if sieved[si]: j in xrange((si*2) + si, top, si*2): [****] sieved[j] = false return [2] + [pr pr in sieved if sieved[pr]] using first 1,000,000 integers range, code generate correct number of primes , 3-5x slower benchmark. give , pat myself on when tried on larger range, no longer worked! n = 1,000 -- benchmark = 168 in 0.00010 seconds n = 1,000 -- sieve3 = 168 in 0.00022 seconds n = 4,194,304 -- benchmark = 295,947 in 0.288 seconds n = 4,194,304 -- sieve3 = 295,947 in 1.443 seconds n = 4,194,305 -- benchmark = 295,947 in 3.154 second

debugging - How to Find out if Eclipse is running in debug mode -

Image
there lot of question/answers how detect code if eclipse running in debug mode; can't find source describes how user can find out if eclipse running in debug mode or not. have examined eclipse while running application find out if running application in debug mode or not, , can't find source explaining this. have gone through output messages in console, , again there nothing indicates if application running in debug mode. so, can please tell me how can find out if application running in eclipse running in debug mode or not. switch "debug" perspective , @ debug pane. if looks this, you're not debugging: and if looks this, debugging:

ruby - Disable HTML within XML escaping with Nokogiri -

i'm trying parse xml document google directions api. this i've got far: x = nokogiri::xml(googledirections.new("48170", "48104").xml) x.xpath("//directionsresponse//route//leg//step").each |q| q.xpath("html_instructions").each |h| puts h.inner_html end end the output looks this: head &lt;b&gt;south&lt;/b&gt; on &lt;b&gt;hidden pond dr&lt;/b&gt; toward &lt;b&gt;ironwood ct&lt;/b&gt; turn &lt;b&gt;right&lt;/b&gt; onto &lt;b&gt;n territorial rd&lt;/b&gt; turn &lt;b&gt;left&lt;/b&gt; onto &lt;b&gt;gotfredson rd&lt;/b&gt; ... i output be: turn <b>right</b> onto <b>n territorial rd</b> the problem seems nokogiri escaping html within xml i trust google, think sanitize further to: turn right onto n territorial rd but can't (using sanitize perhaps) without raw xml. ideas?

objective c - Why is second value (Null) when reading data from plist? -

Image
this problem makegameswith.us website , peeved penguin project. attempting modify read level data plist rather gamelayer.mm, first sprite data reads in expected second pass through while loop returns (null) sprite name. i've looked @ plist, both sprites should have same file name "tallblock". here relevant snippet of code: cclog(@"about load level data."); // load level data , draw level sprits nsstring *path = [[nsbundle mainbundle] pathforresource:@"level1" oftype:@"plist"]; nsdictionary *level = [nsdictionary dictionarywithcontentsoffile:path]; nsarray *levelblocks = [level objectforkey:@"blocks"]; // capitalization matters nsenumerator *enumerator = [levelblocks objectenumerator]; id object; nsstring *spritename; nsstring *spritefile; nsnumber *xpos; nsnumber *ypos; // 1 of sprite names invalid... while (object = [enumerator nextobject]) { spritename = [obj

javascript - How to set ExtJS window show/hide with animation? -

here sourcecode: ext.create('ext.window.window', { id:'edit_segtype_win', title:'msg', layout: 'fit', html:data, modal:true, resizable:false, constrain:true }).show(undefined,bind_ajax_success); when call show(...),the window show without animation. want add animation,such fadein/fadeout/slidein/slideout. can me? thank you! you can use anim object http://docs.sencha.com/extjs/4.2.0/#!/api/ext.fx.anim use in window component this: var mywindow = ext.create('ext.window.window', { html:"hello world", }); ext.create('ext.fx.anim', { target: mywindow, duration: 1000, from: { width: 400, //starting width 400 opacity: 0, // transparent color: '#ffffff', // white left: 0 }, to: { width: 300, //end width 300 height: 300 // end height 300 } }); and then, animation added when call window.show();

c# - How to disply a combination of text and looped vars in a foreach statement -

the following statement erring in mvc razor view. @foreach (var user in model.users) { <li><a href="#">add user</a></li> <li><a href="#">@user.firstname @user.lastname if(user.firstname != "") { @(@user.username) }else{ @user.username } </a></li> } i cannot seem figure out razor handle properly. most looking @if instead of if because starting html tag switches context "code" html , need switch "code". @foreach(... { <span>... @if(...) { <text>@user.username</text> } </span> }

ruby - How to run a system command, and pipe PID to pidfile? -

how run command , pipe resulting pid pidfile? i'm looking unix command, if there's way in ruby, that'd nice too. i tried: bundle exec clockwork clock_local.rb echo $! > #{current_path}/tmp/pids/clockwork.pid and seems pipe entire output pidfile rather pid. you can use ruby's begin {...} , end {...} automatically create , delete pid files. add these ruby script: begin { file.write("#{ $0 }.pid", $$) } end { file.delete("#{ $0 }.pid") } you test create simple pid file simple script like: begin { file.write("#{ $0 }.pid", $$) } end { file.delete("#{ $0 }.pid") } sleep 60 run it, then, while it's running check directory it's in pid file. after 1 minute, when sleep expires pid file should automatically disappear. those don't exception handling in case file isn't writable or if exists , locked. end fire off if script receives cntrl + c , automatically remove pid file. additional t

scala - Producer-Consumer: Should I synchronize read access -

consider producer-consumer problem, 1 producer , several consumers. consumers wait until told value has been produced. producer writes value , notifies consumers, read value. finally: consumers' , producer's termination synchronized using barrier. process repeats. question: should provide exclusive access (e.g. synchronized) reading value consumers (or writing producer?). know obvious answer is: "seriously? no!" want make sure not missing weird detail. if you're building concurrent application, recommend investigate akka. has offer , not trivial learn, pretty comprehensive far concurrency , distribution. for particular case, data-flow variables might suit needs (and free overt synchronization!)

java - Are compile time and class loading time the same? -

i asking question because in collection see arrays.sort() overloaded, wondering how can static method overloaded, when static methods loaded @ class loading time, , overloading performed after class loading time. my main question is: overloading , overriding performed after class loading time; that's why visible objects , invisible static parts. can static methods overloaded? compile time , class load time not same thing. , run time (in sense use term in following ...) different again. overload analysis performed @ compile time , both static , instance method calls. same true cases 1 static method shadows static method - resolved @ compile time . override dispatching (for instance methods) occurs @ run time ; i.e. when method call occurs, depending on actual object "target" object. why arrays.sort() overloaded , when static why shouldn't be? as said, both static , instance methods can overloaded. ( overriding restricted ins

c++ - Returning a pointer is not working fine -

when try display content of array via pointer returned function, program displays zeros. not sure missing. have tried check several times wrong, seem not have clue. using dev-c++. code bellow. appreciated. #include <iostream> #include <math.h> #include <cstdlib> #include <cstring> using namespace std; bool vowel(char c) { int i, val; char alphabet[52]={'a','a','b','b','c','c','d','d','e','e','f','f','g','g','h','h','i','i','j','j','k','k','l','l','m','m','n','n','o','o','p','p','q','q','r','r','s','s','t','t','u','u','v','v','w','w','x','x','y','y','z',&

Performing two replacements in Makefile with $(VAR:.x=.y) -

in makefile, observe can use pattern $(var:.x=.y) perform replacement, can perform 2 replacements in same call? specifically, wish modify rather long makefile written else, includes compiler flag -wa,-adhlns=$(<:.c=.lst) . since have both .c , .cpp files going under hammer single set of compiler flags, i'd apply foregoing replacement both extensions. (as is, .cpp files getting overwritten.) i've tried -wa,-adhlns=$($(<:.c=.lst):.cpp=.lst) , doesn't work. aim @ possible? you can't that, can this: $(addsuffix .lst,$(basename $(var))

html - Is it possible to do this "half strikethrough" using CSS (without using images) -

Image
i'm doing site without using images, make responsive , faster, css(3). i'm trying following effect using css i used using <div class="strikethrough"> <span>ou</span> </div> and css (using image): .strikethrough { background: url('strip.gif') repeat-x 50% 50%; } .strikethrough span { background: #eaebec; padding: 0 5px; display: inline-block; margin: 0 auto; } is possible same using css? <div style="height: 1px; text-align: center; background-color: black;"> <span style="position: relative; top: -0.5em; background-color: white;"> ou </span> </div> or <fieldset style="text-align: center; border: 0; border-top: 1px solid black;"> <legend> ou </legend> </fieldset>

unicode - How do I iterate through an UFT16 encoded string character by character? -

i have uft16 encoded string theuft16string . contains double byte characters. interate through unicode character unicode character. understand chunk expressions work single-byte characters? an example we have following string abcαβɣ we want iterate through , put each character on line of own in container. in livecode, there 2 ways character utf16 string. if string displayed in field, can do select char 3 of fld 1 and if have russian or polish text in field, correctly select 1 character. however, feature isn't developed in livecode , fail many chinese, japanese , arabic (and other) languages. therefore, better use bytes now: select byte 5 6 of fld 1 the latter compatible future versions of livecode, while former may not be. anyway, have string in variable, means have handle string bytes (you use chars, bytes , chars dealt in same way in case, because data in variable). can iterate through variable steps of two, i.e. 1 char @ time: repeat x = 1 nu

c - File write unexpected output -

i have made program copies text file file. result was, original file contents "this test" new file contents "this test" worked, commented part out , tried make output this. result wanted, original file contents "this test" new file contents, "t h s s t e s t" for reason output diagonal , messed up, sure because whitespace character messing up, tried check space, , not move next line when encounters whitespace. #include <stdio.h> int main(void){ file *fp = fopen("originalfile.txt", "r"); char buffer[81]; fgets(buffer, 81, fp); fclose(fp); //copies file /* file *fp2 = fopen("newfile.txt", "w"); fputs(buffer, fp2); fclose(fp2); */ //copies moves next line after each character file *fp2 = fopen("newfile.txt", "w"); int x; char z = '\n'; int = z; printf

Converting asp.net 4.0 application with MVC 4 -

i have application in asp.net, ado.net, oracle 11g my structure of application follow there business entity classes every entity in application employee entity contains a. name b. age etc i have written stored procedure fetch , insert every operation related database using ado.net. return list<> of business entities separate logic part. some of presentation logic split user-controls . using jquery-ajax load of component asynchronous load on pages. speed page. have used data-caching in project. not wanted move project mvc 4 better performance. idea move project asp.net mvc? i wanted know weather technically ok change mvc. i don't want change database logic written. so can use mvc? any suggestion on link provided help.

python - to keep the script running even after internet connection goes off -

i had putty on 1 server , run python script available on server. script keep on throwing output on terminal. later on, internet connection went off expecting script complete job script on running on server. when internet connection resumed, found script has not done job. expected ? if yes, make sure script runs on server though internet connection goes off in-between? thanks in advance !!! you should use screen let "detach" process actual terminal you're in.

linux - how to find out when the code reads parent or child process and how do they communicate in C -

Image
i have shell program fork created , used 2 if else statements separate parent , child process. my sample program here , got few questions while(true) { /* read command line input */ x = fork(); if( x > 0) { wait(&status); } else { /* run exec() command */ } } from above code statement execute first after fork , how parent know child exec command executed or unsuccessfully , when parent stop wait , in condition , how. , how wait(&status) code work. help appreciated. this should give better idea of how fork() system call works.

c++ - Why does the following validation code get stuck on the cin.ignore when I enter 1.w and go into an infinite loop when I enter w.1? -

why following validation code stuck on cin.ignore when enter 1.w , go infinite loop when enter w.1? trying create code validates numerical input. have created code suggestions given on other posts, i'm still having problems. //the code validation code used check if input numerical (float or integer). #include <iostream> #include <string> #include <limits> // std::numeric_limits using namespace std; int main () { string line; float amount=0; bool flag=true; //while loop check inputs while (flag){ //check valid numerical input cout << "enter amount:"; getline(cin>>amount,line); //use string find_first_not_of function test numerical input unsigned test = line.find_first_not_of('0123456789-.'); if (test==std::string::npos){ //if input stream contains valid inputs cout << "wow!" << endl; cout << "you entered " << line << endl; c

cocoa - mouseDragged: is not passed down two subviews? -

i writing program has number of subclassed nsviews (frame) varying contents can dragged around mouse in superview. of views contain 1 subview, called contentview, in turn can contain more complicated hierarchy. if have non-editable nstextfield contentview mousedown: , mousedragged: events passed on superview without problem , dragging works fine. mousedown: ---> [nstextfield] ---> [frame] mousedragged: ---> [nstextfield] ---> [frame] if contentview subclass of nsview in turn contains number of nstextfields mousedragged: event not passed on nstextfields superview. mousedown: ---> [nstextfield] ---> [subclassed nsview] ---> [frame] mousedragged: ---> [nstextfield] -x-> the mousedown: event received frame. clicking in gaps between nstextfields , dragging contentview directly works @ well. the nstextfields set in contentview: nstextfield *textfield = [[nstextfield alloc] initwithframe:rect]; [textfield setbordered:no]; [textfield setselec

Deploying struts2 + hibernate application using google app engine -

this quite cumbersome me now... i have developed application using struts2, , hibernate (mysql) , working fine apache tomcat. now want deploy on google app engine. reckon have convert java dynamic web project google web project. after doing so, when tested on google supplied server eclipse, not running. it's showing exceptions hibernate. first exception encountered jdbcexception: not able open connection . heard google app engine(gae) not support mysql. true? alternatives? by default, gae not use mysql or kind of relational database storing data, if want use relational database in application should go "google cloud sql". using can store data in relational database on cloud , can access gae based java application. both of services (gae , cloud sql) freely available there limitations also. free versions have limited storage. for more details, have : https://cloud.google.com/products/cloud-sql

php - How to check File integrity -

i'm developing app needs download, every minutes, files. using php, list files , java list , check file if present or not. once downloaded it, need check integrity because after download, files corrupted. try{ string path = ... url url = new url(path); urlconnection conn = url.openconnection(); conn.setdooutput(true); conn.setreadtimeout(30000); = conn.getinputstream(); readablebytechannel rbc = channels.newchannel(is); fileoutputstream fos = null; fos = new fileoutputstream(local); fos.getchannel().transferfrom(rbc, 0, 1 << 24); fos.close(); rbc.close(); } catch (filenotfoundexception e) { if(new file(local).exists()) new file(local).delete(); return false; } catch (ioexception e) { if(new file(local).exists()) new file(local).delete(); return false; } catch (ioexception e) { if(new file(local).exists()) new file(local).delete(); return false; } return false; what can use in

python - Open multiple files from file managers -

i've built (linux) gui application can launched terminal , accepts undefined number of files arguments. app reads sys.argv , lists name of these files in qlistwidget. the code like: import sys pyqt4.qtgui import qapplication, qmainwindow, qcoreapplication class mainwindow(qmainwindow): def __init__(self, parent=none): super(mainwindow, self).__init__(parent) # parse command line arguments in qcoreapplication.argv()[1:]: ... def main(): app = qapplication(sys.argv) ... what want able select multiple files file manager , open them app through "open with..." option provided file managers. how can achieved? with current code, when try 1 of selected files shown on qlistwidget. edit: it seems depends file manager. tried few file managers and... pcmanfm: opens 1 of selected files. spacefm: works properly! dolphin: opens each file different instance of program. if select 3 files open app 3 times, 1 each file.

Real time Google charts with MySql -

i'm doing little web-survey have form when submitted has data stored in mysql table. on same website have couple of google pie charts. easiest way data database , pass google javascript code? i've been told i'd need create php file stores data array , returns json string. there better way it? google query allow query google spreadsheets. if have mysql database, need use whatever method (php likely) return json object, , feed in google. there many ways this, please see documentation on datatable notation , how input data it.

plsql - Calling package's procedure from another procedure -

trying search couldn't find it. i have package name package_1 , in have multiple procedures/functions. want call 1 of these functions procedure, not part of package. can't put code in package (both on same schema). i trying this package_1.function_1(varchar_var_1, varchar_var_2, varchar_var_3); but giving me error. question2 above functions return object record type defined in package. how can declare object of type in procedure can assign response in procedure ? if function returns record type, you'd need declare local variable in caller of record type. like create or replace procedure your_procedure_name( <<parameters>> ) l_rec package_1.record_type; ... begin ... l_rec := package_1.function_name( p1, p2, p3 ); ... end; of course, assumes both record type , function defined in package spec public rather merely being defined private members of package defined in package body.

windows phone 8 - Pivot HeadTemplate alignment -

Image
here how pivot control looks on wp app. here code same. <phone:pivot> <!--pivot item one--> <phone:pivotitem> <phone:pivotitem.header> <contentcontrol> <image source="/assets/alarmclock.png"/> </contentcontrol> </phone:pivotitem.header> <grid> <textblock text="hello1"/> </grid> </phone:pivotitem> <!--pivot item two--> <phone:pivotitem > <phone:pivotitem.header> <contentcontrol> <image source="/assets/clock.png"/> </contentcontrol> </phone:pivotitem.header> <grid> <textblock text="hell

Java method to accept ArrayLists of different superclasses, must use Interface? -

i have method called findnearest used find nearest object point arraylist of objects. however want able call method arraylists of different classes superclasses of base class entity for example tree subclass of entity , worker . want able to findnearest(x,y,<arraylist of trees>) , findnearest(x,y,<arraylist of workers>) i think can achieve using interface, there simpler/cleaner way it? thanks duncan you need use covariance: void findnearest(int x, int y, arraylist<? extends entity> items) note won't able add list, since don't know type list supposed contain.

Running a runtime compiled C# script in a sandbox AppDomain -

my application should scriptable users in c#, user's script should run in restricted appdomain prevent scripts accidentally causing damage, can't work, , since understanding of appdomains sadly limited, can't tell why. the solution trying based on answer https://stackoverflow.com/a/5998886/276070 . this model of situation (everything except script.cs residing in named assembly). please excuse wall of code, not condense problem further. class program { static void main(string[] args) { // compile script codedomprovider codeprovider = codedomprovider.createprovider("csharp"); compilerparameters parameters = new compilerparameters() { generateexecutable = false, outputassembly = system.io.path.gettempfilename() + ".dll", }; parameters.referencedassemblies.add(assembly.getentryassembly().location); compilerresults results = codeprovider

MySQL: How to fetch all columns with distinct clause on one column with latest created record -

i have db table structure id, latitude, longitude, altitude, deviceid, createddate i trying create query fetches distinct deviceid has been created @ latest.. i have tried query select distinct deviceid `deviceposition` order createddate desc based on beiller's post, try solution: select deviceid, createddate `deviceposition` outer_dev_pos createddate = ( select max(inner_dev_pos.createddate) `deviceposition` inner_dev_pos inner_dev_pos.deviceid = outer_dev_pos.deviceid ) order createddate desc; update: explanation: we accessing same table 2 times in query, once in outer select , once in subselect (the inner select). therefor, necessary tell in query access' deviceid , createddata mean. important in clause of subselect: where inner_dev_pos.deviceid = outer_dev_pos.deviceid if didn't use alias names inner_dev_pos , outer_dev_pos 2 accesses of same table, line read: where deviceid = deviceid which not make sense.

Harris corner detection and localization in OpenCV with Python -

i'm using following code try detect corners of polylines in order 'measure' lines. code based on snippet found somewhere on so , based on cv2.cornerharris() : cornerimg = cv2.cornerharris( gray, # src 2, # blocksize 3, # ksize / aperture 0.04 # k # dst # bordertype ) # ? cornerimg = cv2.normalize( cornerimg, # src none, # dst 0, # alpha 255, # beta cv2.norm_minmax, # norm type cv2.cv_32fc1, # dtype none # mask ) # ? cornerimg = cv2.convertscaleabs( cornerimg ) cornershow = cornerimg.copy() # iterate on pixels

javascript - Why is my onclick script not changing my innerhtml? -

i have simple webpage took template. on right have list of links in div , when clicking on them want html page located on server load in inner div area. when clicking on link, nothing happens. i've tried setting innerhtml text value in case src part invalid, nothing. missing? looks examples i've gone through.. , note i'm giving partial html, know body isn't closed etc. i have: <body> <script> function results() { document.getelementsbyclassname('mid-left-container').innerhtml="src="..\vrs_bvt\vrs_test.html"" } </script> <div id="main-wraper"> <div id="top-wraper"> <div id="banner">automation server</div> </div> <div id="mid-wraper"> <div class="mid-wraper-top"> <div class="mid-leftouter"> <div class="mid-left-container">

jquery - why am I gettin an error passing fb accessToken to PHP via ajax? -

this question related bounty question didn't enough with. having trouble sending facebook notification via ajax call php i need pass accesstoken php via ajax. call getloginstatus in script, obtain access token response, , send include in post data ajax. it's giving me error though , don't know why. syntax problem? fb.getloginstatus(function(response) { if (response.status === 'connected') { var accesstoken = response.authresponse.accesstoken; console.log(accesstoken); $.ajax({ url : "http:/xxxxxxio/bn/notification.php", type : 'post', data: { token: accesstoken }, success : function (result) { console.log(result); }, error : function () { alert("error sending notification"); } }); } else if (response.status === 'not_authorized') { // user logged in facebook,

php - Sending variables to Bootstrap modal -

here php function: function displayrecords(){ $sql = "select * mytable"; $queryresult = @mysql_query($sql) or die (mysql_error()); // more code... at point, function prints out retuned data in table: echo "<table class='table table-striped table-bordered table-hover'>\n"; while(($row = mysql_fetch_assoc($queryresult)) !== false) { and here issue begins: echo "<tr><td><a class=\"open-editrow btn btn-primary btn-mini\" data-toggle=\"modal\" href=\"myeditmodal\" id=\"".$row[pk_tid]."\" title=\"edit row\" \">delete/edit</a></td>"; there more printed td tags after this, issue transferring id modal window. told done straight php , without javascript or ajax. this code looks in modal: <div class="modal hide fade" id="myeditmodal" tabindex="-1" role="dialog" aria-labelleby=&

vb.net - DateDiff doesn’t work with nullables -

i’m trying find difference between nullable dates. datediff(dateinterval.day, firstdate, seconddate) works date , not nullable(of date) . both dates nullable fields. this error message: overload resolution failed because no accessible datediff can called without narrowing conversion: public function datediff(interval string, date1 object, date2 object, [dayofweek microsoft.visualbasic.firstdayofweek = firstdayofweek.sunday], [weekofyear microsoft.visualbasic.firstweekofyear = firstweekofyear.jan1]) long : argument matching parameter interval narrows microsoft.visualbasic.dateinterval string . public function datediff(interval microsoft.visualbasic.dateinterval, date1 date, date2 date, [dayofweek microsoft.visualbasic.firstdayofweek = firstdayofweek.sunday], [weekofyear microsoft.visualbasic.firstweekofyear = firstweekofyear.jan1]) long : argument matching parameter date1 narrows date? date . public function datediff(interval microsoft.visualbasic.dateint

c# - Convert Word to HTML then render HTML on webpage -

i have tough project in pipeline , i'm not sure begin. boss wants ability display word document in html , same word document. after trying time after time let me show word document in pop or light box stuck on stripping out contents of word converting html saving in database , displaying html on webpage. can guys either give me ammo if showing word document better (less cumbersome, less storage space more secure etc). or if it's pretty easy convert word document html ways me that. the technologies current have entity framework, linq, mvc, c#, razor. we use htmlagilitypack, strips out of formatting , doesn't allow document show well. we use http://www.aspose.com/ (i think 1 use aspose words) perform s similar task, , works quite well. (there cost involved) i suggest converting html gives worst rendition of document. 1 solution use, generate jpeg image of document , display that. if need able perform operations find , copy/pasting text - recommen

Does Delphi XE2 correctly import WSDL from Java/Axis2 when function has no return value? -

i'm importing service delphi can test front end (delphi) end (java) , when go test server function following error: xml document must have top level element. line: 0 what have noticed function not have a return value (public void functionname) if switch boolean , return true, error no longer comes up. the function appears execute regardless of error message being there or not however. here's function being called (java): public void addnewuser(string facility, string username, string password, string status) { servicehelper.addnewuser(facility, username, password, status); } and corresponding call in delphi: procedure tform1.btnadduserclick(sender: tobject); begin getserviceporttype.addnewuser(lbledtfacility.text, lbledtusername.text, lbledtpassword.text, cbb1.text); end; i'm not comfortable answering saying 'try googling this' if you'

google chrome - passing data from contentscripts.js to popup.js via storage local -

i'm still busy first extension. want pass on data (an array) contentscripts.js popup.js. read in several sources easiest way using local storage. this tried: contentscripts.js (i don't know if 1 works) ... alert(isotopeindices[0]); // array isotopeindices has lots entries chrome.storage.local.set(isotopeindices[0]); //goal save whole array: chrome.storage.local.set(isotopeindices); popup.js chrome.storage.local.get( function(isotopeindices) { document.getelementbyid('selectisotopes').innerhtml = isotopeindices[0]; } ); my popup shows in <div id="selectisotopes">...</div> -element undefined. why think chrome.storage.local.set doesn't work @ all. concerning google-howto ( http://developer.chrome.com/extensions/storage.html ) should correct. even though question is, local storage simplest way pass data...? thanks time , help!!!

Python If/Else Completing If function but not Else -

having trouble if/else command in part of working. when script run complete if portion if name == check_file , if false skips else statement , moves next task. here portion of code isn't functioning properly: name in zip_file_names: copy_to = copy_this.get(name) if copy_to not none: source_file = os.path.join(r'\\svr-dc\ftp site\%s\daily' % item, name) destination = os.path.join(r"c:\%s" % item, copy_to) shutil.copy(source_file, destination) print name, "has been verified , copied." elif copy_to not none: print "%s has been completed." % item else: print "repoll %s %s" % (item, business_date_one) print "once information downloaded press key." re_download = raw_input(" ") ext_ver_cop_one() the final else file names unzipped not needed operation have pass them,

Pass custom property values to Open Graph Object in native Android app with Facebook SDK -

i creating own native android app facebook integration publish open graph stories. the publishing works fine, want include custom string property (wishdesc) (which user provided inside app) inside story post (e.g. description). how can that? tried this, before object/action gets published in asynctask given facebook, bot none of them work. makeaction makeaction = action.cast(makeaction.class); makeaction.setproperty("wishdesc", "###my new desc"); makeaction.setproperty("wish.wishdesc", "###my new desc"); makeaction.setproperty("muku-starcall:wishdesc", "###my new desc"); wishgraphobject wishtobe = null; wishtobe = wishgraphobject.factory.create(wishgraphobject.class); wishtobe.setproperty("muku-starcall:wishdesc", "###my new desc"); wishtobe.setproperty("wish.wishdesc", "###my new desc"); ...

Running a Java artifact downloaded from Maven in Gradle -

how run artifact (say called a) download maven? artifact has run time dependencies on other maven artifacts. got work using jettyrun task. involved having source files artifact in src/main/java directory. assuming don't have source files (all jars/dependencies being retrieved maven repository), how start java program in artifact using jettyrun or other task? i don't think jetty plugin allows point project war file. instead give cargo plugin shot. here's sample configuration: cargo { containerid = 'jetty7x' port = 9090 deployable { file = file('/your/path/a.war') context = 'yourcontext' } local { homedir = file('/your/path/to/jetty-7') } }

java - Jackson and Generics -

how jackson parse line in pojo has wildcard generic , taking account serviceaccount abstract? has been attempted of course since serviceaccount class abstract can't serialize. have not seen on google or jackson wiki answers question. private serviceaccount<?>[] accounts; what want polymorphic deserialization ( the second solution on question accepted answer ) i'm not 1 hundred percent sure works generics, solves abstract class problem. considering java runtime has type erasure, don't think you'll have problem casting parsed object.

Android YouTube API ads -

i have incorporated youtube api in app play various videos videos show ads, not show ads in app. does youtube api support showing video ads? thank you. yes, play ads. both player api , player sdk supports ads. have functions onadstarted() etc

How to encode to windows 1252 in Java while writing to the file? -

if encode data in windows-1252 format , write file, how set content type in java? you can use outputstreamwriter . writer out = new outputstreamwriter(new fileoutputstream(yourfile), "windows-1252"); use typical writer methods write output file (or wrap it, or declare outputstreamwriter ). the constructor accepts charset instead of string charset name. can so charset windows1252 = charset.forname("windows-1252");

asp.net web api - Using a list of objects as a parameter for an odata Action -

attempting setup action in odata webapi controller, accepts list of objects. however, when try: updatesortorder.parameter<list<updateitem>>("sortorder"); and pass in {"sortorder": [{"itemproperty":"test"}]} my odataactionparameters null. it works if change parameters accept single updateitem rather list, , use: {"sortorder": {"itemproperty":"test"}} or if create wrapper class contains list of updateitems, have been unable set parameter list. use, updatesortorder.collectionparameter<updateitem>("sortorder"); instead.

PayPal IPN simulator - how to generate INVALID response? -

i'm using paypal ipn simulator test changes. i'm trying generate invalid response. i select transaction type: cart checkout payment_status: denied, failed or expired. however of these generate notification call response verified update didn't read close enough . documentation says: paypal sends single word back, either verified if message originated paypal or invalid if there discrepancy sent. if browse ipn url directly, invalid response paypal because call ipn did not originate paypal. regarding update: close, not exactly. ipn return verified or invalid depending on whether or not recognizes post data you're sending having originated paypal. yes, if browse ipn url directly , directly post's no data / dummy data paypal, yes, won't recognize having originated , we'll return invalid . for example, link return invalid : https://www.paypal.com/cgi-bin/webscr?cmd=_notify-validate&dummy_data=true