Posts

Showing posts from January, 2011

ruby - Own class with spaceship operator does not work for LCS Diff -

i'm trying implement custom class including comparable mixin. later class used diff. class looks like class element include comparable attr_reader :name def initialize(name) @name = name end def <=>(other) @name <=> other.name end end now test values 2 added entries compared a. a = array.new b = array.new a.push element.new('y1') a.push element.new('y2') a.push element.new('y4') a.push element.new('x1') a.push element.new('x2') a.push element.new('x4') b.push element.new('y1') b.push element.new('y2') b.push element.new('y3') b.push element.new('y4') b.push element.new('x1') b.push element.new('x2') b.push element.new('x3') b.push element.new('x4') and run diff between both arrays puts diff::lcs.diff(a, b).inspect i expect 2 added objects finds 8 changes... ideas why? [[["-", 2, #<element:0x007fa9fb567898

json - add time in loading web service in windows phone -

this code load web service in app: public loaddata() { initializecomponent(); postdata(); } private void postdata() { uri uri = new uri("my web service url"); webclient client= new webclient(); client.headers[httprequestheader.contenttype] = "application/x-www-form-urlencoded"; client.uploadstringasync(uri); client.uploadstringcompleted += client_uploadcomplete; } public void client_uploadcomplete(object sender, uploadstringcompletedeventargs e) { var test= jsonconvert.deserializeobject<main>(e.result); } at point if web service takes more 10 seconds load data in variable test, message box or popup box open " slow connection please retry" along retry button again load postdata(); how possible add time in loading web service in wp please me on this..... add timer event , start before asynchronous upload. event fires after 10 secs. if code reaches inside ur complete event disable timer.

windows - for command is executed only for the first value when a label is inside -

i have script for /f "delims=" %%i in ('dir "%folder%*.txt" /b /s') ( set s=%%i set s=!s:%folder%=! set new_s=!s:\=! if "x!new_s!" neq "x!s!" ( :processlistsource /f "tokens=1* delims=\" %%a in ("!s!") ( if "%%a" neq "" ( if "!folder1!" neq "" ( set folder1=!folder1!\!name! )else ( set folder1=!name! ) set name=%%a ) if "%%b" neq "" ( set s=%%b goto :processlistsource ) ) echo folder is: !folder1! echo name is: !name! echo --------------------- ) else ( echo not folder !s! ) ) but not work have expected: first executed once , last echo printed on screen. given folder need files subfolders w

ruby on rails - Heroku not reflecting codes pushed to it and differs from Localhost -

i have done web app ruby on rails , made changes on codes in computer. thereafter, did git add ., git commit, git push , git push heroku master. the localhost:3000 webpage reflected codes , showed change on heroku, webpage did not reflect codes/change. how resolve this? did precompile? otherwise won't see css changes. rails_env=production bundle exec rake assets:precompile also see https://devcenter.heroku.com/articles/rails-asset-pipeline

file - Difference between .dat and .txt in c++ -

i using .txt files in program reading , writing records (records contains both text , numerals). came know .dat file can used .txt file operations. know difference between 2 , advantages , disadvantages of 1 on another. text files or .txt files bit hard parse in programs , easy read. whereas .dat used store data not plain text. generally .txt files contains letters, characters , symbols readable. .dat binary text file in data not printable on screen.

python - Need more faster image capturing and processing method -

im using command thats opencv image capturing , using pil processing. take 2 second capture , completing processing. need more simple command , fastest processing work robots. have suggestion please advice. import cv2 cv2 import * pil import image import rpi.gpio gpio import time im = 0 . . . . . def imgcrop(im): box = (0, 190, 640, 200) region = im.crop(box) region.save('crop.jpg') return region def imgthres(im): gray = im.convert('l') bw = gray.point(lambda x: 0 if x<150 else 255, '1') bw.save("bw.jpg") return bw def find_centroid(im, rez): width, height = im.size xx, yy, count = 0, 0, 0 x in xrange(0, width, rez): y in xrange(0, height, rez): if im.getpixel((x, y)) == 255: xx += x yy += y count += 1 return xx/count, yy/count def camera (): cam

How to select a field from html table using Selenium web driver in java -

in web page have html table , contains multiple radio button. want select 1 radio button. far able find values table not able select. code: getting error on syntax aname.click(); error "the method click() undefined type string" import java.io.*; import org.openqa.selenium.support.ui.expectedconditions; import org.openqa.selenium.support.ui.select; import org.openqa.selenium.support.ui.webdriverwait; import org.openqa.selenium.by; import org.openqa.selenium.webdriver; import org.openqa.selenium.webelement; import org.openqa.selenium.ie.internetexplorerdriver; import java.util.list; import java.util.concurrent.timeunit; public class sendtxn1 { static webdriver d1=null; public static void main(string[] args) throws ioexception, interruptedexception { file file1=new file("c:\\selenium\\iedriverserver_win32_2.35.3\\iedriverserver.exe"); system.setproperty("webdriver.ie.driver",file1.getabsolutepath());

c++ - How to launch cppunit test? -

i trying run cppunit first time following error. have installed think there problem cppunit-config has idea how fix this? have seen report bug on nebeans don't know how run cppunit-config terminal? https://netbeans.org/bugzilla/show_bug.cgi?id=230617 "/usr/bin/make" -f nbproject/makefile-debug.mk qmake= subprojects= .build-conf "/usr/bin/make" -f nbproject/makefile-debug.mk dist/debug/gnu-macosx/exercise1 make[2]: `dist/debug/gnu-macosx/exercise1' date. "/usr/bin/make" -f nbproject/makefile-debug.mk subprojects= .build-tests-conf "/usr/bin/make" -f nbproject/makefile-debug.mk dist/debug/gnu-macosx/exercise1 make[2]: `dist/debug/gnu-macosx/exercise1' date. mkdir -p build/debug/gnu-macosx/tests/testfiles g++ -o build/debug/gnu-macosx/tests/testfiles/f1 build/debug/gnu-macosx/tests/tests/newtestclass.o build/debug/gnu-macosx/tests/tests/newtestrunner.o build/debug/gnu-macosx/main_nomain.o `cppunit-config --libs` /bi

c++ - klee execute the Objectfile, the function "sleep()" does not work? -

first, extended klee support multiple threads, , implement functions of pthread.h in klee. now, use llvm-gcc compile c source file test.c, generate objectfile test.o, use klee test.o execute .o file. function printf can print strings on screen, function sleep() not work, program execute fast, not pause. klee web can use uclibc link c lib, when add argument --libc=uclibc , klee --libc=uclibc test.o , result wrong , weird, klee not execute test.o, instead execute klee itself!!! how can make function sleep() work? the c source follow #define os_globals #include <stdio.h> #include <pthread.h> #include <unistd.h> #include <stdlib.h> #include <string.h> #include <signal.h> //#include "record_monitor.h" int num; int global; void * fun1(void *arg) { printf("1fun1 num = %d\n",num); printf("fun1 gol = %d\n",global); num = 8; printf("2fun1 num = %d\n",num); sleep(10); printf(

ember.js - bind-attr with Controller property -

consider following code: handlebars template: <script type="text/x-handlebars" data-template-name="items"> <div {{bind-attr class="isarchiveactive:active"}}> highlighted if archived item active. </div> <ul class="archived-items"> {{#each}} <li {{bind-attr class="isactive:active"}}> <button {{action "activate" this}}>activate</button> <button {{action "deactivate" this}}>deactivate</button> </li> {{/each}} </ul> </script> controller: app.itemscontroller = ember.arraycontroller.extend({ actions: { activate: function(item) { item.set('isactive', true); }, deactivate: function(item) { item.set('isactive', false); } }, isactive: false, isarchiveactive: functi

ruby on rails - Force Heroku to Recompile All Assets -

i updated 2 images , heroku serving 1 correctly other still old image. output of deploy logs show both images being precompiled new hashes hash used retrieve 1 of them (from application.css file) still old hash , it's grabbing old image somehow. i'd force heroku recompile every asset , restart server (essentially fresh deploy). seems "intelligently" precompile assets judges being new. tried doing rake assets:clobber , rake assets:precompile changed nothing -- still using old hash grab old image version one, getting other. other options try? expiring assets manually worked -- changed config.assets.version = 1.0 1.1 in config/production.rb . still not sure happened, though.

c# - How to get refresh token of Box -

i have c# desktop application uploads files box , needs refresh token generate access token, i'm unable create refresh token programmatically. created refresh token this site , uploaded files box refresh token expired after minutes , throws exception refresh token has expired . i'm using box-csharp-sdk-v2 . so want create refresh token using client details or api key programaticaly in order work box oauth2 tokens, you'll need instantiate tokenprovider using api key , secret application: // instantiate token provider. var tokenprovider = new tokenprovider("apikey", "apisecret"); after sending user through oauth2 workflow receive authorization code . tokenprovider can use code fetch first access/refresh token pair: // fetch initial access/refresh token pair // want persist these new values later use. var initialtokenpair = tokenprovider.getaccesstoken("code") a new refresh token given every time refresh access token.

c++ - spoj prime conjecture PRIMEZUK -

i trying solve question http://www.spoj.com/problems/primezuk/ #include<iostream> #include<cstdio> #include<math.h> #define l long long using namespace std; l chk(l a) { for(int i=2;i<=sqrt(a);++i) { if(a%i==0) { return a/i; } } return 0; } main() { // freopen("in.txt","r",stdin); int t,n,a; l prod=1,flag; //t=inp(); cin>>t; for(int j=1;j<=t;++j) { cin>>n; //n=inp(); if(n==0) prod=-1; else prod=1; while(n--) { cin>>a; //a=inp(); prod*=a; } ++prod; flag=chk(prod); if(!flag) printf("case #%d: %lld\n",j,prod); else printf("case #%d: %lld\n",j,flag); } } i getting right answer sample test case whne submit getting wrong answer...any hints??? you getting

java - How to search SQL Database and display it on a JTable -

just title says, want search sql database , display on jtable using jtextfield on keyreleased . i've tried: private void jtextfield2keyreleased(java.awt.event.keyevent evt) { try{ int = (int)jtable2.getmodel().getvalueat(jtable2.getselectedrow(), 0); string query = "select fname roominfo fname '%" + jtextfield2.gettext() + "%'"; string url = "jdbc:mysql://localhost:3306/adv"; connection conn = drivermanager.getconnection(url,"root","sa"); statement st = conn.createstatement(); rs = st.executequery(query); jtable2.setmodel(dbutils.resultsettotablemodel(rs)); conn.close(); } catch (exception e) { system.err.println("got exception! "); joptionpane.showmessagedialog(null,"got exception!"); system.err.println(e.getmessage()); } // todo add handling code her

python - SQLAlchemy Classical Mapping Model to sharded Postgres databases -

the situation: i have set of 12 tables (representing data month) sharded across 6 databases. need sample set of data across of these databases given month. why used classical mappping model rather declarative model: i require access 1 of 12 types of table gathering sample of data single given month each time code run. classical mapping model allows me dynamically define table name want map @ run time, rather create mappings 12 tables across 6 databases believe required declarative. the problem: i trying follow entity_name example given here mapping month data class each of tables given month on 6 different databases. but getting unmappedclasserror stating base class, new classes derived from, 'is not mapped'. so on trying initialise 1 of new mapped tables type: <class '__main__.db1month1'> reporting unmappedclasserror: class 'audit.db.orm.mappedclasses.monthdata' not mapped . any ideas? if needed can paste in code here i'm worr

excel - Match only 2 cells and rearrange multiple cells -

Image
column 1 , column 2 values excel sheet. need match column 1 column 3 while column 1 , column 2 should still maintain order. how can this? sample: i have found formula. doesn't need. =if(isna(match(c2,a:a,0)),"",index(a:a,match(c2,a:a,0)))

Deploy Spring + Hibernate + Maven + Google Cloud SQL application in Google App Engine -

i have web application spring+ hibernate + maven configuration using google cloud sql database. cannt deploy application in google app engine. please give me suggestion. google app engine support application configuration? it can done , here the proof of concept . also note google app engine supports jpa 1.0. current version of hibernate 4.0 supports jpa 2.1. means not supported google app engine.

How to explain coroutine in Tornado and Python? -

i know coroutine in python use get = yield ret , callee.send() , callee.next() . havn't find above things such call.send() in tornado source code gen.py . how explain coroutine in tornado easy understand way? without bigger picture , can't understand tornado did. gen.py does call send() , in runner.run() , not in engine() or coroutine() might expect. it seems engine() , coroutine() evaluate wrapped function see whether returns generator. if does, calls runner.run() on result, internally seems loop on send() . it's not obvious it's doing though...

upnp - Paring iOS app to Samsung TV as remote controller -

i have been using upnpx library discover tv using upnp protocol. have pare ios app tv remote controller. first objectives take control of sound volume, move mouse cursor, browse through web-browsers, etc. i have tried google urn:samsung.com:device:remotecontrolreceiver1 specification had hard time find useful informations. has done before , give me directions or technical specification control tv remote app ? regards, you try use charles . way able sniff network. try duplicate functionality in app.

bash - Is there a command that works for command line arguments like the sort command does for files? -

i trying write script in bash take between 1 , 5 command line arguments user , report them in reverse numerical order standard output. command know work sort command, works files. there similar command sorting command line arguments? here have far. #!/bin/bash if [ $# -lt 1 ] || [ $# -gt 5 ]; echo "incorrect number of arguments!" else sorted=sort -rn $* echo "sorted: $sorted" fi try: sorted=$( printf '%s\n' "$@" | sort -rn ) printf '%s\n' "${sorted//$'\n'/ }"

android - How do you sign up for Crashlytics? -

i want integrate crashlytics in android app. i've followed link , installed sdk: http://download.crashlytics.com/android/eclipse/ i've restarted eclipse , see crashlytics icon. when click icon, asks user credentials. not have account , unable sign up. it asks email address: "interested? try crashlytics". i've entered email, no mail has come inbox. next opens link: http://try.crashlytics.com/list/?token=z2fuzxnoqgv2zw50dxjlcnmuy29tojo0nzuwmw==&key=dac24708c98fdec25ee3ebe7bce2f386 . how register new crashlytics account? where api key crashlytics? wait 1 or 2 two days. they send invite email email address. able register , sign in crashlytics. to install crashlytics android sdk, follow link below: http://download.crashlytics.com/android/eclipse/

java - Spring Global transaction vs Local transaction -

while reading through spring transaction documentation see supports both global transactions , local transactions. in simple terms global transaction , local transaction? what advantages of 1 on other? appropriate uses of them? if use following configuration – mean local transaction? <tx:annotation-driven transaction-manager="transmanager" /> <bean id="transmanager" class="org.springframework.orm.jpa.jpatransactionmanager"> <property name="entitymanagerfactory" ref="emf" /> </bean> i tried searching both in google , stackoverflow, did not resources explaining same in simple terms. actually there plenty of resources answering first 2 questions, example spring documentation explains local , global transaction , depicts differences in chapter 9.2 motivation . in few words: global transaction application server managed transaction, allowing work different transactional resources (this mi

osx - What is my Java version on MacBook after upgrading Java from 6 to 7? -

this question has answer here: where java installed on mac os x? 15 answers i have macbook on java installed on below location: /system/library/java/javavirtualmachines/1.6.0.jdk/contents/home recently, have upgraded java version 1.6 1.7 , link verify java version says have recommended java installed (version 7 update 51). but not able see java - 7 got installed. also, when check java version using terminal java -version command, still says macbook having older version 6 i.e.: java version "1.6.0_65" java(tm) se runtime environment (build 1.6.0_65-b14-462-11m4609) java hotspot(tm) 64-bit server vm (build 20.65-b04-462, mixed mode) now how determine java have , is? try command. take while run, because @ every file on machine, should find new version somewhere! find / -name "1.*jdk" 2> /dev/null it s

javascript - SESSION returns old value when echoed in php -

<script language="javascript"> function emergency() { if(document.getelementbyid('emer').checked == true) { <?php $_session['total2']= $_session['total1'] + 50; ?> document.getelementbyid('emr').innerhtml = "<b>payable amount: </b>" + <?php echo $_session['total2']; ?>; } if(document.getelementbyid('emer').checked == false) { <?php $_session['total2']= $_session['total2'] - 50; ?> document.getelementbyid('emr').innerhtml = "<b>payable amount: </b>" + <?php echo $_session['total2']; ?>; } } </script> here adding $_session['total1']+50 , put value in new session session['total2

spring - java.lang.NoSuchFieldError: NON_BRIDGED_METHODS -

i working on spring mvc, made normal login application, getting error. appreciated. index.jsp <html> <head> <title>home</title> </head> <body> <h1>hello world!</h1> <hr/> <form action="hello.html" method="post"> name:<input type="text" name="username"/><br/> password:<input type="password" name="password"/><br/> <input type="submit" value="login"/> </form> </body> </html> helloworldcontroller.java @controller @requestmapping(value = "/hello.html") public class helloworldcontroller { @requestmapping(method = requestmethod.post) public modelandview helloworld(httpservletrequest request, httpservletresponse res) { string name = request.getparameter("username"); string password = request.getparameter(&q

java - Import some code so that loop become infinite? -

make loop infinite .add line public class puzzel4 { public static void main(string[] args) { // place declaration here while (i != 0) { >>>= 1; } } } byte i=-1; from comments: unsigned right-shifting, in java, causes unary promotion int : byte 0xff becomes int 0xffffffff , right-shifted 0x7fffffff , narrowed 0xff storage.

Cygwin - awk-Cannot allocate memory -

while using cygwin ( cygwin_nt-6.1 ) , compare 2 files (file11.csv : 25.82 mn rows, file22.csv : 4.1 mn) , executing command awk -f "," 'nr==fnr{a[$2]=$0;next }{print (a[$1]?a[$1]:"notfound,notfound") "," $0}' file11.csv file22.csv>op_file33.csv i getting error : awk: cmd. line:1: (filename=- fnr= fatal: more_nodes: nextfree: can't allocate 4000 bytes of memory (cannot allocate memory), . error file (gawk.exe.stackdump) contains:stack trace: frame function args 002299a0 7710f003 (00000118, 0000ea60, 00000000, 00229ad4) 002299b4 7710efb2 (00000118, 0000ea60, 000000a4, 00229ab0) 00229ad4 610dbe29 (00000000, 00000000, 00229ad0, 00229bc4) 00229bc4 610d915e (00000000, 61102fa2, 003b0023, 00230000) 00229c24 610d962e (20000038, 00000000, 00229c64, 00000006) 00229cd4 610d9780 (00000500, 00000006, 00229d04, 0022ce64) 00229cf4 610d97ac (00000006, 0022ce80, 0022ce64, 0042da60) 00229d24 610d9a85 (0044f0f4, 00000503, 000

sql - CONFLICT WITH "00:00:00" as END_TIME -

i have query: select `s`.`time` , sum( s.love ) total_love, sum( s.sad ) total_sad, sum( s.angry ) total_angry, sum( s.happy ) total_happy (`employee_workshift` e) join `workshift` w on `e`.`workshift_uuid` = `w`.`uuid` join `shift_summary` s on `w`.`uuid` = `s`.`workshift_uuid` `s`.`location_uuid` = '81956feb-3fd7-0e84-e9fe-b640434dfad0' , `e`.`employee_uuid` = '3866a979-bc5e-56cb-cede-863afc47b8b5' , `s`.`workshift_uuid` = '8c9dbd85-18a3-6ca9-e3f3-06eb602b6f38' , `s`.`time` >= cast( '18:00:00' time ) , `s`.`time` <= cast( '00:00:00' time ) , `s`.`date` '%2014-03%' my problem returns "null" when changed 'end_time' "23:59:59", returned right data. i've got idea pull hour of both 'start_time' , 'end_time' , insert in loop between them. $time_start = 15; $time_end = 03; should produce: 15,16,17,18,19,20,21,22,23,00,01,02,03 then i'll compare them all. take lot of line ,

c++ - how to do lens correction in opencv -

i want barrel correction in opencv. the formula need implement is: r(s)= (a * r(d)^3 + b * r(d) ^2 + c*r(d) + d) * r(d) i know opencv has in build capability lens calibration, depends on parameters doesn't seems similar above equations. my questions: can convert parameters opencv camera calibration parameter? can use in build opencv function unwarp images based on above equation? what best way implement above function in opencv? this baasically geometric image transform . yours not special case, you'll need generic remap .

JSON decode with PHP PDO -

i have json string, , want decode string php array , add database, when try call part of array dont anything: <?php $json = '{"zoom":13,"tilt":0,"maptypeid":"hybrid","center":{"lat":45.38591280296377,"lng":19.936323169799834},"overlays":[{"type":"polygon","title":"polje 1","content":"vojvodina","fillcolor":"#ffbf1a","fillopacity":0.3,"strokecolor":"#000","strokeopacity":0.8,"strokeweight":3,"paths":[[{"lat":"45.37867863632308","lng":"19.948768615722656"},{"lat":"45.370719925928746","lng":"19.941558837890625"},{"lat":"45.36227764550136","lng":"19.92816925048828"},{"lat":"45.359262240003495","lng":"19.94224

Why we multiply 'most likely estimate' by 4 in three point estimation? -

i have used 3 point estimation 1 of project. formula 3 point estimate = (o + 4m + l ) / 6 that means, best estimate + 4 x estimate + worst case estimate divided 6 here divided 6 means, average 6 and there less chance of worst case or best case happening. in faith, estimate (m), take job done. but don't know why use 4(m) . why multiplied 4 ???. not use 5,6,7 etc... why estimate weighted four times as other 2 values ? i dug once. cleverly neglected write down trail, memory. so far can make out, standards documents got textbooks. textbooks got original 1950s write in statistics journals. writeup in journal based on internal report done rand part of overall work done develop pert polaris program. and that's trail goes cold. nobody seems have firm idea of why chose formula. best guess seems it's based on rough approximation of normal distribution -- strictly, it's triangular distribution. lumpy bell curve, basically, assumes "lik

matlab - neural networks - removing noise from .wav files -

is there way how remove noise audio files - neural networks? want remove noise speech, example in matlab. thank you. this clean out noise (doesn't answer neural networks question). "create , implement lms adaptive filter remove filtered noise desired signal" sauce: http://www.mathworks.com/matlabcentral/answers/106510 mtlb_noisy = y; noise = n; % define adaptive filter parameters filterlength = 32; weights = zeros(1,filterlength); step_size = 0.004; % initialize filter's operational inputs output = zeros(1,length(mtlb_noisy)); err = zeros(1,length(mtlb_noisy)); input = zeros(1,filterlength); % loop run through data , filter out noise n = 1: length(mtlb_noisy), %get input vector filter k= 1:filterlength if ((n-k)>0) input(k) = noise(n-k+1); end end output(n) = weights * input'; %output of adaptive filter err(n) = mtlb_noisy(n) - output(n); %error computation weights = weig

c# - Is the ManagementEventWatcher class no longer available in the System.Management namespace? -

Image
i'm getting following error message: the type or namespace name 'managementeventwatcher' not exist in namespace 'system.management' (are missing assembly reference?) i have included system.management in project references, yet type cannot found. i have run visual studio administrator , still same result. has managementeventwatcher gone away? you missing assembly reference system.management.dll . using statement brings names scope, save typing prefix: doesn't add dll reference project. if have added reference , didn't include using system.management in class gets error message. if include using system.management in class , didn't include it's reference project, similar error message. have add reference of system.management.dll project have shown below. go solution explorer, , expand project, right click on references folder/option , select add references context menu. select .net tab , select system.management list ,

Java SunPKCS11 JCE RSA key wrapping exception -

i have 2 rsa key pairs on 1 device: rsa1 , rsa2. wrap rsa1 private key rsa2 public key using ckm_rsa_pkcs mechanis. i have following code: keystore ks = keystore.getinstance("pkcs11", p); ks.load(null, pin); x509certificate cert1 = (x509certificate) ks.getcertificate("rsa1"); publickey pubk1 = cert1.getpublickey(); privatekey privk1 = (privatekey) ks.getkey("rsa1", pin); x509certificate cert2 = (x509certificate) ks.getcertificate("rsa2"); publickey pubk2 = cert2.getpublickey(); privatekey privk2 = (privatekey) ks.getkey("rsa2", pin); cipher cipher = cipher.getinstance("rsa/ecb/pkcs1padding", p); cipher.init(cipher.wrap_mode, pubk2); // here exception byte[] output = cipher.dofinal(privk1.getencoded()); i following exception: exception in thread "main" java.security.invalidkeyexception: not create rsa public key

java - Customize the uninstaller in IZPack -

currently have installer , uninstaller application , problem during uninstallation. i.e if give command "java -jar uninstaller.jar" uninstall application 1 pop-up 1 checkbox message "force deletion of /opt/app(this installed path)" , 2 buttons: uninstall , quit. the problem if don't check checkbox , click on uninstall button, says "uninstall successful", installed path not deleted , uninstall folder deleted. if check checkbox , click on "uninstall" button, go fine. so, prefer if check checkbox uninstall button should enabled, in other cases should disabled i.e when run uninstaller (java -jar uninstaller.jar) uninstall button should come disabled. can please me out issue?

screencasting in android using HDMI wifi dongle -

Image
i have been searching lot implementing screen cast(miracast) in android , got more confused. have hdmi wifi dongle. plug dongle , open app need search available devices , user selects devices mirroring should start , screen need reflect device has plug device. settings need go display , turn wireless display on , connect them. of tryed wifip2pmanager class , got list of device , connected device. not showing connected on settings wireless display need connected screen casting. question can start casting app , how ? there no public api allows manipulate directly connection, can integrate action should want, through mediarouteactionprovider using this, can display button inside action bar. when user click on it, show list of paired devices , quick scan. there, user able directly initiate connection available device. it's working on devices, not returning action on don't have paired devices or don't support miracast (+some samsung's don't use mediar

.net - F# Type inference on Math.Max -

why won't compiler pick correct version of overloaded method if has inferred types of input parameters. in example why can't pick correct math.max use when type has correctly inferred on elements being compared: let listmax = list.map2 (fun l r -> math.max(l,r)) [2;4] [5;3] //compile error let listmax2 = list.map2 (fun (l:int) r -> math.max(l,r)) [2;4] [5;3] //no compile error of course can use max function in case, there plenty of other methods don't have native equivalent. as @gos correctly points out, using pipeline operator helps in case. reason type inference works left right - so, if use pipeline operator, knows 1 of inputs list of integers and, based on that, picks right overload of math.max . the compiler needs know type when overload resolution or when want invoke member on object (e.g. if wanted l.foo() inside map function) - because in case, needs know type is. f# defines own versions of basic math functions work

java - More info about save in GORM -

i have simple block of code, return false promodebit promodebit = new promodebit(); promodebit.promocode=promocode; promodebit.userid=userid; promodebit.countusages=countusages; promodebit.enddate=enddate; promodebit.startdate=startdate; promodebit.status=1; promodebit.calcvalue=float.parsefloat(p.getproperty("promopercent")); if(promodebit.save(flush: true)){ log.info "good!" } else { log.info "bad!" } how can more info gorm.save fail? stdrout log show nothning if turn on logsql in datasource.groovy first ,make sure log4j configured correctly. here http://grails.org/doc/2.3.1/guide/conf.html#logging and ,if wan know more detail info on gorm.save fail promodebit promodebit = new promodebit(); promodebit.promocode=promocode; promodebit.userid=userid;

android - Prevent Google SupportMapFragment from reloading -

i'm having trouble developping android app supportmapfragment. when switch fragments, hide supportmapfragment , save cameraposition in sharedpreferences. when show map again, loads cameraposition sharedpreferences. works fine, map needs load again. there has way save map in way barely takes time pop up, moving background or something? can me this? thanks! no, there no way force map keep it's data.

c# - Xamarin Android deserialize local json file -

i got working json deserializer that's json file url. how can recreate , make work local json file? file in root of application, next mainactivity. this working code url: var client = new webclient(); var response = client.downloadstring(new uri("http://www.mywebsite.nl/form.json")); list<question> questions = jsonconvert.deserializeobject<list<question>>(response); foreach(question question in questions) { if (question.type == "textfield") { var edittext = new edittext (this); edittext.text = "this question: " + question.id + "."; edittext.layoutparameters = new viewgroup.layoutparams(viewgroup.layoutparams.matchparent,viewgroup.layoutparams.wrapcontent); layout.addview (edittext); } } i got working.. had put .json file in assets folder, set build action androidasset , use next code: string response; streamreader strm = new streamreader (assets.open ("fo

Linux execute file using PHP (XAMPP) -

this way harder looks like, think encountering kind of permission problems, not know do. testing purposes i'm using 777 permissions files. i want start executable file using php. i tried: <?php echo system('./fieldtheory'); echo shell_exec('./fieldtheory'); echo exec('./fieldtheory'); ?> but none of them execute file. tried executing simple shell script using system('./script.sh'); : #!/bin/sh echo "hello" /fieldtheory ./fieldtheory /opt/lampp/htdocs/fieldtheory ./opt/lampp/htdocs/fieldtheory i see "hello message" file not being executed. if execute file using terminal command: php testfile.php program being started without difficulties. edit : tried absolute paths no effect. double check php.ini , make sure exec functions not disabled: may have line this: disable_functions =exec,passthru,shell_exec,system,proc_open,popen,curl_exec,curl_multi_exec,parse_ini_file,show_source

c# - Why does Hashtable implement both ICollection and IEnumerable? -

this question has answer here: why arraylist implement ilist, icollection, ienumerable? 4 answers in .net framework 3.5 (c# 3.0) why system.hashtable implement both icollection , ienumerable when implements idictionary inherits these 2 interfaces? having these intefaces: interface ifoo1 {...} interface ifoo2: ifoo1{...} there no difference in terms of compilation between followings: class myclass: ifoo2{...} class myclass: ifoo2, ifoo1{...} the second declaration makes clearer developers interfaces myclass class implements. easier have @ documentation , see myclass implements ifoo1 interface, without digging ifoo2 interface.

actionscript 3 - Text within an image is jaggy/broken - Adobe Flash -

this post have made on adobe forum... i'm newish flash , i'm doing presentation part of university assignment. my problem this. part of presentation have photo gallery uses thumbnail images buttons , ui loader load pop version of larger image webserver - per https://www.youtube.com/watch?v=peo_nt9hha0 the image created on photoshop. .jpg , has text within image describes underneath image about. text within photoshop set anti-aliasing 'smooth' , when test movie within flash, text underneath image looks fine - in photoshop. however, when publish , upload .swf file webserver , view image through browser, text looks awful - jaggy , broken if makes sense. any ideas why? i given reply of... if loading images dynamically have set smoothing property true after file(s) has been loaded. if don't have listener images finishing loading, need one, , event handler function assign smoothing property true each of them. can creating actio

java - Getting back to the client page -

in web i'm using servlet server. after have processed request, page made request. how do that? i have used "response.sendredirect(request.getparameter("url"));" i'm getting blank page instead of page made request. i appreciate every come. you use referer http header: public void doget(httpservletrequest request, httpservletresponse response) throws servletexception, ioexception { string ref = request.getheader("referer"); response.sendredirect(ref); } but keep in mind, referer header optional , browser clients may not send it.

Google spreadsheets: conditional formatting with custom formula based on values from different sheet -

Image
i have google spreadsheet two sheets . on first sheet , items listed in column a , , types in column b . on second sheet , reference first sheet's column a formula: =unique(sheet1!a:a) . then want color items in 2nd sheet based on item type ( 1st sheet's column b* ). try add conditional formatting using formula =sheet1!$b:$b="type1" , when try save rules , says formula invalid. what correct formula case? you cannot reference cells directly in conditional format formula. also, not think formula work. first, need vlookup function object's type. here's example of using function. difference corresponding data in first parameter preceded sheet name in case. see image: as can see, vlookup searchs item d in matrix a2:b4 , , returns corresponding value (the value in same row) in second column of matrix, column b . so if apply formula conditional formatting, have: =vlookup($d$2:$d;$a$2:$b$4;2)="dragon" the first paramet

sbt - Unable to add scala-reflect as a dependency -

i can't add scala-reflect dependency. project/build.sbt looks this: //the name of project, become name of war file when run package command. name := "test-sbt" version := "1.0" //specify scala version using in project. scalaversion := "2.10.3" librarydependencies <++= (scalaversion)(sv => seq( "org.scala-lang" % "scala-reflect" % "2.10.3", "org.scala-lang" % "scala-compiler" % "2.10.3" ) ) and project/build.properties sbt.version=0.13.0 and here main class: object main1 extends app { import scala.reflect.runtime.universe val runtimemirror = universe.runtimemirror(getclass.getclassloader) //...... } it says object runtime not member of package reflect . of course, did "gen-idea", "clean" , other things. what's that? guessing here due question @laughedelic. the build.sbt should in root. assuming project writing in te

c# - Return value from social media connect in wordpress -

i want create mobile version of website friend built wordpress. developing windows phone. i want know value returned when log in using social media (facebook / twitter). because when try register using social media, @ profile , didn't need input password. friend used userpro plugin connect social media. want application used commenting using social media. you logged in facebook / twitter on smartphone, , selected "remember me", don't have input password each , everytime log in. also, in experience, wordpress mobile requires check remember me when logging in via social media. hope helps you!

sql server - SQL - Choose which field to select -

ok, title may bit strange, i'm trying doesn't seem quite complicated. i have table mytable 2 fields defaultname , customname . make query selects customname if it's not null neither empty, otherwize defaultname not blank. i'd grateful or link related post. sql server syntax: select case when customname not null , customname <> '' customname else defaultname end customername mytable

What might cause a Delphi program to 'prevent Windows shutdown'? -

one of delphi xe2 programs, when running , idle, 'prevents windows shutdown'. not case of applications , need resolve it. on xp, windows silently fails close; on win7 dialog shows application preventing shutdown. unlike similar questions here, program single-threaded, not using tray, , have temporarily disconnected onclosequery , formclose events in main form , 1 subsidiary form had them. in normal use program closes cleanly , no trace of remains in process explorer. i have experimemtally added wm_queryendsession , wm_endsession handlers write log message windows event log. on test windows shutdown, former fires, wparam , lparam both zero. i grateful ideas on causing this, or how investigate further. reluctant try call halt on wm_queryendsession without knowing going on. in final state failing, program had formclosequery methods reconnected, in each 1 checking 'shuttingdown' global boolean, , allowing close if set. shuttingdown set true in wm_que

CGAL::Polyhedron_3 demo - failing intersection -

i started using cgal demos find intersection of 2 polyhedra. met problem when 2 polyhedra share vertices , edges. program extis "segmentation fault" call. assume problem refers shared vertices, since other case see no problem. polyhedra e.g. rhombic triacontahedra or truncated tiracontahedra (the latter concave). problem of demo program or cgal algorithm itself? input off files use: https://www.dropbox.com/s/nywdv80yzr0wpxp/henley_3d.off https://www.dropbox.com/s/slxzfwhchpuix2p/henley_shift_3d.off i'm using cgal ubuntu 10.04 under virtualmachine win7 x64 host. i grateful you. best, radek first problem, polyhedra inconsistently oriented (which explain checkerboard coloration when open them in demo. second problem have non triangular facets not problem nef if vertices of facets coplanar (which not case). to fix can use "orient polygon soup" plugin , "inside outside" plugin fix orientation. plugin "triangulated facets" b

Passing Variable into Callback PHP -

i have function below called , passed array. pass field (or key) name reusable. when try pass $field in callback below error $field not defined. if use literal, works great. function array_map_recursive($array,$field) { $sum = 0; foreach ($array $key => $value) { foreach ($value $key2 => $value2) { $sum += array_sum(array_map(function($item){return $item[$field];},$value[$key2])); } } return $sum; } called: number_format(array_map_recursive($dept_catg_grp_descs,"total_ty_yest_sales")) function ($item) use ($field) {return $item[$field];} this "imports" $field variable function.

c# - Exception when ReportDocument is Exported, Saved, or Printed -

this 1 might tough 1 explain. i've got program fills in pre-built crystal report (cr 2011) based on oracle database. i've applied logon information tables in report (and tables in 5 sub reports) through msdn tutorial based code. if not add code report once it's refreshed (such saving it, or sending printer) run through code without issue. however, if add code makes program useful, breaks below exception. here relevant code: try { (intcount = 1; intcount < rname.count(); intcount++) { logfile.logmessage(path, sreportpath); logfile.logmessage(path, sreportpath + rname.elementat(intcount)); //this line loading "c:\...\policy reinstatement.rpt" valid cr.load(sreportpath + rname.elementat(intcount)); crconnectioninfo.servername = sdatasource; crconnectioninfo.databasename = ""; crconnectioninfo.userid = suserid; crconnectioninfo

html - Generate a page based on an autocomplete result from a text box (Flask/Python backend) -

i've got text box being filled autocomplete result $("#job_names").autocomplete({source : data}); //later on in html <input id="job_names" type= "text"/> <input type= "submit" value= "search" id= "search"/> on python/flask backend, i've got this. @app.route('/jobs/<job_name>') def display_job_info(job_name= none): #does stuff autocomplete result #here, job_name autocomplete result i can explain more if desired, can show me how take html tag, , pass off python backend through url/route?

Copy automatically only the color from one cell to another- EXCEL VBA -

i have cell 017 , value , color of cell changing due formula , conditional formatting. cell o16 changes due formula formula , values different cell 017 . what want cell o16 contains same color of cell o17 automatically once value of cell 017 has changed. there should solution in vba. hope help. edit: user simoco has came solution excel 2010 , later: private sub worksheet_calculate() range("o16").interior.color = range("o17").displayformat.interior.color end sub unfortunately use excel 2007, there , equivalent code in 2007?. works excel 2010 , later if cell o17 can changed only through formula , use following code (this code should used in sheet module): private sub worksheet_calculate() range("o16").interior.color = range("o17").displayformat.interior.color end sub otherwise, add worksheet_change event same code.