Posts

Showing posts from August, 2014

eclipse - How to assign NFP values to properties of MARTE stereotypes in Papyrus UML models -

i've stereotyped element of model marte::marte_designmodel::hrm::hwlogical::hwcomputing::hwprocessor. however, not understand how specify operating frequency papyrus. property should nfp_frequency instance, can't see how use papyrus editor create nfp_frequency instance , assign 'frequency' property. there question similar on so: using marte gqam stereotypes in papyrus uml models . however, there no answers. can shed light on this? thank in advance -- matteo if right operating frequency should interval have many possibilities depending of used tool... i using topcased 5.3.1 , modelio 3.1 , both tools allow me set string value of op_frequency specified [freq1 .. freq2]. under other modelling tool guess should able refer uml interval 2 instance (one min , other 1 max). hoping helps, ebr

r - can the value.var in dcast be a list or have multiple value variables? -

in files dcast.data.table , there note stating new feature has been implemented: "dcast.data.table allows value.var column of type list" i take mean 1 can have multiple value variables within list, i.e. in format: dcast.data.table(dt, x1~x2, value.var=list('var1','var2','var3')) but error: 'value.var' must character vector of length 1. is there such feature, , if not, other one-liner alternatives? edit: in reply comments below there situations have multiple variables want treat value.var . imagine example x2 consists of 3 different weeks, , have 2 value variables such salt , sugar consumption , want cast variables across different weeks. sure, can 'melt' 2 value variables single column, why using 2 functions, when can in 1 function reshape does? (note: i've noticed reshape cannot treat multiple variables time variable dcast does.) so point don't understand why these functions don't allow flexibility i...

sas macro - SAS DI (Data Integration): Inserting a Data in an existing Table -

i have program in sas 9.3 (please refer below) need in sas data integration studio: %macro sqlloop; proc sql; select distinct(date) :raw_date raw; quit; %do k= %sysevalf("&raw_date"d) %to %eval(%sysfunc(today())-1); proc sql; insert consolidated (branch_cd, rc_name, date) select branch_cd, rc_name, &k. raw; quit; %end; %mend; %sqlloop; to in sas data integration studio, did step , code inside "user written" below: raw ------> user written -----> table loader -----> consolidated %let output= &_output; %let mysyslast= &syslast; %macro sqlloop; proc sql; select distinct(date) :raw_date &mysyslast; quit; %do k= %sysevalf("&raw_date"d) %to %eval(%sysfunc(today())-1); proc sql; insert &output (branch_cd, rc_name, date) select branch_cd, rc_name, &k. &mysyslast; quit; %end; %mend; %sqlloop; however, receiving error in running in sas di. ...

machine learning - Bayes Classifier -

Image
hello, totally confused in deriving bayes classifier. normally, given problem 1 above number of red dots , green dots , calculate feature distribution f(x). how can same when binary distribution graph below: here class variable y∈(red,blue) , feature variable x∈(-4,4). joint distribution of p(x,y) shown in plot. (p(x,y=blue) , p(x,y=red)). now, how can derive , plot feature distribution p(x). intuitively, it's not hard see p(x) depends on p(y) . example, if p(y=blue) = 1 , then p(x) = p(x | y=blue) (in words, if know y blue, probability density plot x given blue plot posted). , similarly, if p(y=red) = 1 , then p(x) = p(x | y=red) since y binary class variable, distribution can specified single probability, p(y=blue) = p , since imply p(y=red) = q = 1-p . given result above, it's not hard believe if p(y=blue) other 1, p(x) should mixture of p(x | y=blue) , p(x | y=red) . in fact, makes sense should linear mixture: p(x) = p * p(x | y=blue) + ...

php - Function taking Comma separated values in variable as a single string -

i m trying filter product in product magento ce 1.7. im fetching values wanna filter multi dimensional array foreach ($artist_productids $artist_productid){ $artist_product_id[] = $artist_productid['mageproductid']; } $artist_prodidstring = implode(',',$artist_product_id); and passing magento query $categoryproducts = mage::getmodel('catalog/category')->load($currentartcat) ->getproductcollection() ->addattributetoselect('*') // add attributes - optional ->addfieldtofilter('status', array('neq' => 2)) ->addattributetofilter('entity_id', array('nin' => array($artist_prodidstring))); while debugging fount passing value as array('47,48,49,112,113,114,115,116') it should pass array(47,48,49,112,113,114,115,116) how should solve ! why imploding array string , passing $artist_prodidstring = implode(',',$artist_product_id); and using as array('...

ios - Does GMSMapView:clear dealloc all GMSMarker objects? -

does method [gmsmapview clear] dealloc gmsmarker objects or still kept in memory. i reckon method sets property map nil , object still in memory. knows that? class reference of gmsmarker

Storing timezone in mysql date format -

i want store current timezone in mysql date datatype. example, 10-apr-2014 10:12:41 ist what want is: date_format('10-apr-2014 10:12:41 ist','%d-%b-%y %h:%i:%s **timezone**') i searched date_format , str_to_date formats didn't find mention of timezone. is there way able this?? want ist appear @ end of date , time! please help! mysql not have dedicated data type storing timezone information. you have choice of either: store timezone in separate field (additional table column), preferred way store date, time , timezone varchar, make sql queries based on date , time harder , slower.

Secure PHP code on IIS -

my web application going installed @ customer's iis7 server. application built in php , mysql , responsible synchonizing data among mobile devices of multiple users. each user may send request iis7 server , receive updated data. every company have instance of web application installed @ proprietary server. i interested in preventing might have access php code of web application (i.e. system administrator) stealing or altering code. know of way achieve this? there similar obfuscation php?

Enable/Disable buttons in jQuery -

i have function i'm enabling or disabling buttons. var managebuttons = function(status) { if(status === 'inactive') { $("input[type='submit'], button").addclass('inactive').attr('disabled', true); } else { $("input[type='submit'], button").removeclass('inactive').removeattr('disabled'); } }; instead of passing status 'inactive' or 'active', want pass boolean values true & false. i want managebuttons(true) or managebuttons(false) instead of managebuttons('active') or managebuttons('inactive'). how can that?? on please?? or suggest better approach?? you use: var managebuttons = function(status) { $("input[type='submit'], button").prop('disabled', status); };

java.lang.UnsatisfiedLinkError when loading topaz dll in OSGI environement -

i'm trying load dll in equinox osgi environement using system.load() , path dll file correct java.lang.unsatisfiedlinkerror . managed load dll when placed in system32 folder. using : system.loadlibrary(). the dll works fine when experiment plain java main class , there's no need programmaticaly load dll since eclipse . is there specific osgi prevents me loading dll ? any chance jvm loading dll twice? cause unsatisfiedlinkerror on second try.

php - Data from a form don't register in a database (Yii framework) -

i have view: ... <div class="row"> <?php echo $form->labelex($model,'content'); ?> <?php $this->widget('application.extensions.ckeditor.ckeditor',array( 'model'=>$model, 'attribute'=>'content', 'language'=>'en', 'editortemplate'=>'full',)); ?> <?php echo $form->error($model,'content'); ?> </div> <div class="row"> <?php echo $form->labelex($model,'status'); ?> <?php echo $form->dropdownlist($model,'status', array('0' => 'not published', '1' => 'published')); ?> <?php echo $form->error($model,'status'); ?> </div> <div class="row"...

multithreading - Non blocking looper class in android -

looper class in android blocks thread. used execute tasks , when arrived. in case tasks delivered looper thread intermittently, there time gap between tasks. time gap not fixed, changes per user interaction. not want infinite loop of looper class run when there not task, since consume resources. there way such thread executes task , when arrives without blocking thread ? no. that's idea , function looper. holds thread ready dispatch new tasks ( runnable ) when available. if want thread other function, need send runnable thread via looper.

php - Generate input submit for each column from sql table -

i have mysql table 34 columns , need submit button each 1 value identical column name in order perform sql query on submit. example: <input type="submit" name="column1" value="column1" /> <input type="submit" name="column2" value="column2" /> //etc. is there method generate inputs automatically required names , values? automatically generate new submit input when add column table? the farthest i've come this: $connect = mysql_connect("localhost","user","pass"); mysql_select_db("db1"); $query = mysql_query("select * tb1"); echo "<input type="submit" name="$db" value="$db" />"; this is, of course, absolute rubbish. but, saying, far i've come. appreciated. you need loop through results , echo input button inside it. also, can display button each column in table, need know how many columns ta...

Save file in Windows Phone (pdf, csv) -

i'm trying find way save files (pdf or csv) presented in application. want files available outside app. know impossible save file sdcard, in isolated storage. there nothing file manager in windows phone, right? maybe there possibility save file cloud app? saving outside of app doesn't appear coming until wp8.1. in wp8 have few alternatives. save pdf locally , launch associated app viewing per answer . use cloud service saving file. easiest way i've come across integrating cloudsix app dropbox. details on how integrate nuget package here . it's simple if need fire-and-forget saving.

apache - redirect all subdomains from http to https -

i redirect http requests subdomain https using following code. <virtualhost *:80> servername subdomain.example.com redirect 302 / https://subdomain.example.com </virtualhost> now problem how do subdomains. for example http:subdomain1.example.com should go https:subdomain1.example.com , http:subdomain2.example.com should go https:subdomain2.example.com how do subdomains without having create 1 virtualhost of them update i found redirectmatch takes regular expression. know how using regex? you this: <virtualhost *:80> servername subdomain.example.com serveralias *.example.com rewriteengine on rewritecond %{http_host} ^(.+)\.example\.com$ rewriterule ^(.*)$ https://%1.example.com/$1 [r=302,l] </virtualhost> the serveralias allow vhost act wildcard, can extract subdomain(s) host header , include them in rewrite https

security - The frame requesting access has a protocol of "http", the frame being accessed has a protocol of "swappedout". Protocols must match -

i'm getting strange error in console on locally hosted website (hosted in iis). browser google chrome. have clue what's going on here , how rid of error? cheers, edit: restarting google chrome has made error go away... nice know why there in first place though, looks odd...

How do I more properly integrate an exception into my code, and future code? (C++) -

i've begun programming c++ competitions in school, state, etc. i've not had lot of practice , i'm still fresh c++, , i've run issue programs if character entered instead of numerical value, loop run continuously without asking input. program wrote basic chemical conversion bars: #include "stdafx.h" using namespace std; class exception : public exception { public: exception(string m = "exception!") : msg(m){} ~exception() throw() {} const char* what() const throw() { return msg.c_str(); } private: string msg; }; int _tmain(int argc, _tchar* argv[]) { // 'n' stands numerator , 'd' stands denominator int choice; float n1; float n2; float n3; float n4; float d1; float d2; float d3; float answer; while (true) { cout << "select how many conversion bars have: " << endl; cin >> choice; if (choice == 1) ...

r - What do plot options `ljoin` and `lmitre` do? -

Image
in r's ?par 2 options ljoin , lmitre documented. when setting them different values, not see difference. not understand description either. please provide illustrative example these options , when useful? from 1 of older readmes: ’lend’, ’ljoin’, , ’lmitre’ control cap style , join style drawing lines (only noticeable on thick lines or borders). currently, postscript, pdf, x11, , quartz respond these settings. so let's try pdf("mitre.pdf") par(ljoin=0) y=c(0,1,0,5,0) plot(y,lwd=20,type="l",ylim=c(0,10)) par(ljoin=1) lines(y+2,lwd=20,type="l") par(ljoin=2) lines(y+4,lwd=20,type="l") dev.off() and here real mitre (never have used it) pdf("realymitre.pdf") par(ljoin=1) # lmitre active ljoin=1 y=c(0,30,0) x=c(-1:1) plot(x, y,lwd=10,type="l",ylim=c(0,40),xlim=c(-20,20)) par(ljoin=1, lmitre=30) # default lmitre=10 lines(x+4,y,lwd=10,type="l",ylim=c(0,40)) dev.off()

report - executing dataset and assigning it to variable with beforefactory method birt -

i have dataset returns 1 value. max value query. want assign value report variable before other datasets opened. because have measure in datacube needs variable. this situation following: have table exchanges come in @ daily basis around 2pm. in form user need select currency wants out of list. want search currency in exchange rate table , give latest currency. (for example, user gave in usd, birt needs check in currency table source currency , usd destination , on). wrote query gives 1 value. can't assign value variable because datasets loaded. value variable remains 0. can me please! thanks in advance , greetings belgium

awk - Return number of records per file after processing multiple files -

i have following code runs on multiple tab delimited text files. sums amount particular field , counts number of records per file (processing multiple files). output filename,sum of field, count of records - per file. works well. issue instead of getting count of records per file, getting cumulative count of whole batch of files processed. how can fix this? tried replacing 'nr' 'fnr'. didn't work. i calling awk through .bat file awk -f sumcolumnrecordcount.awk *.txt this code in awk file begin { fs="\t" } { sum[filename] += $42 } end { (i=1;i<argc;i++) printf "%s %15d %d\n",argv[i],sum[argv[i]],nr >>"output.txt" } running .bat file in windows 7 gawk (gnu awk?) try quick adaptation of code (should work gnu<4 , non-gnu awks): begin { fs="\t" } { sum[filename] += $42 last[filename] = fnr } end { (i=1;i<argc;i++) printf "%s %15d %d\n",argv[i],sum[argv[i]],last[a...

Create and access custom PHP function from jQuery post in Wordpress -

i have custom js file runs in head of wordpress installation successfully. need run jquery post request file php file can return value database. where create php function? have used functions.php file add custom js file start with, don't want new function run every page load, when requested. once i've created php function wherever, how access through jquery post request? i'm used using local paths wordpress screws up! i'm finding feet in wordpress. reasonably capable developer in codeigniter etc wordpress seems make obscure , overly complicated! appreciated! edit ------------- i have created custom functions file in plugins folder per this article) need know how access function within file js file in header! if understand correctly, trying use jquery http post request wordpress app when event happens in browser. technique known ajax (asynchronous javascript , xml). javascript in browser communicates server without refreshing page , can more logi...

c# - How to log the user out at timeout event -

the website has forms authentication timeout , session timeout. after timer expires nothing happens, seems working fine. after pressing button requires server response, user gets logged out. instead user should logged out (or login pop-up should shown) directly when timeout event happens. can resolved without javascript? 'session_end' won't work because website hosted on multiple servers. no, wouldn't reasonable implement without javascript. it achieved minimal javascript. that, mean work on server , javascript initiates check can't see implementing without javascript.

xml - Xpath2.0 selecting first and last occurance of string with iteration -

i have tree: <events> <properties> <property descriptor=100>1378314022</property> <property descriptor=200>abc1234</property> </properties> <properties> <property descriptor=100>1378314023</property> <property descriptor=200>abc1234</property> </properties> <properties> <property descriptor=100>1378314024</property> <property descriptor=200>abc1234</property> </properties> <properties> <property descriptor=100>1378314022</property> <property descriptor=200>123456</property> </properties> <properties> <property descriptor=100>1378314023</property> <property descriptor=200>123456</property> </properties> <properties> <property descriptor=100>1378314024</property> <property descriptor=200>123456</property> </properties...

java - ArrayList removes only content and not element -

i've written code similar this: arraylist<string> somearraylist = new arraylist<string>(); .... .... inserts elements somearraylist .... .... int location = 4; somearraylist.remove(location); it has size of 5, when run through this, removes content @ position 4, size doesn't change, keeps being of 5 , when 4th element shown empty. should else erase position 4 or what? edit logcat before removing: 04-14 15:03:41.790: w/system.err(22971): [1, 2, 3, 4] 04-14 15:03:41.790: w/system.err(22971): [1396850896.089319.jpg 04-14 15:03:41.790: w/system.err(22971): , 1396850896.47272.png 04-14 15:03:41.790: w/system.err(22971): , 1396850897.830785.jpg 04-14 15:03:41.790: w/system.err(22971): , 1396850895.729823.jpg 04-14 15:03:41.790: w/system.err(22971): ] logcat after doing somearraylist.remove(location); 04-14 15:03:41.790: w/system.err(22971): [1, 2, 3, 4] 04-14 15:03:41.790: w/system.err(22971): [1396850896.089319.jpg 04-14 15:03:41.790: w/system.err(229...

xml - debugging xslt transformation which is invoked from java using eclipse -

lets say, have input xml, needs transformed output xml(for sake of discussion, let consider output html) using xsl file, transformation triggered java code using javax.xml.transform.transformer , invoking transformer.transform(source xmlsource, result outputtarget) method. my question is, in situation there way debug xsl tranformation(i mean facility can set break-point in xsl file in java class). i know xslt debugging available in eclipse doesn't suffice above situation,i guess(since talk input xml , xsl file, anyway can correct me if wrong)

java - mapping superclasses and subclasses with hibernate (JPA) -

i trying persist objects in database using hibernate jpa. the objects have type hierarchy, , i'm trying make work hibernate. a catalogpackage object has important properties , getters. catalogpackageimpl ( extends catalogpackage ) object has no properties, of setters. both classes non-abstract. we want code refer catalogpackage objects. when initializing hibernate, complains setters missing catalogpackage class. how suggest hibernate use subclass when building objects? i don't want move setters superclass, , don't want use catalogpackageimpl entity. even though can't see problem defining setter methods in catalogpackage since can marked private avoid using them external world. since didn't paste entities configuration , hibernate complaining setter methods can conclude using getters describe entity mapping, right? in such case hibernate still complaining because assumes anything mapped database should done in both directions , if ...

Javascript page redirection and session -

i have signup javascript function. correct redirect user(private page of user) through windiw.location function? work inside session scope? append httpcookie while redirecting request? function signup() { var uname = document.forms[0].email.value; var pass = document.forms[0].password.value; var xmlhttp; var response; var url = "/v2/application/userlogin?fromclient=web&"+"email="+uname+"&password="+pass; if (window.xmlhttprequest) {// code ie7+, firefox, chrome, opera, safari xmlhttp = new xmlhttprequest(); } else {// code ie6, ie5 xmlhttp = new activexobject("microsoft.xmlhttp"); } xmlhttp.onreadystatechange = function() { if (xmlhttp.readystate === 4 && xmlhttp.status === 200) { response = xmlhttp.responsetext; //alert(response); w...

android - LibGdx Setting Velocity -

how can set linear velocity in x direction without effecting motion of y direction body in libgdx box2d. applied impulse body make jump want move towards right or left tried applying following method: setlinearvelocity(vector2) but stopping vertical motion. thanks just retrieve current velocity via getter, manipulate , set new one. vector2 velocity = body.getlinearvelocity().cpy(); velocity.set(500, velocity.y); body.setlinearvelocity(velocity);

java - Trying to sub-type classes using generics -

i having problems trying create sub-type class, , calling superconstructor arraylist of objects of generic type. trying code work. want subtypes accept list of genericobjects of type x . public class subtype extends supertype{ public subtype(arraylist<genericobject<y>> g) { super(g); } } public class supertype { public arraylist<genericobject<?>> data = new arraylist<genericobject<? extends x>>(); public supertype(arraylist<genericobject<? extends x>> series) { data.addall(series); } } class genericobject<t extends x>{} class x{}; class y extends x{}; i error super(g) called. says the constructor testgenerics.supertype(arraylist>) undefined thats kind of strange because thought generics allowed kind of thing. if don't pass through arraylist of generic object, , pass generic object through ok. public clas...

android - How is it possible to set weight 1/3 for a RelativeLayout with a minWidth ? -

i think title enough explicit let's explain again. i have relativelayout , gridview i've set weights @ 1/3 first 1 , 2/3 second, on screens relativatlayout isn't wide enough, question, how can make sure relativelayout has enough place ? thanks. wrap relativelayout inside linearlayout allow can use weights then

Jquery mobile get json from .php file workes locally but not on server -

i working on jquery mobile project , want load json. json comes .php file. problem not load. my .php file looks this. <?php $query=mysql_query("select * `data`"); while($data=mysql_fetch_assoc($query)) $output['result'] []=$data; header('content-type: application/json', true); echo json_encode($output); ?> i tried 2 different methods inside jquery: $.ajax({ url: "http://www.example.com/jsonfile.php", datatype : "json" }).success(function(data){ $.getjson('http://www.example.com/jsonfile.php', function(data) { here little recap. when using local .json file works. when call same file on server not. error is: the character encoding of plain text document not declared. document render garbled text in browser configurations if document contains characters outside us-ascii range. character encoding of file needs declared in transfer protocol or file needs use byte order mark encoding...

java - How to move entity from one database to another using openjpa? -

i trying move entity objects 1 database without success. example code: entitymanagerfactory emffrom = persistence.createentitymanagerfactory(frompu); entitymanager emfrom = emffrom.createentitymanager(); entitymanagerfactory emfto = persistence.createentitymanagerfactory(topu); entitymanager emto = emfto.createentitymanager(); //code create sql example 'select row order row' order entity query q = emfrom.createquery(sql); for(object o: q.getresultlist()) { emfrom.detach(o); emto.persist(entity); } this results in: exception in thread "main" >org.apache.openjpa.persistence.entityexistsexception: attempt persist detached object "order-1". if new instance, make sure version and/or auto-generated primary key fields null/default when persisting. failedobject: order-1 @ org.apache.openjpa.kernel.brokerimpl.persistinternal(brokerimpl.java:2628) @ org.apache.openjpa.kernel.brokerimpl.persist(brokerimpl.java:2571) @ org.a...

python - Adding spaces on word boundaries in text extraction with lxml -

an example lxml.html documentation: >>> lxml import html >>> root = html.fragment_fromstring('<p>hello<br>world!</p>') >>> html.tostring(root,method='text') 'helloworld!' my question: there easy (or "right") way producing 'hello world!' string instead? you can try approach: from lxml import html doc = html.document_fromstring('<p>hello<br>world!</p>') br in doc.xpath("*//br"): br.tail = " " + br.tail if br.tail else " " doc.text_content() this prints: 'hello world!'

postgresql - How to subtract seconds from postgres datetime -

say have column of type datetime value "2014-04-14 12:17:55.772" & need subtract seconds "2" seconds o/p "12:17:53". select '2014-04-14 12:17:55.772'::timestamp - interval '2 seconds'; for greater flexibility possible mutiply interval select '2014-04-14 12:17:55.772'::timestamp - 2 * interval '1 second'; if want truncate second select date_trunc( 'second', '2014-04-14 12:17:55.772'::timestamp - interval '2 seconds' );

android - RTSP Protocol for tv live streaming -

this code make streaming rtsp link doesn't work link works other one link worked : rtsp://masds03.htc.com.tw/99min_h264.3gp my link not worked : rtsp://mtaintl.mpl.miisolutions.net:1935/mtaintl-live-1/ definst /mp4:mta3_300k.stream uri stream = uri.parse("rtsp://masds03.htc.com.tw/99min_h264.3gp"); intent videointent = new intent(intent.action_view,stream); startactivity(videointent); your link uses tcp port 1935. rtmp port number. sure link uses rtsp streaming protocol? rtsp://mtaintl.mpl.miisolutions.net:1935/mtaintl-live-1/definst/mp4:mta3_300k.stream

javascript - Scope variable not accessible (undefined) - AngularJS -

i setting scope variable in 1 controller, changing location view. in controller of new view scope variable no longer accessible, states 'undefined'. have added simplified version of problem below , appreciate help. app.controller('logincontroller', function ($scope,$location){ $scope.loginuser = function (user) { $scope.userid = "userid"; $location.path('/view3'); } }); controller view 3 app.controller('videolistcontroller', function($scope){ alert("userid: "+$scope.userid); }); the value of $scope.userid appears 'undefined '. doing wrong? you can use $rootscope global access in angularjs take @ this app.controller('logincontroller', function ($scope,$rootscope,$location){ $scope.loginuser = function (user) { $rootscope.userid = "userid"; $location.path('/view3'); } }); app.controller('videolistcontroller...

VLCJ on Mac OSX Unsatisfied Link Error (darwin/libvlc.dylib) -

i'm trying initialize vlcj streaming part of application i'm working on. going official tutorial , i'm using following code try , load library: nativelibrary.addsearchpath( runtimeutil.getlibvlclibraryname(), "/applications/vlc/contents/macos/lib" ); native.loadlibrary(runtimeutil.getlibvlclibraryname(), libvlc.class); when run it, following error: exception in thread "main" java.lang.unsatisfiedlinkerror: unable load library 'vlc': jna native support (darwin/libvlc.dylib) not found in resource path (/users/iamparker/documents/workspace/vlcstreamer/target/classes:/usr/jar/vlc/vlcj-3.0.1-javadoc.jar:/usr/jar/vlc/vlcj-3.0.1-sources.jar:/usr/jar/vlc/vlcj-3.0.1-test-sources.jar:/usr/jar/vlc/vlcj-3.0.1-tests.jar:/usr/jar/vlc/vlcj-3.0.1.jar:/usr/jar/vlc/jna-4.1.0.jar:/usr/jar/vlc/jna-platform-4.1.0.jar) @ com.sun.jna.nativelibrary.loadlibrary(nativelibrary.java:220) @ com.sun.jna.nativelibrary.getinstance(nativelibrary.java:322) @ com...

sql - Joining tables multiple times with ANSI Compliance -

i'm converting oracle proprietary code ansi standard. within 1 of older queries within clause had these statements: is ansi compliant? where ee.person_code = p.person_code , eo.exam_code = ee.exam_code , ed.exam_code = eo.exam_code , ee.board_code = eo.board_code , eo.board_occurrence = ee.board_occurrence , eo.board_code = ed.board_code i tried following: from people p inner join exam_entries ee on ee.person_code = p.person_code inner join exam_occurrences eo on ee.exam_code = eo.exam_code inner join exam_details ed on ed.exam_code = eo.exam_code inner join exam_entries on ee.board_code = eo.board_code inner join exam_occurrences on eo.board_occurrence = ee.board_occurrence inner join exam_details on eo.board_code = ed.board_code the latter query keeps running , never produces results. understandable guess, i'm trying join tables , rejoin them. how fix above result if first 1 not ansi compliant? the use of join conditions in where clause is ansi-co...

java - Quick alternative to lots of if statements -

i'm beginner @ java, , i'm making simple program type in something, , if type in matches 1 of things on "database" it'll print text. there simpler way check rather doing this: int 1; int 2; int 3; etc. if([user input].equals("1")) { system.out.println("test"); } 400 times. use switch statement or hashmap. switch statement: readable, compiles (if not identically) if-else chain. switch([user_input]) { case 1: system.out.println("test"); break; case 2: system.out.println("hello"); break; // , on. } hash map : more readable , simpler. preferred. // initialization. map<integer,string> map = new hashmap<integer,string>(); map.put(1,"test"); map.put(2,"hello"); // printing. string s = map.get(user_input); if (s == null) system.out.println("key doesn't exist."); system.out.println(s);

linked list - ListView adapter LinkedList<class> -

i have problem code. have class: public static class categoria{ int id; string descr; } and linked list of class: list<categoria> categorie=new linkedlist<categoria>(); i need create listview contains values of field "descr" of list. how can it? thanks, andrea

objective c - Timer that is triggering an Alarm After 35 seconds -

i need timer, that's declared nstimer triger alarm. created neidend filets in vector.h (my viewcontroller.h). i'm trief that: if(timer == 35) {alert =[[ uialertview alloc] initwithtitle: @"end" message: nil ....]} else { } but doesn't work! please help! benedict if understood correctly, have sam problem had. want start alert after x seconds, or? mean? if yes, here solution! regards julian! do in viewcontroller.m -(ibaction)start:(id)sender { timer = [nstimer scheduledtimerwithtimeinterval:30 target:self selector:@selector(alertstart) userinfo:nil repeats:no]; } -(void) alertstart { alert = [[uialertview alloc]initwithtitle:@"end" message: nil delegate:self cancelbuttontitle:@"cancel" otherbuttontitles: nil]; // above setup alert [alert show]; [timer invalidate]; timer = nil; }

javascript - Fancybox thumbnails not working -

im having problems fancybox thumbnails. im doing calling fancybox gallery thumbnails helper fancybox iframe. dont know if problem, cant seem make thumbnails appear. show in media gallerie have. not on normal gallery. im using php loop put each of images. here code. have each of iframe(.various) gallery(fancybox-thumb) , media player thumb helpers(fancybox-media) $(document).ready(function() { $(".various").fancybox({ maxwidth : 800, maxheight : 400, fittoview : false, width : '70%', height : '70%', autosize : false, closeclick : false, openeffect : 'none', closeeffect : 'none', afterclose : function() { var name = sessionstorage.getitem("name"); if (name == 'folder 1') { $('.fancybox-thumb').fancybox().trigger('click'); } if (name ==...

Unable to discard all local files in git -

i have 2 files in working directory. want discard these files can switch branches. there many helpful guides online, , have tried every answer can find remove these files, yet still persist. user@machine:~/code/foo$ git status changes not staged commit: (use "git add <file>..." update committed) (use "git checkout -- <file>..." discard changes in working directory) modified: src/test/foo.c modified: src/test/bar.c commands have tried based on other stackoverflow questions. git reset git reset --hard head^ git stash save --keep-index git stash drop git checkout head -- $(git ls-files -m) git clean -f git clean -dfx git checkout -- . git checkout -- * git checkout 123456 git reset --hard 123456 git reset head --hard amazingly, after every command, find files still present! user@machine:~/code/foo$ git status changes not staged commit: (use "git add <file>..." update committed) (use ...

json - Problems renderingJSON posts with Ember frontend, Sinatra racked with Grape backend -

currently i'm having little trouble rendering json posts in ember, structure of app has config.ru file @ front, public folder ember content inside. app works, won't render posts, worked sinatra + ember since racked grape i've been having trouble. appreciated thanks. config.ru: require 'sinatra' require 'json' require 'grape' require 'sinatra/base' $posts = {} $posts[123] = {:title => "rails omakase", :id => 123, :_id => 987, :author => "d2h", :publishedat => date.new(), :intro => "there lots of la carte software environments in world. places in order eat, must first on menu of options order want.", :extended => "i want orm, want template language, , let's finish off routing library. of course, you're going have know want, , you'll have horizon expanded if order same thing, there is. it's popular way of consuming software.\n\nrails not that. r...

c - avr-gcc never returning main optimalization -

somewhere read if never return main() loop, can spare ~66 bytes compiler switch in avr-gcc , couldn't find site anymore. this embedded: main() { while(1) { // stuff } } for gcc can use special attribute indicate function not return: int main() __attribute__ ((noreturn)) { (;;) { // stuff } __builtin_unreachable (); } optionally can add __builtin_unreachable (); indicate part of code can never reached. although in cases recognised optimisation flags, without such while(1) can generate more code for(;;) .

java.lang.NumberFormatException: with JSP App and mySQL -

hi i'm getting above error when trying insert data database jsp application here jsp code <%@page contenttype="text/html" pageencoding="utf-8"%> <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <title>books database</title> <link rel="stylesheet" href="style.css" type="text/css"> </head> <body> <br> <div class="navigator"> <a id="currenttab" href="index.jsp">add</a> <a href="delete.jsp">delete</a> </div> <% string empfirstname = request.getparameter("empfirstname"); string empsurname = request.getparameter("empsurname"); string dpddept = request.getparameter("dpddept"); string extensionno = request.getparameter("extensionno"); string mobileno = request.getparameter("mobileno...

twig - HTML Formatting not working in symfony 2 -

i have symfony 2 form in back-end have rich text field tiny mce editor. data type of field varchar in database table. when prints content on front side formatting not work. shows plain text rather html formatted content. how prints: < p >< strong >hello< /strong >< /p > how should print: hello any solution? to print variable contains html characters, code string use escape (which default in symfony) {{ content|escape }} to print variable contains html characters, none code string use raw {{ content|raw }}

python - Flask app.add_url_rule in decorator error -

i have bunch of decorators in flask routes trying condense 1 (including @app.route ). i have following @route function: from functools import wraps def route(route, method): def decorator(f): print 'decorator defined' print 'defining route' app.add_url_rule(route, methods=method, view_func=f) print 'route defined' @wraps(f) def wrapper(*args, **kwargs): print 'hello' # stuff here such authenticate, authorise, check request json/arguments etc. # these passed along route , method arguments above. return f(*args, **kwargs) return wrapper return decorator and sample route: @route('/status', ['get']) def status(): return response('hi', content_type='text/plain') the route getting defined, wrapper() never gets called, odd. when move app.add_url_rule outside of decorator end of file, wrapper() gets...

java - how to transmit user variables to paint method -

i'm new there might many problems in code below. should take user written text text field , draw morse code it. gets text, transmits string in chararray form class, paint method doesn't draw anything(variables not recognized in paint method!!). input: constructor gets link(or in that)of other class, char string, , place number in string output: last 3 rows drawn, other variables outside paint method not recognized! here class doesn't work: public class procesare extends canvas{ morse fereastra; string lit="",cod=""; char car; int nr; public procesare(morse parinte,char c,int i){ fereastra=parinte; car=c; // or without "this" doesn't seem transmit values class nr=i; //this.lit=string.valueof(c); switch (c){ //this part testing values transmited, works case 'a': fereastra.canv.setbackground(color.orange); ...

c# - Are there multiple ways to group radio buttons in Windows Forms? -

Image
i have few radio buttons in form should connected, want 1 of them in separate container group other related inputs. here general look: is there way group fourth radio button other 3 though in own group box? fact radio buttons mutually exclusive when within same parent. being said can think of 2 options. let them in same parent, handle paint event of parent , draw manually giving impression different groups. you have manually manage mutual exclusion :( radiobuttons no magic, set checked property of other radio's false behind scenes. private list<radiobutton> radiobuttons = new list<radiobutton>(); //populate radios interested, call hookupevents , should work private void hookupevents() { foreach(var radio in radiobuttons) { radio.checkedchanged -= performmutualexclusion; radio.checkedchanged += performmutualexclusion; } } private void performmutualexclusion(object sender, eventargs e) { radio senderradio = (ra...

c# - var labels = this.Controls.OfType<Label>(); Control all labels except 1 -

i have maze game uses labels walls , .intersectswith handle colision. problem since "player" label messes things code. want player able move meanwhile cant colide other labels. what problem is part makes player unable move reason. never mind if () break experiment. var labels = this.controls.oftype<label>(); foreach (var label in labels) { if (label.bounds.intersectswith(player.bounds)) { break; } if (player.bounds.intersectswith(label.bounds)) { namespace mazegame { public partial class form1 : form { bool down; bool left; bool right; bool up; public form1() { initializecomponent(); } private void panel1_paint(object sender, painteventargs e) { } private void form1_keyup(object sender, keyeventargs e) { } private void form1_keydown(object sender, keyeventargs e) { if (e.keycode == keys...

ocean - Structured archive with multiple domain objects that inherit from common class -

i'm writing ocean plugin petrel , need persist custom domain objects, , seems point using structured archive data source. i've created common class hold lot of standard domain object stuff (droid, name, color, image, comments, history, etc), avoid rewriting every domain object create. ocean development guide has simple examples of classes no inheritance, given has version number, foresee potential problem when base class version different version of inherited-class-1 different inherited-class-2, , update in base class. is possible use structured archive common base class? there special considerations versioning, or else need aware of? eta: simple class diagram showing relationships , stuff i've tried public abstract class classa | ----------------------------------- | | public class classb : classa public classc : classa public class classd { private list<classa> _myclassaobjects; ...