Posts

Showing posts from June, 2011

Crystal Reports: Formula to pull data point where other specific criteria are met -

i'm positive pretty easy formula i'm quite new cr , having difficult time this...searched answer couldn't find it, please forgive me if has been asked ad nauseam. i have list of patients , each year patient assigned risk score, each patient has multiple scores. data looks this: patient_id score_year risk_score 11111 2013 1.05 11111 2014 0.00 22222 2013 0.07 22222 2014 0.11 33333 2013 1.19 33333 2014 0.00 44444 2013 2.13 44444 2014 0.00 55555 2013 0.30 55555 2014 0.54 66666 2013 1.67 66666 2014 2.31 i want create field assigns single risk score each patient can see data, patients have '0.00' 2014, don't want include. my thought create formula states if [score_year] = 2014 , [risk_score] <> 0 ([risk_score] [score_year] = 2014) else ([risk_score] [score_year] = 2013) hitting brick wall. in nutshell, need formula pu

multiply string by number python -

so have program takes 1 argument, integer num. supposed return number repeats digits of num 3 times. if argument not integer, function should return none. for example: for input argument "hello!", should return none, because input argument string. for input argument "23", should return none, because input argument string. . for input argument 12.34, should return none, because input argument float. . for input argument 1, should return 111 or argument 241, should return 241241241. i don't know i'm doing wrong in mine, appreciated! def repeat_number(num): if num type(str) , type(float): return none else: return str(num) * 3 you're close. there 2 different problems here. first, shouldn't have type check (duck typing), if must, right: if not isinstance(num, int): return none this returns none if argument isn't integer. repeating number, need turn string number: return int(str(num) * 3)

c++ - Two Windows - one modified by thread random output -

i'am trying write code where, window divide 2 pieces , 1 of them modfied different thread, output seems random. ? upper piece of console should modified main, , lower thread k. #include <stdio.h> #include <ncurses.h> #include <unistd.h> #include <thread> #define width 30 #define height 10 int startx = 0; int starty = 0; void kupa (int score_size, int parent_x, int parent_y) { int = 0; window *dupa = newwin(score_size, parent_x, parent_y - score_size, 0); while(true) { i++; mvwprintw(dupa, 0 , 0, "you chose choice %d choice string", i); wrefresh(dupa); sleep(5); wclear(dupa); } delwin(dupa); } int main () { int parent_x, parent_y; int score_size =10; int counter =0 ; initscr(); noecho(); curs_set(false); getmaxyx(stdscr, parent_y, parent_x); window *field = newwin(parent_y - score_size, parent_x, 0, 0); std::thread k (ku

oracle - SQL trigger email unique -

i want create trigger (and not constraint) verify if email exists already. if so, trigger raises error. if not, email inserted table. i started isn't working: create or replace trigger trigger3 before insert on fv_client each row begin if exists (select courriel fv_client courriel=:new.courriel) raise_application_error(-20001,'courriel deja existant, choisir une autre combinaison courriel/mot de passe'); end if; end; due command raise_application_error guess it's oracle database. assuming have table: create table fv_client ( courriel varchar2(48) ); you use trigger: create or replace trigger trigger3 before insert on fv_client each row declare cursor check_curriel select 1 fv_client courriel = :new.courriel; x varchar2(48); begin open check_curriel; fetch check_curriel x; if not check_curriel%notfound close check_curriel; raise_application_error(-20001,'courriel deja exi

Error 1062. Duplicate entry in mysql -

i have mysql table schema in column 1 primary key. have tsv file need insert in table. now, tsv has repetition of primary key hence when try insert in mysql table gives error error 1062 (23000): duplicate entry '107664521128181760' key 'primary' is there way if primary key value exists, should ignore , move further next insertion. you looking insert ignore into command. you can try this: insert ignore yourtablename(col1,col2...) values(val1,val2,...)

sql - update query with inner join [0 rows updated] -

while updating data in table1 inner join returning o row updated , both table in different database. got alternate method update this, don't why inner join query gone wrong. not working inner join update db1.table1 set t1.column3='value3' db1.table1 t1 inner join db2.table2 t2 on t1.column2=t2.column2 (t1.column1 = 'value1') , (t2.column3 = 'value3') working query without using inner join. update db1.table1 set column3='value3' (column1 = 'value1') , (column3 = 'value3') , (column2 in (select column2 db2.table2 column3='value3' , column3='value3' , column4='value4')) db1..table1 column1 column2 column3 column4 c1 c2 c3a c4 c1 c2 c3a c4 c1 c2 c3b c4 c1 c2 c3b c4 db2..table2 column1 column2 column3 column4 c1 c2 c3a c4 c1 c2 c3a c4 c1 c2 c3b c4 can body suggest this? you have syntax error in statement. use alias in set , update part or use tablename, don't mix:

java - html embedded in the pdf is not opening using PdfAction.gotoEmbedded -

//some lines of code here //file embedding pdffilespecification fs =pdffilespecification.fileembedded(writer, new file("").getabsolutepath(), new file("").getname(), null); //atachment writer.addfileattachment(file.getname().substring(0,file.getname().indexof('.')), fs); //getting embedded file pdfaction action = pdfaction.gotoembedded(null, target, dest, true);//dest ** html embedded in pdf not opening using pdfaction.gotoembedded

php - Doctrine ORM - entity implements interface -

i have following problem - in project, have interface called taggableinterface interface taggableinterface { public function addtag(taginterface $tag); public function deletetag(taginterface $tag); public function gettags(); } it implemented entity classes. is there way in doctrine creates relations between entites , tags? if taggable wasn't interface abstarct class, able solve entity inheritance.. without doctrine use party/accountability design pattern ( http://martinfowler.com/apsupp/accountability.pdf ). if understood properly: want create mapping , implementation interface without using abstract class , repeating code. php have traits. can create trait common implementation of interface. experience know can add doctrine annotations mapping trait , work well. create taggabletrait. behave class or interface. reside in namespace , loaded autoloader if add use . namespace my\namespace; use doctrine\orm\mapping orm; trait taggabletrait { /

javascript - how to get the value passed by $.post ajax in php file -

my ajax call like, var txt=$('#keyword').value; $.post("ajax.php?for=result", {suggest: "keyword="+txt}, function(result){ $("#search_result").html(result); }); in php file, want value of textbox id 'keyword', passed var txt=$('#keyword').value; $.post("ajax.php?for=result", {suggest: "keyword="+txt}, i tried in php file using $_post , $_get method, gives me error 'undefined index' how can value in php file?. provide me example of how using json. you did not post values properly. the proper way of posting values either plain object var txt=$('#keyword').value; $.post("ajax.php?for=result", {keyword: txt}, function(result){ $("#search_result").html(result); }); or string of key=value seperated '&' var txt=$('#keyword').value; $.post("ajax.php?for=result", "keyword="+txt, function(result){

java - Exception in thread "main" adding window to container -

i writing app select random numbers click on jbutton. when run app exception: exception in thread "main" java.lang.illegalargumentexception: adding window container @ java.awt.container.checknotawindow(container.java:483) @ java.awt.container.addimpl(container.java:1084) @ java.awt.container.add(container.java:410) @ final.main(final.java:37) here code: import java.util.arraylist; import java.awt.*; import javax.swing.*; import java.awt.event.actionevent; import java.awt.event.actionlistener; public class final extends jpanel { public static void main(string[] args) { // random numbers have selected arraylist numbers = new arraylist(); numbers.add(40); numbers.add(500); numbers.add(90); numbers.add(10); numbers.add(50); numbers.add(25); // panel gui jpanel panel = new jpanel(); // , of course frame , characteristics jframe frame = new

true type fonts - iOS 8 custom UIFont does not appear in fontFamily listing even though it shows in IB -

in ios 8, xcode6, add custom font, in info.plist. it's there in build phases. it's there in storyboard, not list in familynames. i've read every other stack overflow post on several times. the file codbard.ttf. actual postscript name codabard. for (nsstring* family in [uifont familynames]) { nslog(@"%@", family); (nsstring* name in [uifont fontnamesforfamilyname: family]) { nslog(@" %@", name); } } it's not there. and line of code produces nil result uifont *customfont = [uifont fontwithname:@"codabard" size:20]; you have use font somewhere in xib or storyboard i create blank xib , add labels use desired font, don't use xib nowhere, loads custom fonts

php - How parsing out XML file with namespaces? -

i know similar questions posted before, can't parse out xml file namespaces. here link because it's big post here: https://tsdrapi.uspto.gov/ts/cd/casestatus/sn86553893/info.xml i tried using simplexml_load_file not create xml object. found similar problems , try this, provided downloaded file named 86553893.xml here php code: $xml= new simplexmlelement("86553893.xml"); foreach($xml->xpath('//com:applicationnumber') $event) { var_export($event->xpath('com:applicationnumbertext')); } you have register namespaces on each element want use them: $xml= new simplexmlelement("86553893.xml"); $xml->registerxpathnamespace('com', 'http://www.wipo.int/standards/xmlschema/common/1'); foreach ($xml->xpath('//com:applicationnumber') $event) { $event->registerxpathnamespace( 'com', 'http://www.w

C++ multiple member function callbacks without using std::bind, std::function or boost -

i have application requires 1 or many member functions of object used callbacks when hardware event occurs in monitoring object. callbacks require no arguments. normally use boost or standard library functions (std::function, std::bind) wrap member function called cant use them (boost, c++11) not supported or allowed on platform. im not sure of efficiency either thats off-topic. in short, have written class (monitorswi) spawns thread wait hardware events. hardware event , callback configured when object created such many other objects, such devicemanager below can utilise encapsulated functionality. apart using bind, method have base class pure virtual handler implemented child object. however, of 'devicemanagers' handle multiple swis require different handlers. the method using have static member redirects particular object instance , specified handler swi. i have written simple example unnecessary code stripped out: #include <iostream> class monitorswi

javascript - Add header to <img> GET -

is there way add header standard html tag? what have is: /path/to/image.png except restful endpoint, , requires userid header. get /path/to/image.png header userid: bobloblaw this returns bytestream , poof, image. however, hope use right in image tag. possible without apache forcing outgoing userid? i'm hoping like imageprovider.get().then(function(response) { // resultant bytestream }) note - not base64 transcoding. it's actual image stream. no, that's not possible. don't control request headers browser sends along request <img> tag. use query parameter in url.

javascript - How to select value of dropdown using jQuery -

i have dropdown using boostrap. need store value select dropdown in variable, i'm trying print it. window.alert($("#list_userinput_location option:selected").val()); it displays 'undefined'. if this: window.alert($("#list_userinput_location option:selected").text()); it displays empty string. tried this: window.alert($("#list_userinput_location").val()); displays 'undefined' again. so confused.......... thoughts? edit: here's fiddle https://jsfiddle.net/qmsqu/11/ in response jsfiddle: https://jsfiddle.net/qmsqu/12/ $("#list_userinput_location").val() is correct css selector , .val() returns content of value="..." . not text inside <option> tag. this requires <select> element has id of "list_userinput_location", i.e. <select id="list_userinput_location">

python - Comparing scikit learn clusterings using a decision tree -

i doing project class take data libsvm , run through 2 different clustering algorithms. have kmeans generating 8 clusters, while agglomerative grouping them 3 clusters. now, i'm trying tell if cluster labels generated kmeans can used predict cluster labels generated agglomerative clustering, e.g. instances in cluster #6 map cluster#1 agg clustering. my professor has advised use of decision tree classifier i'm not quite sure how this. know take agg clustering labels class labels , input data , see how classified. questions lie , have several: 1) scikit learn decision tree classifier output? list of probabilities each instance might classified as? or explicitly classify each instance? 2) after input data , each instance has been classified 1 of 3 clusters generated agg, how go in , find out clustering belonged kmeans? 3) there better way this? need "compare clusters produced different methods in quantitative way" don't need use decision tree classifie

java - How to refactor inner class MouseAdapter? -

suppose have file this: import javax.swing.jpanel; import java.awt.event.mouseadapter; public class foo extends jpanel { private int m; private int n; private int o; public foo() { this.addmouselistener(new bar()); } class bar extends mouseadapter { // ... // methods here access , modify values of private // instance variables. // ... } } obviously can add simple accessors , mutators foo gets tedious fast , breaks encapsulation. how can refactor inner class while keeping damage encapsulation minimum? if these classes seem big, should split them. first step in splitting them stop relying on private instance variables of outer class. could, say, add public getters , setters, better have foo implement public interface of bar, , have bar talk interface. , initialize each bar self. public class bar extends mouseadapter { public interface caller { void thingclicked(); ..

javascript - WebComponentsJS with IE10 -

i trying use webcomponentsjs http://webcomponents.org/ . unfortunately, information on topic , website extremely messy , difficult ascertain. browser support matrix on website says no ie support. matrix on github says has ie support, 2 of 4 categories "flaky" (and don't mention means): https://github.com/webcomponents/webcomponentsjs the bower version of library doesn't work @ me in browser due reported bug ( https://github.com/webcomponents/webcomponentsjs/issues/180 ). issue fixed, didn't seem have made new release. used webcomponents.js file master branch , works in modern web browsers such chrome , firefox. unfortunately, doesn't seem work @ ie10 (simply renders nothing, there no errors). tried example web component ( http://webcomponents.org/hello-world-element/ ), , not render in ie. looking @ github page, seems indicate might , @ least partially, work in ie10. point is, wording across project extremely vague , contradictory. that l

c++ - GoogleTest Parameterized Test - Possible To Call SetUp And TearDown Between Parameters? -

i have gtest parameterized class call setup , teardown in between each parameter. know googletest offers setup before each test case , setuptestcase before test cases. i have this: class myparameterizedtest: public testwithparam<myparams> { public: myparameterizedtest() {} void setup() { //called before every test case } void teardown() { //called after every test case } static void setuptestcase() { //called @ begining of framework , before test cases } static void teardowntestcase() { //called @ end of framework , after test cases } //wishing like: // void setupparameter() { //called before start of parameter } }; instantiate_test_case_p(registrationtest, interfacetest, valuesin(allthevalues::getallmyparams())); any thoughts on way make work? maybe way see when last test case has been run particular parameter? or have instantiate test case every individual parameter? i thin

objective c - ReloadData with expanded items not refreshing children -

i have simple nsoutlineview works nice far. thing did not work when issue reloaddata() . have expanded item , reason reload 1 child added new child not appear. parent refreshed see number of children (which output too) updated. new child not appear. i circumvented behavior collapsing parent when adding or deleting child items. wonder if there trick children refreshed maintaining expansion state of parent is. could use reloaditem:reloadchildren: on nsoutlineview when want reload? if want refresh reload root item passing 'nil' first parameter.

http - At what frequency of updates do WebSockets become more efficient than longpolling? -

i'm working on project, , i'm trying decide whether use websockets or longpolling. this brings interesting question: breakeven point between using websockets instead of traditional http techniques? clearly, if need daily updates, http requests better, real-time updates, websockets better. (i think. correct me if i'm wrong!) let me more specific: assume user experience web app requires user updated in period of time p . additionally, assume using websockets send updates server client, , average json object sent looks ( i'm including because imagine average data size matters): { 'animal' : 'dog', 'people_who_have_petted' : ['foo', 'bar', 'thomas'], 'people_who_like' : ['tom', 'foo', 'bar', 'thomas','john', 'mary'], 'people_who_dislike' : ['jerry','cat', 'banker'] 'user_voted_phrase' : "dogs man's

python - Python3 - getting the sum of a particular row from all the files -

i have many files in directory of below format: name,sex,count xyz,m,231 abc,f,654 ... i trying sum of count(3rd coloumn) files , store them in list. total = [] result = 0 filename in os.listdir(direc): if filename.endswith('.txt'): file = open(direc + '/' + filename, 'r') line in file: line = line.strip() name, sex, count = line.split(',') if sex == 'f': result += int(count) total.append(result) any tips why code doesn't work? trying get: [sum(file1), sum(file2)...] edit: input : file1: xyz,m,231 abc,f,654 file2: wee,m,231 pol,f,654 bgt,m,434 der,f,543 file3: wer,f,432 uio,m,124 poy,f,783 here's code works absolute bare minimum of modifications (that is, no style fixes made): total = [] filename in os.listdir(direc): result = 0 if filename.endswith('.txt'): file = open(direc + '/' + fi

sql - Using DBMS_SCHEDULER.CREATE_JOB within a procedure -

i trying create procedure perform updates on couple tables , schedule procedure run later revert them back. i'm running problem in using dbms_scheduler.create_job. code looks this: create or replace procedure my_procedure(p_duns in varchar2, p_plus_four in varchar2) *some variables* begin *do stuff* p_job_action := 'begin run_other_procedure(' || p_vendor_id || ', ' || p_ccrid || ', ' || nvl(to_char(p_inactive_date),'null') || ',' || nvl(to_char(p_end_date),'null') || '); end;'; dbms_scheduler.create_job(job_name => 'deactive_vendor_'||to_char(p_ccrid), job_type => 'plsql_block', job_action => p_job_action, start_date => sysdate+1, enabled => true, comments => 'calls plsql once'); end; i have verified beginning portion of p

php - Twitter Streaming 401 Unauthorized OAuth -

i'm trying create script uses twitter streaming api keep tab on tweets hash-tag. whenever try creating request though, 401 unauthorized return. can me figure out i'm doing incorrectly? i tried follow twitter's api dot, apparently i'm doing wrong. code have below. $base_url_string = urlencode($base_url); $parameter_string = urlencode('oauth_consumer_key') . '=' . urlencode($consumer_key) . '&' . urlencode('oauth_nonce') . '=' . urlencode($nonce) . '&' . urlencode('oauth_signature_method') . '=' . urlencode($signature_method) . '&' . urlencode('oauth_timestamp') . '=' . urlencode($timestamp) . '&' . urlencode('oauth_token') . '=' . urlencode($token) . '&' . urlencode('oauth_version') . '=' . urlencode($version) . '&' . urlencode('track') . '=' . urlencode(&#

postgresql - Empty string as default value for enum type column instead of nil in Rails -

the problem i'm receiving empty string instead of nil default value enum column in postgresql database, while creating new activerecord object. here more information. my migration: class createtickets < activerecord::migration def change execute <<-sql create type ticket_status enum ('submitted', 'open', 'closed'); sql create_table :tickets |t| t.string :name t.column :status, :ticket_status t.timestamps null: false end end end my model: class ticket < activerecord::base status = { submitted: 'submitted', open: 'open', closed: 'closed' } validates :status, inclusion: { in: ticket::status.values }, allow_nil: true end my goal allow nil value in database table, when i'm trying create new object, i'm receiving "not included in list error": 2.2.0 :005 > ticket.create! (0.8ms) begin (0.5ms) rollback act

Multiple selects and comparisons in sql -

string sql = " select name, surname, orderid, customerid, priority, status, date, time orders o o.customerid in " + "(select loggedin customers loggedin=1)"; i have 2 tables 1 called customer , 1 called orders. in customer table want retrieve people logged in system , match orders table see if have orders pending well. both of these tables contain customerid column contain same values. however, not sure how use , carry out logged in check in 1 statement. above 1 of attempts have made incorrect needs add join customerid's unsure carry out. in addition, sql driver using apache derby in case wondering your query fine need select "customerid" @ end ... in ( select customerid customers loggedin=1 ) but recommend user joins. see users have pending orders: select c.* customers c inner join o

Retrieving login cookie with php curl or c# -

i need programmatically log remote site, login cookie, go site has iframe checks cookie, display dashboard. from gather, process appears be. go login page, retrieve login cookie (zend form) post username , password php form retrieve login cookie (phpsessid) store cookie in web browser file location or open c# view. preferably safari go hosted dashboard iframe, checks cookie. i followed guide , able login first site , output html of page behind form. login website, via c# i tried modifying script use cookie container open request test server have iframe, , open in web browser. not appear work. i believe php curl better way of achieving interacts directly web browser. guessing make storing cookie easier. here c# script, able login. made quick bash command inserts sites url relative src , href references see if page load "test.html" file. not work system.net.cookiecollection cookies = new system.net.cookiecollection(); system.net.httpweb

maven - How to add cookbooks from chef documentation -

i new chef cookbooks , working on task. have completed tutorial on chef.io struggling understand how can install cookbook provided @ chef-io . so of now, have downloaded cookbook. .tar file , extracted it. can see respective default.rb , other files unable how can add cookbook existing cookbooks creating vm image. is there guide or tutorial can follow ? in addition josh's answer sounds me want add chef-repo after downloading , extracting gzip file? just add maven directory cookbooks directory. or knife cookbook site install maven within chef-repo directory. or maybe want upload chef server? knife cookbook upload maven see: https://docs.chef.io/knife_cookbook.html#upload

Does Parse.com offer the same login functionality with web applications as it does for mobile devices? -

i making database use in company. need able set users can log in access information our database whether logging in mobile device or web browser. there separate apps mobile , web. finding plenty of topics , applications built in parse functions make login screen incredibly easy implement, not finding web based applications. use same functionality if automatically implements lot of error handling , security me. 1 know if possible? , if so, can point me in direction need go implementing that? in advance. yes can see in docs https://parse.com/docs/js_guide javascript sdk use create websites

unicode - PHP: Why any non-latin char in iconv gives me "illegal character" error? -

for example: $text = "пд"; echo 'plain : ', iconv("utf-8", "us-ascii//translit", $text), php_eol; outputs plain : notice: iconv() [function.iconv]: detected illegal character in input string in ... i tried add setlocale(lc_ctype, 'en_us.utf8'); but doesn't matter... you need make sure source file saved in utf-8, not windows-1251. otherwise characters won't representing valid utf-8 sequenses. update: right, iconv //translate seems depend on locale. may work correctly if set source language locale. in example, cyrillic locale guess, not 'en_us'. but in fact if need transliteration 1 language, it's more reliable make simple translation table youself: $trans = [ 'а' => 'a', 'д' => 'd', 'п' => 'p', ... ]; $translit = str_replace(array_keys($trans), array_values($trans), $source_string); but if need work all/unknown

java - Shape not stopping at the down boundary -

i have circle i'm dragging around screen. when hits left boundary, stops. when hits right boundary, stops. when hit top boundary stops. when hits bottom boundary, reason, keeps on going. please help. this mouseevents class: public class mouseevents { int x1; int x2; int y1; int y2; int dbmppafx;// difference-between-mouse-pointer-position-and-first-x-position int dbmppafy;// difference-between-mouse-pointer-position-and-first-y-position int width; int height; static boolean inside_; static string whichbound = ""; static string text = ""; mouseevents(int x1, int y1, int width, int height) { this.x1 = x1; this.y1 = y1; this.width = width; this.height = height; this.x2 = x1 + width; this.y2 = y1 + height; } static string hitbound(mouseevents e, int width, int height) { whichbound = ""; if (e.x1 <= 0) { whichbound = "left"; e.x1 = 0; e.x2 = e.x1 + e.width; } if (e.x

java - Groovy regexp doesn't work -

using groovy want match on following: 1 word followed "." followed number. assert 'randomword.[0-9]+' ==~ 'randomword.1' assert 'randomword.[0-9]+' ==~ 'randomword.123' assert 'randomword.[0-9]+' =~ 'randomword.1' assert 'randomword.[0-9]+' =~ 'randomword.123' assert 'randomword\\.[0-9]+' =~ 'randomword.1' none of above works, can explain me why , show me way right? the correct syntax be: assert 'randomword.123' =~ /randomword\.[0-9]+/

Got java.lang.IllegalArgumentException when using data provider pass in TestNG -

here part of data provider method: @dataprovider (name = "dataprovider1") public static object[][] dataprovider1() { return new object[][] { // total sale 0.00 { new object[][]{{msoecommissioncalculator.replacemnet_item, 0.00}, {msoecommissioncalculator.replacemnet_item, 0.00}, {msoecommissioncalculator.replacemnet_item, 0.00}, {msoecommissioncalculator.replacemnet_item, 0.00}, {msoecommissioncalculator.consulting_item, 0.00}, {msoecommissioncalculator.maintenance_item, 0.00}, {msoecommissioncalculator.basic_item, 0.00}, {msoecommissioncalculator.maintenance_item, 0.00}}, 0.00 }, when use data provider like: @test (dataprovider = "dataprovider1", dataproviderclass = msoecommissioncalculatortestdataprovider.class) public void testforprobationary(object[][] sales, float assertcommission) {

javascript - Form submits, inserts data to database but does not then display contents in div -

i have div form in it. when form submitted want data inserted database , results database displayed form underneath can submitted again record added. form submitting , database being populated results not display in div. the div contains inital form (and contain refreshed results list , new form follows: <div id=activitylist> <? $q2a="select activitynumber, title, description, leaders, time activities activities.meetingid='$id' , activities.unitid='$input2'"; $r2a=mysqli_query($dbc,$q2a) or die(mysqli_error($dbc)); echo "<table class='layouttable'><tr><td>activitynumber</td><td>title</td><td>description</td><td>leaders</td><td>time</td><td>edit</td>"; while($row2a =mysqli_fetch_assoc($r2a)) { echo " <tr><td>" . $row2a['activitynumber'] . "</td> <

ios - RESTKIT : deserialize JSON with not all relationship attribute -

i tried deserialize json : {"id":1234, "content": "hi, message", "datesaved":"10/04/2015 11:00", "user":{"id":12}} model : class message: nsmanagedobject { @nsmanaged var content: string @nsmanaged var datesaved: nsdate @nsmanaged var id: nsnumber @nsmanaged var user: user } class user: nsmanagedobject { @nsmanaged var id: nsnumber @nsmanaged var login: string @nsmanaged var mobile: string @nsmanaged var password: string @nsmanaged var picture: nsdata @nsmanaged var messages: nsset } the user saved in ios data base, don't need send data server. problem both rkrelationshipmapping , rkconnectiondescription seem not done kind of works : first works complete objects, can directly operate coredata ; second 1 can used identifier , not object i can not change way server serialize objects json, because other android app works kind of json somebody knows how solv

automation - My PID Controller in Java is not operating correctly -

i looking implementation of pid controller in java , found one: https://code.google.com/p/frcteam443/source/browse/trunk/2010_post_season/geisebot/src/freelancelibj/pidcontroller.java?r=17 so, understand using way: package lol.feedback; public class dsfdsf { public static void main(string[] args) throws interruptedexception { final pidcontroller pidcontroller = new pidcontroller(1, 1, 1); pidcontroller.setinputrange(0, 200); // input limits pidcontroller.setoutputrange(50, 100); // output limits pidcontroller.setsetpoint(120); // target value (pid should minimize error between input , value) pidcontroller.enable(); double input = 0; double output = 0; while (true) { input = output + 30; pidcontroller.getinput(input); output = pidcontroller.performpid(); system.out.println("input: " + input + " | output: " + output + " | error: " +

css - Why does my header and navigation go below my hero image? -

why header , navigation go below hero image? whenever increase size of text on image nav , heading goes down further. if rid of size text goes want it. here html , css. html <!doctype html> <html lang="en"> <head> <meta charset="utf-8" /> <title>amanda farrington</title> <link rel="stylesheet" href="css/demo.css" /> <link href='http://fonts.googleapis.com/css?family=roboto:400,300,500' rel='stylesheet' type='text/css'> </head> <body> <div id="header"> <div id="leftheader"> <img src="assets/logo2.jpg" alt="logo" style="width:65px;height:65px"> <h1>amanda farrington</h1> </div> <div id="nav"> <ul> <li><a href="index.html">about</a></li> <li><a h

node.js - NodeJS AES 256 hex decrypt error -

good day. want use nodejs module crypto decode encoded string. string encoded aes 256 ecb , have hex. attempts did nothing, got null string instead of errors. 'require' crypto, no open-ssl. hex : 820d4da01ce75046c399ca314c5428c6af8d69c6573b4de5a6942a5277936f56 key : 7y05r9qwkaikgihh4vaw19x1zuknr21y here's nodejs code. var algorithm = 'aes-256-ecb', password = '7y05r9qwkaikgihh4vaw19x1zuknr21y', encstring = '820d4da01ce75046c399ca314c5428c6af8d69c6573b4de5a6942a5277936f56' var decipher = crypto.createdecipher(algorithm,password); var dec = decipher.update(encstring,'hex','utf8'); dec += decipher.final('utf8'); console.log(dec); and have error. error: error:06065064:digital envelope routines:evp_decryptfinal_ex:bad decrypt. need please. update after fome hours , priceless advices maarten bodewes , this topic , working solution. var encstring=req.query.d; console.log(encstring); var algorithm = 'aes-2

on Windows Qt Creator where do I enter commands like "cd" "nmake" and "configure" -

i on windows. need make .exe standalone (static) executable completed qt project. according http://doc.qt.io/qt-5/windows-deployment.html to have such things enter somewhere cd c:\path\to\qt configure -static <any other options need> and nmake clean qmake -config release nmake but have no idea this?! do on windows or on qt editor? go start menu, type "cmd" enter. open windows command prompt. that's commands supposed typed.

python - Scraped data into two MongoDB collections--now how do I compare the results? -

Image
complete mongodb/database noob here tip appreciated. scraped data using scrapy straight locally-hosted mongodb server. compare "price" data 1 collection "price7" data in other collection. names field same across collections. best way of doing this? sloppy screenshot of data here: unfortunately can't compare directly between 2 collections in mongo without peppering in fancy javascript. here's example of how accomplish that, https://stackoverflow.com/a/9240952/4760274 since you're using scrapy, , seemingly not comfortable crazy mongodb internals, easy enough whip python script evaluation import pymongo conn = pymongo.connection('localhost', 27017) db = conn['databasename'] item in db.collection1.find(): _id = item['_id'] item2 = db.collection2.find({'_id':_id}) print "{}: {}, {}: {}, diff: {}, a>b?:{}".format( item['name'], item['price'], item1['name&

sql - How to create similarity matrix in Google BigQuery like pdist in MATLAB? -

in matlab , python (scipy), there function (pdist) return pairwise distances between every row of given matrix. so table in bigquery: a = user1 | 0 0 | user2 | 0 3 | user3 | 4 0 | should return user1 user2 user3 dist = user1 | 0 3 4 | user2 | 3 0 5 | user3 | 4 5 0 | or variant (perhaps without diagonal , upper or lower half of matrix since redundant.) the pairs columns acceptable (the approach (my guess far) use self join, not sure how iterate on columns - for example have ~3000 columns ). solution like: dist = |user1 user2 3 | |user1 user3 4 | |user2 user3 5 | also distance metric between users, don't wan't euclidean distance example here, general distance. 1 such distance sum(min(user1_d, user2_d) / diff(user1_d - user2_d)) d dimensions between 2 users. has found google bigquery solution this? there 2 answers: you can wth cross join, , either bu

oop - Method, Function, Operation, Procedure, Subroutine whats the exact difference? -

are there official definitions these terms in oop? or have evolved on time , depending on former computer science education (or age) use 1 or other? so far found definitions of method vs. function : difference between method , function a function piece of code called name. ... data passed function explicitly passed. a method piece of code called name associated object. and function vs. procedure : what difference between "function" , "procedure"? a function returns value , procedure executes commands. a procedure set of command can executed in order. in programming languages, functions can have set of commands. hence difference in returning value part. even if there subtle differences in definition authors main aspect seems be: method operates on object in contrast function gets data passed parameters. if function not return value called procedure . but how subroutine , operation linked these terms? edi

java - Finding AffineTransform origin on screen -

Image
let's have affinetransform ( transform ) , call bunch of it's methods. lets rotate , translate it. transform graphics object ( g2d ) it: g2d.transform(transform); i want find coordinate on my screen new (0, 0) is. if drew rectangle @ coordinates untransformed g2d , 1 transformed g2d overlap. how can point, have math, affinetransform or graphics2d have built in way (i couldn't find one)? you could... create copy of original graphics context ( graphics#create ) (which idea) apply transform copy (this leave original unaffected, don't forget dispose of copy when you're done) import java.awt.dimension; import java.awt.eventqueue; import java.awt.fontmetrics; import java.awt.graphics; import java.awt.graphics2d; import java.awt.geom.affinetransform; import java.awt.image.bufferedimage; import java.io.file; import java.io.ioexception; import java.util.logging.level; import java.util.logging.logger; import javax.imageio.imageio; import javax.swin