Posts

Showing posts from March, 2015

eclipse - Tycho tests failing due to java.lang.NoClassDefFoundError: junit/framework/AssertionFailedError -

i flummoxed , flabbergasted one. in understanding, should work, don't know why. i have tycho build runs few tests in eclipse worksbench. however, of tests fail kind of exception: java.lang.noclassdeffounderror: junit/framework/assertionfailederror @ org.grails.ide.eclipse.commands.test.abstractcommandtest.teardown(abstractcommandtest.java:112) @ junit.framework.testcase.runbare(testcase.java:140) @ junit.framework.testresult$1.protect(testresult.java:110) @ junit.framework.testresult.runprotected(testresult.java:128) @ junit.framework.testresult.run(testresult.java:113) @ junit.framework.testcase.run(testcase.java:124) @ junit.framework.testsuite.runtest(testsuite.java:243) @ junit.framework.testsuite.run(testsuite.java:238) @ junit.framework.testsuite.runtest(testsuite.java:243) @ junit.framework.testsuite.run(testsuite.java:238) @ org.springsource.ide.eclipse.commons.tests.util.managedtestsuite.run(managedtestsuite.java:231) @ org.junit.internal.runners.junit38classrunner.run...

language agnostic - Methods for automated synonym detection -

i working on neural network based approach short document classification, , since corpuses working around ten words, standard statistical document classification methods of limited use. due fact attempting implement form of automated synonym detection matches provided in training. question more resolving situation follows: say have classifications of "involving food", , 1 of "involving spheres" , data set follows: "eating apples"(food);"eating marbles"(spheres); "eating oranges"(food, spheres); "throwing baseballs(spheres)";"throwing apples(food)";"throwing balls(spheres)"; "spinning apples"(food);"spinning baseballs"; i looking incremental method move towards following linkages: eating --> food apples --> food marbles --> spheres oranges --> food, spheres throwing --> spheres baseballs --> spheres balls --> spheres spinning --> neutral involving --> neutr...

c# - Cannot read data from database into arraylist? -

i have tried solve crazy error when this? here's first method --> holds sqlquery [webmethod] public arraylist getallaegenskaperforenmall(string mall_id) { arraylist dbfetch; // string parameter1 = "mall_namn"; string sqlreadquery = "select distinct d.egenskaper_namn from(select egen.egenskaper_id, egen.egenskaper_namn, kopp.mall_id, kopp.egenskap_id, emall.mall_id egenskapensmallid, emall.mall_namn t_egenskaper egen, t_kopplingmallegenskaper kopp, t_egenskapsmall emall kopp.mall_id = 1 , kopp.egenskap_id = egen.egenskaper_id) d"; dbfetch = executereadsqlqueryarray(sqlreadquery); return dbfetch; } then have tried set general webmethod fetch data me. public arraylist executereadsqlqueryarray(string sqltofetchdata, string parameter1 = "", string parameter2 = "", string parameter3 = "") { sqlconnection conn = new sqlconnection(mconnectionstring); sqlcommand command = new sqlcommand(); sqldatareader sqlreader; arraylist dataread...

c++ - Weird behavior while converting a std::string to a LPCSTR -

i playing strings when stumbled upon weird behavior while converting std::string lpcstr . i have written small test application demonstrate : #include <string> #include <windows.h> #include <iostream> using namespace std; int main () { string stringtest = (string("some text") + " in addition other text").c_str(); lpcstr lpstrtest= stringtest.c_str(); cout << lpcstrtest << '\n'; cout << (string("some text") + " in addition other text").c_str() << '\n'; lpcstr otherlpcstr= (string("some text") + " in addition other text").c_str(); cout << otherlpstr; } and here output : some text in addition other text text in addition other text îþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþ...[more unreadable stuff]... i wondering causing strange behavior. thank you lpcstr otherlpcstr= (string("some...

How to select radio buttons in jquery -

the code below adds value textbox: $('#maintxtweight').val(textweight); but want know how can select radio button depending on value using jquery? below radio buttons: <table id="replies"> <tr> <th colspan="2">replies</th> </tr> <tr> <td>number of replies:</td> <td align="left"> <div class="replytd"> <label> <input type="radio" name="reply" id="singlebtn " value="single" class="replybtn" />single</label> </div> <div class="replytd"> <label> <input type="radio" name="reply" id="multiplebtn" value="multiple" class="replybtn" />multiple</label> </div> </td> </tr> </table> i have created if statement below, need being able select "single" radio button if reply type equals "single...

javascript - AJAX request not working and puzzled why, any new eyes to look at it? -

this ajax script have been using on other pages , has worked fine. <script type="text/javascript" src="jquery-1.4.2.min.js"></script> <script type="text/javascript" src="jquery.validate.min.js"></script> <script type="text/javascript" src="http://ajax.microsoft.com/ajax/jquery.validate/1.7/jquery.validate.min.js"></script> <script type="text/javascript"> $(document).ready(function(){ $("#form1").validate({ debug: false, rules: { user1: "required", }, messages: { user1: "pick user", }, submithandler: function(form) { // other stuff valid form $.post('process.php', $("#form1").serialize(), function(data) { $('#result').html(data); }); } }); }); my form below: <form id="form1" name="form_select" action="process.php" method="post"> <select size="20" name="...

java - Update entry while iterating through key set -

how accomplish updating entry while iterating through keys map<string,list<sobject>> map1=new hashmap<string,list<sobject>>(); map<string,list<sobject>> map2=new hashmap<string,list<sobject>>(); for(string name: map1.keyset()){ //do for(sobject obj1: map1.get(name)){ //iterate through list of sobjects returned key for(sobject obj2 : map2.get(name)){ //iterate through list of sobject values keys , update or remove values related key } } } you can use iterator on map's entryset - map.entryset().iterator() make sure nothing else modifying map while you're iterating through it, own modifications safe long you: - remove items using iterator's remove() method, , - modify value using map.entry setvalue() method see http://docs.oracle.com/javase/6/docs/api/java/util/map.html#entryset()

hadoop - How to specify username when putting files on HDFS from a remote machine -

i have hadoop cluster setup , working under common default username "user1". want put files hadoop remote machine not part of hadoop cluster. configured hadoop files on remote machine in way when hadoop dfs -put file1 ... is called remote machine, puts file1 on hadoop cluster. the problem logged in "user2" on remote machine , doesn't give me result expect. in fact, above code can executed on remote machine as: hadoop dfs -put file1 /user/user2/testfolder however, want able store file as: hadoop dfs -put file1 /user/user1/testfolder if try run last code, hadoop throws error because of access permissions. there anyway can specify username within hadoop dfs command? i looking like: hadoop dfs -username user1 file1 /user/user1/testfolder thanks by default authentication , authorization turned off in hadoop. according hadoop - definitive guide (btw, nice book - recommend buy it) the user identity hadoop uses permissions in hdfs determined running wh...

tinyMCE jQuery form validation -

i'm trying use tinymce's getcontent() make custom validation rule, how can jquery validation? need apply rule textarea formatted tinymce. validation: http://bassistance.de/jquery-plugins/jquery-plugin-validation/ $("#element").click( function(e) { console.log(tinymce.activeeditor.getcontent()); $("#someform").validate({ rules: { title: { required: true } } }); }); i'm thinking of using little bit of javascript getcontent() because looks there's effort creating workaround jquery validation working tinymce. thoughts on possible solutions? the following stackoverflow questions should on issue: validating multiple tinymce editor jquery validation form tinymce field gives no error empty value

c# - Why am I able to use a method name instead of a delegate in this argument? -

public delegate void handlerdelegate(int val); public class process { public static void execute(handlerdelegate del) { del(5); } } class program { static void main(string[] args) { //handlerdelegate handler = task; first process.execute(task); // works - how? } public static void task(int val) { console.writeline(val); } } i understand delegate reference method, how able pass looks method name method accepts delegate argument? its 1 of many ways of instantiating delegate for example: public delegate void del<t>(t item);//delegate public void notify(int i) { }//instance method different ways instantiate above delegate del method notify del<int> d1 = new del<int>(notify); or del<int> d2 = notify; more info here

php - Inbreeding-immune database structure -

i have application requires "simple" family tree. able perform queries give me data entire family given 1 id member in family. simple because not need take account adoption or other obscurities. requirements application follows: any 2 people not able breed if they're same genetic line needs allow addition of new family lines (new people no previous family) need able pull siblings, parents separately through queries i'm having trouble coming proper structure database. far i've come 2 solutions they're not reliable , out of hand quite quickly. solution 1 involves placing family_ids field on people table , storing list of unique family ids. each time 2 people breed lists checked against each other make sure no ids match , if checks out merge 2 lists , set child's family_ids field. example: father (family_ids: (null)) breeds mother (family_ids: (213, 519)) -> child (family_ids: (213, 519)) breeds random person (family_ids: (813, 712, 122, 767)) -...

visual c++ - callback function design C++ -

i'm trying implement callback manager can register , execute callbacks different classes, each classes different dll. each of these classes derives common base class. know how single class can make use of template class below register , call own function, how can applied use on multiple classes sharing same callback manager? any appreciated. file: callbacktemplate.h ------------------------ #include <functional> #include <string> template <class cinstance> class ccallbackmanager { private: typedef void (cinstance::*tfunction)(); typedef std::map<std::string, tfunction> funcmap; funcmap i_funcmap; public: void setfunpointer(std::string funcname, tfunction function) { i_funcmap.insert(std::pair<std::string, tfunction>(funcname, function)); } void getfunpointer(cinstance& obj) //how call without knowing type? { (funcmap::iterator = i_funcmap.begin();it!=i_funcmap.end(); ++it) { (obj.*(it->second))(); } } }; file:example.h --------------- #inclu...

java - HtmlUnit submitbuttonClick is not working, it works in my apache tomcat and not in the client -

it works fine me when trying run on clients server not clicking button. if clicks don't know happen not redirect on second page. same page not second page have make while loop click around 10 times not work works in system. please me sort out this.. confused on this. don't know wrong..and if code wrong not run in system works perfectly. if using click() method, won't affect on current htmlpage object, returns new instance of htmlpage . need assign new instance existing htmlpage reference: page = button.click(); or assign new reference: htmlpage page2 = button.click();

How to set image border for Layout (RelativeLayout) in Android? -

Image
i want use border image below : set border layout ...? should ? <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android"> <solid android:color="#ffffff" /> <stroke android:width="1dp" android:color="#000000" /> <padding android:left="1dp" android:top="1dp" android:right="1dp" android:bottom="1dp" /></shape> save file in customborder.xml in drawbale folder. in layout file add line android:background="@drawable/customborder"

android - AutoCompletetextView issue with Nexus (Maybe is 4.0.X) -

Image
my issue have big, enormous list autocomplete. example: store a store b store c store d store f store h store i as can see use store , when start typing store see (...) in phone, can see other stores, if chose 1 inside (...) added autocomplete , not handle onitemclick. there anyway solve this? thanks in advice example pics here store search here clicked store b , can see toast handle onitemclick here can see (...) stores. , can see added autocompletetextview instead of handled onitemclick well ics issue, i'm @ jb issue gone.

WebSphere JVM MXBeans -

when using oracle jvm, can obtain large amount of useful jvm data using provided mxbeans garbagecollectormxbean, memorymxbean etc. same mxbeans available in case of websphere jvm ? thanks in advance. yes, available on websphere, tricky access them remotely. completed documentation explains need know access these mxbeans: http://code.google.com/p/xm4was/wiki/webspherejmx the xm4was project provides tools make easier. following document describes how use them set visualvm monitor websphere jvm: http://code.google.com/p/xm4was/wiki/visualvmhowto

iphone - Can't push viewController after "Popping" it -

i've got code here , works needed. problem when want pop view controller , main screen. when uses [self.navigationcontroller popviewcontrolleranimated:yes]; it's not doing nothing. when use same code works, not way want, 'left right'. this code, have in order make pop view controller in same direction came from? understands puts viewcontroller before 1 i'm working on , pop's it, how can push? when try push error. nsmutablearray *vcs = [nsmutablearray arraywitharray:self.navigationcontroller.viewcontrollers]; [vcs insertobject:levelsview atindex:[vcs count]-1]; [self.navigationcontroller setviewcontrollers:vcs animated:no]; [self.navigationcontroller popviewcontrolleranimated:yes]; you should main screen using [self.navigationcontroller poptorootviewcontrolleranimated:yes];

php - POST FROM immediately -

i have paypal class , echo form , submit after user click pay. i've tried javascript didn't work me. if(isset($_session['user_id'])) { include('includes/class_paypal.php'); include 'includes/class_order.php'; include 'includes/class_user.php'; include 'includes/class_permission.php'; include('includes/adminfunctions_status.php'); $invoice = new paypal(); $order = new order($_get['pay']); $invoice->custom = $_get['pay']; $invoice->amount = $order->price; $invoice->item_name = 'order #'.$order->id.''; $invoice->item_number = $order->id; $invoice->init(); } ?> <script type="text/javascript"> $(document).ready(myfunc () { var frm = document.getelementbyid("order"); frm.submit(); } </script> paypal class var $cmd = "_xclick"; var $business = "**"; var $item_name; var $item_number; var $amount; var $no_shipping = 1; var $n...

c - How execv gets the output from pipe? -

referring old homework question : /* implementing "/usr/bin/ps -ef | /usr/bin/more" */ using pipes. #include <stdio.h> #include <unistd.h> #include <stdlib.h> int main() { int fds[2]; int child[2]; char *argv[3]; pipe(fds); if (fork()== 0) { close(fds[1]); close(stdin_fileno); dup(fds[0]); /* redirect standard input fds[1] */ argv[0] = "/bin/more"; argv[1] = null; /* check how argv array set */ execv(argv[0], argv);// here how execv reads stdin ?? exit(0); } if (fork() == 0) { close(fds[0]); close(stdout_fileno); dup(fds[1]); /* redirect standard output fds[0] */ argv[0] = "/bin/ps"; argv[1] = "-e"; argv[2] = null; execv(argv[0], argv); exit(0); } close(fds[1]); wait(&child[0]); wait(&child[0]); } after redirecting fd standard output, how execv reads it. inbuilt in execv reads standard input before executing command? unable concept. your question based on false premise -- execv doesn't read anywhere, nor nee...

objective c - When to use strong or weak for properties -

i have table view iboutlet , , default xcode sets property strong rather weak . "recieved memory warning" message. tried change many properties strong weak , doesn't seem affect process , things work smoothly. should set outlets weak, or wrong? and importantly, should set all properties nil in viewdidunload method, or iboutlet s? you should set strong properties nil in viewdidunload . weak properties automatically set nil if destination object deallocated. iboutlet can set strong or weak based on requirement. for warning issue facing can provide more details , code? apart link provided josh, there lot of posts on related topic, below: weak or strong iboutlet , other objective-c declared @property attributes (nonatomic, copy, strong, weak) good detailed explanation can found here: http://www.raywenderlich.com/5677/beginning-arc-in-ios-5-part-1 apple docs on topic can found here: http://developer.apple.com/library/mac/#documentation/cocoa/conceptual...

winforms - How to change the back color of tool strip split button in windows form c# -

Image
how change color of tool strip split button in windows forms application. color property not working.. code in designer class.. this.level.backcolor = system.drawing.color.fromargb(((int)(((byte)(128)))), ((int)(((byte)(255)))), ((int)(((byte)(128))))); this.level.displaystyle = system.windows.forms.toolstripitemdisplaystyle.image; this.level.dropdownitems.addrange(new system.windows.forms.toolstripitem[] { this.autotoolstripmenuitem1, this.loadtoolstripmenuitem1}); this.level.image = global::pacs.properties.resources.winlevel; this.level.imagetransparentcolor = system.drawing.color.red; this.level.margin = new system.windows.forms.padding(1, 1, 1, 2); this.level.name = "level"; this.level.size = new system.drawing.size(53, 43); this.level.text = "level"; this.level.textimagerelation = system.windows.forms.textimagerelation.overlay; this.level.paint += new system.windows.forms.painteventhandler(this.window_level_paint); this.level.click += new system.eventhandler...

bitmap - Android: How can I get current screen image on canvas by running app in background using services -

i new in android app programming please body help.. thanx in advance any of activities can draw canvas -- there plenty of answers on cover technique, such as: how take screenshot , share programmatically a service of yours conceivably ask activity of yours draw canvas , unclear why service exists. a service of yours cannot have arbitrary other activities, ones did not write, take screenshot in form.

jquery - How to return the value from ajax -

i have used jquery ajax getting values server.when method goes ajax success or error, need return value.how that.please guide me. $.ajax({ cache: false, async: true, type: "get", timeout:6000, datatype: "json", url:url +"log", data: { contactemail : $("#username").val()}, contenttype: "application/json;charset=utf-8", success: function (result) { //here need return result , should in method }, error: function (e) { //here need return result , should in method } }); update for example when called checknetconnection() ,it return value.i need function checknetconnection() { var netresult=0; var networkstate = navigator.network.connection.type; var states = {}; states[connection.unknown] = 'unknown connection'; states[connection.ethernet] = 'ethernet connection'; states[connection.wifi] = 'wifi connection'; states[connection.cell_2g] = 'cell 2g connection'; states[connection.cell_3g] = 'cell 3g co...

c# - How can I cast to IEnumerable in simple.data? -

i have query in simple.data var db = database.open(); ienumerable<guid> recetas = db.factura .all() .where(db.factura.obrasocialplan_id == obrasocialplanid) .select(db.factura.id) .cast<guid>(); and i'm getting cannot implicitly convert type 'simple.data.simplerecord' 'system.guid' how should change query? you can't enumerable, can materialise list this: var db = database.open(); ienumerable<guid> recetas = db.factura .all() .where(db.factura.obrasocialplan_id == obrasocialplanid) .select(db.factura.id) .toscalarlist<guid>(); if want laziness, can pass enumerable somewhere without having run query, please raise issue on github page: http://github.com/markrendle/simple.data/issues thanks.

How to get piece by piece data from WCF service -

i have created .net app allows query iis logs of web servers. app calls wcf service data. wcf service location has iis logs in place. wcf service internally calls logparser on iis log files , returns result. there multiple iis log files. if run logparser on of them in 1 go, takes lot of time return there 30 huge iis log files queried. want run logparser on each of these iis logs 1 one , return result 1 one. i looking framework works on wcf , allows piece piece data retrieval wcf service. want result of iislogfile1, of iislogfile2, , on. otherwise ui have wait long time full result in 1 go. do know of existing framework allows part part retrieval of data wcf service? ps: workaround have call service multiple times, once each iis log file, till responses data sent. looking cleaner solution. this question seems related scenario, see if answer steven cheng helps you. gist of answer can try duplex services server can call client when completes processing each log file. edit: als...

php - How to do the same operation until it reaches one condition -

how same operation until reaches 1 condition? example: <?php $n = rand(5,157); if ($n=='63'){ echo 'ok'; } else { //* random, until rand () give 63 *// } ?> how can fix this? in advance! you need use while loop : <?php $n = rand(5,157); while ($n != 63) { $n = rand(5,157); // n not 63, number } echo 'ok'; ?> if check condition once, whereas while check condition until not true

internationalization - cakePhp and multi languages -

i creating website in cakephp 2.2. new framework. need help, step step how create multilanguage page. have created translations in locale/eng/lc_messages.default.po , same fre. what's next? can set language display? can write language displayed user? thank help! you have to: create files , folder follows: /app/locale/eng/lc_messages/default.po (english) /app/locale/fre/lc_messages/default.po (french) in default.po files need create pairs: msgid "hello" msgstr "en translation" with this, every hello word replaced en translation. next have set language i.e. configure::write('config.language', 'fre'); if want set language page, paste in bootstrap file, if want change during exploring webpage paste this: $this->session->write('config.language', 'fre'); in beforefilter function in controller.