Posts

Showing posts from September, 2013

date - Java: Group arraylist records by derived attribute -

i have arraylist created input csv file, in calculations performed generate more columns afterwards printed csv file. in arraylist, 1 of attributes unix time stamp. record comprises of 7 different days. want group records day, if it's not in order, order groups time (the specifics, i.e. hours, minutes, seconds). so, input csv file, extracted unix timestamp using delimiter, e.g. 1442327884 , used code retrieve day java.util.date time = new java.util.date((long) timestamp * 1000); // gives result of tue sep 15 22:38:04 sgt 2015 string date = string.valueof(time.getdate());; // gives result of "15" a method used calculation grouping follows map<string, list<string>> groups = data.stream().collect(collectors.groupingby(e -> e.split(",")[1])); how set groupby string date mentioned above? you check out radix sort . kind of sorting you're looking for.

Android native webrtc app stream quality -

i have problem android application using webrtc. in general working correctly on devices quality of stream terrible. using io.pristine:libjingle:9127@aar lib establish webrtc connection - compiled version of official webrtc android lib. for example on nexus 5 video quality awesome 20-25% usage of cpu. on se sp quality terrible, cpu arround 50% (so still power available). both devices working on same wifi network. as far know webrtc should pick video quality own, there way manually ? i use following on ios limit framerate , resolution, giving library more room scale bitrate instead. // initialize video constraints nsmutablearray *m = [[nsmutablearray alloc] init]; nsmutablearray *o = [[nsmutablearray alloc] init]; [m addobject:[[rtcpair alloc] initwithkey:@"minwidth" value:@"640"]]; [m addobject:[[rtcpair alloc] initwithkey:@"minheight" value:@"480"]]; [m addobject:[[rtcpair alloc] initwithkey:@"maxframerate" value

javascript - Change color of text in pop up message box -

i have message box pops display message if field left blank on form. want change color of writing red protected void displaymsg(string msg) { string script = "<script>$(document).ready(function () { $(\"<div>" + msg.replace("'","").replace("\"","")+ "</div>\").dialog({modal: true,title: \"note\",buttons: [ { text: \"ok\", click: function() { $( ).dialog( \"close\" ); } } ]}); });</script>"; clientscript.registerclientscriptblock(this.gettype(), "message", script); } how change color of text? just add style div element, this "<div style='color:red'>" + msg.replace("'","").replace("\"","")+ "</div>\"

Formatting a list of numbers using for loops in python -

so i've got homework assignment i'm having trouble with. we're supposed use nested loops display set of numbers in variety of different ways. need 3 out of 4 of following patterns, , know how make 1. pattern a 1 1 2 1 2 3 1 2 3 4 1 2 3 4 5 pattern b 1 2 3 4 5 1 2 3 4 1 2 3 1 2 1 pattern c 1 2 1 3 2 1 4 3 2 1 5 4 3 2 1 pattern d 1 2 3 4 5 1 2 3 4 1 2 3 1 2 1 (i don't know why c , d won't display right, should have idea) i've got following code make pattern a: for x in range(5): y in range(1, x + 2): print(y, end = '\r') print() any appreciated! what see changing part c , d? there's numbers change along initial space between first number, right? implies need keep track of # of spaces in loop. , b, if can piece algorithm 1, can other. hint: what's initial starting point

Python Multithreading how to set 1 pool to run tasks as a queue -

i want make 1 pool run tasks should follow queue , order. import multiprocessing import time def func(msg): in xrange(3): print msg time.sleep(2) if __name__ == "__main__": pool = multiprocessing.pool(processes=1) in xrange(10): msg = "hello %d" %(i) pool.apply_async(func, (msg, )) pool.close() time.sleep(50); print "sub-process(es) done." it can print something. there not come 1 one. done immediately actually runs @ different time. show @ same time.

ios - STHTTPRequest "& char" how i can send this char to a php page? -

my ios app have send/retrive date throught php pages. example call usingi sthttprequest : __block sthttprequest *up = [sthttprequest requestwithurlstring:[nsstring stringwithformat:@"%@%@",pathserver,@"retrivedata.php"]]; up.encodepostdictionary=no; up.postdataencoding=nsutf8stringencoding; up.postdictionary = @{@"name":@"name", @"surname":@"surname"}; it's ok until decide insert lik : up.postdictionary = @{@"name":@"na&me", @"surname":@"surname"}; in way a print_r($_post); in retrivedata.php results in: array ( [name] => na [surname] => surname ) the name cutted @ "&" char index. have tried no success like: utf8_encode/utf8_decode($name) it seems name arrives retrivedata.php cutted, can't use chars conversion/encoding... in sthttprequest have tried set: up.encodepostdictionary=yes; with setting can send "&"

linux - Merge two Json files with awk in bash -

i try merge 2 json files in 1 file, 1 condition, e.g : if file 1 has example : testa:result>fail , file b contains same line different result e.g : testa:result>pass, file 1 update results file 2, have line awk command merge files without condition : awk 'begin{print "{"} fnr > 1 && last_file == filename {print line} fnr == 1 {line = ""} fnr==1 && fnr != nr {printf ","} fnr > 1 {line = $0} {last_file = filename} end{print "}"}' json_files/* > json_files/all_merged.json please need this. i suggest use python task. consider example: import json pprint import pprint filename1 = "file1.json" # file1 contains { "testname": "color", "result": "fail" } filename2 = "file2.json" # file2 contains { "anothertestname": "color2", "result": "pass" } filenameto = "file3.json" def visualize(dat

Partial messages with SockJS in Spring-Websockets 4.2 -

i using spring-websockets 4.2 sockjs. since messages received clients can quite large, use partial messages. subclass of textwebsockethandler override supportspartialmessages return true. however, since sockjswebsockethandler created spring not support partial messages, still error code=1009, reason=the decoded text message big output buffer , endpoint not support partial messages . as workaround, i've increased buffer size 1 mb described here , since have support quite large number of clients (~2000 @ same time), requires way memory. is there way use partial messages sockjs? looking @ you're trying do, buffering 2 gb (assuming 1mb) in ram concurrent messages. need change infrastructure, scale vertically or compress message streams. if compressing messages or scaling vertically out of question, think best approach to: 1) either use internal load balancing sticky sessions split number of concurrent users between different server instances. or... 2) impleme

tcp - Correct syntax for connecting to SQL Server in SSMS -

Image
i'm having difficult time remotely connecting server. apologize if isn't correct stack post on. i'm on time limit running out here. each time try connect a network-related or instance-specific error occurred while establishing connection sql server. it states connection timed out. have tried following: enabling remote connection in ssms on target machine enabling tcp/ip in ss configuration manager checking port 1433 enabled under ipall in sscm allowing outbound , inbound rules ports 1433, 433 in tcp , udp on both target machine , client machine allowing actual .exe of sql server in outbound , inbound firewall rules restarting sqlserver in services.msc the thing can think of syntax connection incorrect. in ssms while trying link server add: 207.97.213.202:1433\733674-db2\733674-admin linked server field , select sql server under radio button options. i have tried connecting without ip address well your server-name invalid, on

ads api - Is the Pinterest ads API open to all developers yet? -

my company has several customers interested in integrating our marketing software pinterest. i've seen lots of articles pinterest's ads api, closest i've seen being "live" article announcing marketing development partners. is pinterest ads api publicly available, , if so, access when sign regular pinterest developer (and docs)? if not, there notice announcing when be?

mysql - php code for shopping cart -

"hi, have problem here, want know how can put condition in code if want set button disabled if quantity below or equal 0. typed code below. hope can me." <?php $results = $mysqli->query("select product_code, product_name, product_desc, product_img_name, qtyonhand, product_price allitems id <= 4"); if($results){ $products_item = '<ul class="products">'; while($obj = $results->fetch_object()) { $products_item .= <<<eot <li class="product"> <form method="post" action="../../cart_update.php"> <div class="product-content"><h3>{$obj->product_name}</h3> <div class="product-thumb"><img src="../../images/{$obj->product_img_name}" class="img"></div> <div class="product-info"> price {$currency}{$obj->product_price} <fieldset> <label> quantity left: {$obj-> qtyonhand}<b

string - how to declare multiple variable names with loop in c# -

how can declare multiple variable names within loop in c# is there way declare n strings loop i don't have use array..please if can done without array please tell helpful me for example:- string st1 = ""; string st2 = ""; string st3 = ""; string st4 = ""; string st5 = ""; if there way please help well, if interpreting question right, can declare array or list , initialize these elements in loop for example (array) (if want fix number of elements): int n = 10; // number of strings string[] str = new string[n]; // creates string array of n elements (int = 0; < n; i++) { str[i] = ""; // set value "" @ position in array } (list) (if don't want fix number of elements) using system.collections.generic; ... int n = 10; list<string> str = new list<string>(); // creates list of strings // list<string> str = new list<string>(n) set number can hold (bett

c++ - How can I mark the end of a C string? -

here code function: void pattern(char word[200], char aspattern[200]) { (unsigned = 0; < strlen(word); i++) { // unsigned remove warning if (strchr("aeiou", word[i]) != 0) aspattern[i] = '*'; else aspattern[i] = '#'; } basically function replaces consonants in word #'s , vowels *'s, , stores new pattern in aspattern string. however, if display aspattern on screen, shows correct pattern followed bunch of unknown symbols (strlen(aspattern) equals 211 or after loop). believe problem aspattern's end isn't marked , aspattern[strlen(aspattern)] = '/0' doesn't work , don't know else do... i cannot use std::string, please bear me , use c strings. add code aspattern[strlen(word)] = '\0'; either before or after for-loop

c# - What is Use of unassigned local variable error? -

this question has answer here: what “use of unassigned local variable” mean? 10 answers int num1 , num2; bool equel ; equel =((num1 % 10 == num2 % 10 || num1 % 10 == num2 / 10) && (num1 / 10 == num2 / 10 || num1 / 10 == num2 % 10)); console.writeline("enter 2 numbers"); console.writeline("enter first 2 digir number"); num1 = int.parse(console.readline()); console.writeline("enter secound digit numbers"); num2=int.parse(console.readline()); if(equel) console.writeline("the digits of 2 numbers equels"); else console.writeline("the digits of 2 numbers not equels"); error 1 use of unassigned local variable 'num1' d:\project visual studios\consoleapplication6\consoleapplication6\program.cs 15 29 consoleapplication6 you

python - Need assistance on final bit of script if possible -

here prequisites script "generate string n opening brackets ("[") , n closing brackets ("]"), in arbitrary order. need use random numbers. determine whether generated string balanced; is, whether consists entirely of pairs of opening/closing brackets (in order), none of mis-nest. examples: [] ok ][ not ok [][] ok ][][ not ok [[][]] ok []][[] not ok " i have come , thought done, reliased doesnt quite on line because positive result "[]][" can me achieving part "pairs of opening/closing brackets (in order)," #!/usr/bin/python import string import random def brackets(): count = 0 sample = [random.choice(['[', ']', '[]']) _ in range(random.randint(1, 10))] sample2 =''.join([random.choice(['[', ']', '[]']) _ in range(random.randint(1, 10))]) count1 = sample2.count('[') count2 = sample2.count(']') x in sample2: if x == "[":

ruby - Rails 4: ActiveRecord method '_was' for tagging attibutes -

i'm new rails , found attribute'_was' method convenient track model's attribute before changed. but when want find before value of tagging attribute, '_was' method not work. for exemple : i got 3 models article , articletag , articletagging . an article has_many article_tags through article_tagging . i can't use article.article_tags_was article.name_was . dose rails has method before value of tagging attribute? article_tags association. _was works on model attributes. may check whether 1 of associated articletag objects changed with article.article_tags.any? { |tag| tag.changed? }

c# - Consuming java web service getting error -

i getting error while consuming java web service in win form application the error you must provide request body if set contentlength>0 or sendchunked==true. calling [begin]getrequeststream before [begin]getresponse. my code consume java service public byte[] stringtobytearray(string stringdata) { system.text.utf8encoding encoding = new system.text.utf8encoding(); return encoding.getbytes(stringdata); } private void button1_click(object sender, eventargs e) { string data = @"<repositorytype>117</repositorytype> <repositorycategory>0</repositorycategory> <modifiedby>2825</modifiedby> <referencecode>0</referencecode> <fromdate>2015-10-14t11:50:00</fromdate> <todate>2015-10-14t11:51:00</todate>

ios - How can I scale my imagePickerController camera so it fills the whole screen? -

i have hidden camera controls, leaves big black space. resolve this, looking scale camera fills whole screen. don't know why not able this. code. cheers! imagepicker.sourcetype = uiimagepickercontrollersourcetype.camera imagepicker.delegate = self imagepicker.allowsediting = false imagepicker.showscameracontrols = false imagepicker.cameraoverlayview = overlayview self.presentviewcontroller(imagepicker, animated: false, completion: nil) i believe camera aspect ratio 4/3, you'll have apply transform scale in order make camera full screen. let screensize = uiscreen.mainscreen().bounds.size let aspectratio:cgfloat = 4/3 let scale = screensize.height/screensize.width * aspectratio self.imagepikerviewcontroller.cameraviewtransform = cgaffinetransformmakescale(scale, scale);

mysql - Query All Rows Within a Table based on Id's in php -

i have table includes 53 rows, in database. variables in rows int id, varchar var, , int votes. can't figure out how query rows within table array. want able 'var' variable while referencing id. here have far, indeed query first row. (hence id = '1'). <?php include_once "code.php"; $new_array = array(); $sql = mysql_query("select * variables id='1'"); while($row = mysql_fetch_array($sql)){ $new_array[ $row['id']] = $row; }; i tried using loop , sticking variable '1' is, that's not working either. if please show me how var variable referencing of id's great. thanks you declare $new_array each row. should move outside while loop. also, try not use mysql_* functions because deprecated. try mysqli_* or better pdo. include_once "code.php"; $sql = mysql_query("select * variables"); $new_array = array(); //this array should not inside while while($row = mysql_fetch_array($sql)

python - Complex non-linear function minimization with constraints using scipy.optimize.minimize -

this first ever post on stack - after week of scratching head figure it's time ask internet. i'm trying minimize output of complex python function, takes in 3 (or more) coefficients polynomial, , returns slope-squared of plot should, in ideal world, represent flat line. the function not mathematical - uses supplied polynomial modify (by multiplication) astronomical filter throughput curve (e.g. https://www.sdss3.org/images/camera_filters.jpg ), used along model stellar atmospheres calculate bolometric corrections, , plot difference between calculated , observed astronomical magnitude (dm), function of colour (g-r), bunch of stars. essentially, function "getslope()" black box, takes around 12-seconds compute output slope given input polynomial. i've been using scipy.optimize.minimize minimize function , find polynomial parameters return flattest plot. unfortunately, flattest plot seems produced when polynomial returning negative values during range of i

python - How to send data set to multiple rows in same table using save method (in Django 1.8 / SQLLIte )? -

Image
i code project using django 1.8. model class. # encoding: utf-8 django.contrib.auth.models import user django.db import models django.utils.encoding import python_2_unicode_compatible django.utils.timezone import .algo import algo django.http import httpresponse @python_2_unicode_compatible class key_gen(models.model): key_beging_code =models.decimalfield('brand_name +pack_size' ,max_digits=5, decimal_places=2) key_quantity =models.decimalfield("key quantity" ,max_digits=19, decimal_places=10) key_code =models.charfield('key code' ,max_length=50 , unique=true) is_public = models.booleanfield('public', default=true) date_created = models.datetimefield('date created',auto_now_add=true) date_updated = models.datetimefield('date updated',auto_now_add=true) class meta: verbose_name='key_gen' verbose_name_plural='keys_gen' ordering = ['-date_creat

ios - How to manage GPUImage movieFile Processing in background? -

i have implemented gpuimage library apply filters in existing videos, issue application crash when lock device, have set bool variable application current state, bun unfortunately resignactive call after application crash. crash happen in line of code. [self.context presentrenderbuffer:gl_renderbuffer]; can please suggest me best way deal this. -(void)viewwillappear:(bool)animated{ [[nsnotificationcenter defaultcenter]addobserver:self selector:@selector(enterbackground:) name:uiapplicationwillresignactivenotification object:nil]; [[nsnotificationcenter defaultcenter]addobserver:self selector:@selector(didbecomeactive:) name:uiapplicationdidbecomeactivenotification object:nil]; } - (void

c - Using union in yacc file -

i'm trying develop basic compiler , i'm using union yylval follows: %{ #include <string.h> #include <stdio.h> struct info { int line; /* details unimportant */ }; %} %union{ char *str; struct info *ptr; } in lexer definition, have %{ #include "parse.tab.h" %} but when compile generated lexer, following errors: y.tab.h: unknown type name 'yystype'. error: request member str in not structure or union. do need #define yystype well? (i edited original question insert enough information source files make question answerable. mistakes in transcription fault , apologize -- rici.) no. if use %union declaration, must not #define yystype ; bison manual makes clear. however, necessary declarations -- in case, declaration of struct info -- must included in lexer description file ( parse.l ) well. 2 generated files independent of each other, fact struct info declared in parser not make definition automati

Excel Formula or VBA to convert year, month data to actual date -

i have 2 columns (year , month). sample data of year column 2015 @ cell a2. sample data of month column b jun @ cell b2. convert these data date format in column c '2015-06-00` @ cell c2. there formula or excel vba this? first off, 2015-06-00 31-may-2015. if supply 0 day-of-the-month, last day of previous month. typically set first day of month. use date function 1 day_num parameter or datevalue function if stringing text-that-looks-like-a-date. =datevalue(b2 & " 1, " & a2) with 3 letter month in b2, have translate numerical month if opt date function. =date(a2, lookup(b2, {"apr","aug","dec","feb","jan","jul","jun","mar","may","nov","oct","sep"}, {4,8,12,2,1,7,6,3,5,11,10,9}), 1)

sql - WIll Select for update wait locks the rows permanently? -

i have 2 processes accessing same table. each of them runs select update query , wait value set. my question is: if process 1 runs query , locks n rows in table, how can rows released if process 1 crashed before committing? i tried open 2 sessions in sql developer , run select update in 1st session, close it. run same query in 2nd session, , found rows still locked! the locks held transaction last long transaction lasts*. way release them end transaction. what "crashed" mean precisely? in three-tier application, when front-end fails, middle tier cleans closing logical session closes associated transactions. in client-server application, if holder of lock doesn't shut down gracefully, oracle may not aware. dba configure dead-connection detection periodically send ping client verify still alive database can identify dead session exists after few minutes , roll back. if database isn't configured detect problem , client/server application doesn'

Pass parameters from commandline while executing protractor test -

this question has answer here: how test separate environmental name protractor conf js? 2 answers i want execute test can specify browsername, environement name, suite name in execution command follows protractor conf.js browser=chrome env=staging suite=smoke is possible jasmine , protractor , can 1 show me how achieve that? to pass parameters protractor, use --params.cmdvar ="cmdvar" and again use above using browser.params.cmdvar

php - how to connect android with phpmyadmin -

how connect android phpmyadmin? used android studio , wamp server, searched relative information, not know how pick out 1 useful me. insert data mysql php.file, , query data mysql. don't know how connect android phpmyadmin, how upload/ download mysql. connect android phone , computer same network in mobile browser, type ip address of computer port number enter phpmyadmin credentials , access wamp projects

c - Use of type modifiers(near,far,huge) with normal variables -

i used type modifiers(far,near,huge) with normal variables rather pointers , found these pointer type modifiers applicable global normal variable error generated when used variable local block. int near a,far b,huge c; int main() { int d,e,f; // int near a,far b,,huge c; // long int near a,far b,huge c; // long long int near a,far b,huge c; //printf("\n size of a=%d ,b=%d ,c=%d ,d=%d ,e=%d ,f=%d",sizeof(a),sizeof(b),sizeof(c),sizeof(d),sizeof(e),sizeof(f)); printf("\n address of a=%u ,b=%u ,c=%u ,d=%u ,e=%u,f=%u",&a,&b,&c,&d,&e,&f); return 0; } why allowed global variable , not local variable. additionally, variable becomes i.e. becomes pointer,an integer greater range or entirely else. near , far , , huge affect where, , in type of memory, variable stored. since local variables stored on stack, using these modifiers on local variables doesn't make sense. note these features unique 16-bit dos platform. not us

how could I serialize boost tuple? -

when trying broad cast element boost_tuple using boost mpi: broadcast(world,j,0); i have error: /usr/local/include/boost/serialization/access.hpp:118:9: error: 'class boost::tuples::tuple<int, int, int, int, int>' has no member named 'serialize' t.serialize(ar, file_version); what do? thank you. you can analogous does boost support serialization of c++11's std::tuple? alternatively, use c++14 std::index_sequence c++17's generalized fold expressions .

vbscript - TextStream object to copy file -

i have script connects oracle, runs query, , saves output csv. there easy way of make copy of file using existing textstream object? ' execute query set objresultset = objconnect.execute(strsql) ' create filename save query strtimestamp = datepart("yyyy",date) & right("0" & datepart("m",date), 2) & _ right("0" & datepart("d",date), 2) & right("0" & hour(now), 2) & _ right("0" & minute(now), 2) & right("0" & second(now), 2) stroutputfilename = strtimestamp & ".csv" set objfso = createobject("scripting.filesystemobject") set objoutputfile = objfso.createtextfile(stroutputfilename, true) ' loop through each row of recordset , output jobcode download file objresultset.movefirst while not objresultset.eof objoutputfile.writeline (objresultset(0) & "," & objresultset(1))

java - How to fix the error "org.xml.sax.SAXParseException / Content is not allowed in prolog"? -

i have following class 2 methods. openinputstream creates input stream, subsequently fed readdocument create xml document stream. public class xmlreader { protected inputstream openinputstream(final string path) throws ioexception { final inputstream inputstream; inputstream = ioutils.toinputstream(path, "utf-8"); return inputstream; } protected document readdocument(final inputstream stream) throws parserconfigurationexception, saxexception, ioexception { final documentbuilderfactory dbfac = documentbuilderfactory.newinstance(); final documentbuilder docbuilder = dbfac.newdocumentbuilder(); return docbuilder.parse(stream); } } then have following test: public class xmlreadertests { @test public void parsingofmapfiles() throws ioexception, saxexception, parserconfigurationexception { final string[] dirs = new string[] {

httprequest - HTTP requests using c# -

i'm rather new sending/receiving on networks/sockets/network streams , on. i'm making irc program can communicate twitch.tv. have api, , have examples of sorts of requests use different kinds of information. https://github.com/justintv/twitch-api/tree/master/v3_resources one example of requests this: curl -h 'accept: application/vnd.twitchtv.v3+json' \ -x https://api.twitch.tv/kraken/chat/kraken_test_user i have tried research on requests, , sort of understand some, part not find resources make click me. in above example, important parts of request? curl? -h? 1 big command, or 2 commands separated \ @ end of first line? then, biggest question, how send requests 1 above using c#? edit 1: i know getting responses in json. there built in assists receiving/parsing json? and using put change json? (some things in api allow put). for first bit of question, asked important parts it has accept header of application/vnd.twitchtv.v3+json it

MySQL Daemon failed to start. ib_logfile is of different size -

help me, please. server : aws ec2 problem : #sudo service mysqld start mysql daemon failed start. starting mysqld: [failed] vi /var/log/mysqld.log : 151015 05:46:26 mysqld_safe starting mysqld daemon databases /var/lib/mysql 151015 5:46:26 [note] /usr/libexec/mysql55/mysqld (mysqld 5.5.45) starting process 14873 ... 151015 5:46:26 [warning] option 'innodb-buffer-pool-size': signed value 1048576 adjusted 5242880 151015 5:46:26 [note] plugin 'federated' d151015 05:46:26 mysqld_safe mysqld pid file /var/run/mysqld/mysqld.pid ended 151015 05:46:42 mysqld_safe starting mysqld daemon databases /var/lib/mysql 151015 5:46:42 [note] /usr/libexec/mysql55/mysqld (mysqld 5.5.45) starting process 15133 ... 151015 5:46:42 [note] plugin 'federated' disabled. 151015 5:46:42 innodb: innodb memory heap disabled 151015 5:46:42 innodb: mutexes , rw_locks use gcc atomic builtins 151015 5:46:42 innodb: compressed tables

c# - Create DTO by joining EF entity with another object in LINQ -

i have entity framework entity public class entiy { public string entityproperty1 { get; set; } public string entityproperty2 { get; set; } public string entityproperty3 { get; set; } public guid? someid { get; set; } } and otherobject , dto contains properties that'd equal other classes. public class otherobject { public string otherobjectproperty1 { get; set; } public string otherobjectproperty2 { get; set; } public string otherobjectproperty3 { get; set; } public guid someid { get; set; } } public class dto { public string entityproperty1 { get; set; } public string entityproperty2 { get; set; } public string entityproperty3 { get; set; } public string otherobjectproperty1 { get; set; } public string otherobjectproperty2 { get; set; } public string otherobjectproperty3 { get; set; } } in service class iqueryable of entities , send in argument contains enumerable of otherobject. works fine when want create dtos

java - Data Nucleus-MySql Incorrect table definition; there can be only one auto column and it must be defined as a key error -

i using datanucleus mysql project. when try persist object receiving exception incorrect table definition; there can 1 auto column , must defined key error my object design follows plan.class public class plan implements serializable { private static final long serialversionuid = 6653821147113556490l; @primarykey @persistent(valuestrategy = idgeneratorstrategy.identity) @column(name = "id") private long id; @persistent(column = "name") private string planname; @persistent(defaultfetchgroup = "true") @element(column = "features") @unowned private set<planfeature> planfeatures; @persistent(column = "currency_type") private string currency = "usd"; @persistent(defaultfetchgroup = "true") @element(column = "currencies") @unowned private set<currency> currencies; @persistent(column = "cost") private bigdecimal cost = new bigdecimal(0); @persistent(column = "c

java - Multiple Observers observing multiple observables - How to update without instanceof? -

say each of these observers observing different observables. operations observing different too.observers inherit interface update(observable method). observables subclasses inherit class observable(my own, not java implementation). none of observables have similar methods either. over-engineering observer pattern? heres example: observers , b observables 1,2, , 3. observer observing observable 1 , 2. observer b observing observable 3. observable 1 notifies when been instantiated. observable 2 notifies when isworking has been set true via setter observable 3 notifies b when either of setters have been called.

http - Adding Intermediate certificate to Java truststore -

i know java trust store have root ca certs. intermediate certs? i had problem certs , asked here: adding certificate java truststore , sslhandshake and answered me should add intermediate cert truststore. ok understood answer risks of it?is true way import or intermediate cert? for example :-digicert high assurance ca-3

powershell - Update build definition in team foundation 2015 API -

i busy configuring our new tfs 2015 server (on premises) , trying new vnext builds work properly. have powershell scripts increase version number of assemblies. changes buildnumber in tfs calling api method (see tfs rest api ). json body sends new build number (eg. {"buildnumber": "1.0.1.1234"}) , works fine. now have added major, minor , patch version variables in build definition version. once build done should updated , thought same kind of thing , send update api call corresponding builddefinition endpoint. documentation says revision number mandatory have added that. rest added changed variables. api call works, nasty thing update whole definition , clear out other settings did not provide in json body. tried first getting defintion through api, changing json values variables , send didnt work correct also. so know solution this? as workaround did adding dummy build definition (eg. "_projectversion") totally empty except variables , build

php - vBulletin inside Laravel application -

i finished website's transition laravel , left current forum software, vbulletin . right now, website consists of various blade files (all extending main layout). for forum work, had place vbulletin files in /forum directory inside /public , access them directly (having add exception in .htaccess file). so, accessing them directly (by visiting example.com/public/forum/index.php example), loosing laravel functionality. want use methods , controllers have defined in laravel site. current user, profile picture , other stuff. moreover, how can use blade files outside of laravel? example, have common header (which in own header.blade.php file). how can accomplish instead of creating new header.php file , have blade syntax converted html/php? the question(s) above may specific vbulletin, expanded application: how use external application inside laravel, utilising blade syntax , classes / controllers implemented? thanks in advance, ilias

javascript - Serialize a date with AJAX -

how serialize date use ajax? using ajax send date on hidden input textbox , want serialize run query coldfusion. html (automatically receives date) js var tmrwdate = $('#tomorrowsdate'); console.log($(tmrwdate).serialize()); $.ajax({ url: "proxy/tomorrowsdate.cfm", type: "post", datatype: "json", data: {date: tmrwdate.serialize() }, success: function (data) { console.log(data); }, error: function (xhr, textstatus, errorthrown) { console.log(errorthrown); } }); proxy/tomorrowsdate.cfm <cfset session.dealerwork.tomorrowsdate = form.tomorrowsdate > <cfquery name="tomorrowtextarea"> select * dbo.dealer_track_work date_due = <cfqueryparam value="#session.dealerwork.tomorrowsdate#" /> , date_complete null </cfquery> <cfoutput&g

sql - Top 3 per group including 0 -

i have table want return top 3 records errormargin per week commencing in access 2010. the problem i'm having 0 values being ignored , i'd see 1 record in case of ties tie take total number of records on 3. the table have is: nb: vba @ bottom of post create table. tmid weekcommencing errormargin 1 05-oct-15 0 1 12-oct-15 2 3 05-oct-15 1 3 12-oct-15 1 8 12-oct-15 2 9 05-oct-15 0.333333333 9 12-oct-15 4 12 05-oct-15 0 12 12-oct-15 1.5 the sql have @ moment is: select t1.tmid, t1.weekcommencing, t1.errormargin, count(*) qry_rep_errormargin t1 inner join qry_rep_errormargin t2 on t1.errormargin <= t2.errormargin , t1.weekcommencing = t2.weekcommencing group t1.tmid, t1.weekcommencing, t1.errormargin having count(*) <= 3 order t1.weekcommencing, t1.errormargin th

css - Image over CSS3 animation z-index not working -

i want set image on css3 animation. used z-index:55 animation image , z-index:56 top image. cannot it. here want show animation inside tv. important me replace tv image on animation. (for responsive issue avoid used image background) please see example fiddle here multiple problems there: 1 terry commented - elements needs syblings. 2 alireza safain said, need have postion, defined on both elements so fiddle updated this: .tv { position: relative; z-index: 100; } https://jsfiddle.net/s9s1mbxv/1/ this place swirl background still overflow on image. partialy solved setting huge border on tv , offseting top/left, that's bit silly .tv { position: relative; z-index: 100; border: 200px solid #fff; top: -100px; left: -100px; } better solution add white background tv image.

oracle - Issue with parameterizing ROWNUM using OracleCommand (C#) using managed ODP.NET -

i trying parameterise rownum when trying query oracle database using latest odp.net managed driver. sql query "...where rownum <= :rowstolock" when try add rownum parameter shown below: dbcommand.parameters.add("rowstolock", oracle.manageddataaccess.client.oracledbtype.int64, 25 , parameterdirection.input); and try execute query dbcommand.executenonquery() i exception: "additional information: ora-01008: not variables bound" row num number can see in previous stack overflow post: what oracletype of rownum however cannot find oracle.manageddataaccess.client.oracledbtype.number. tried other numeric types availabe in oracle.manageddataaccess.client.oracledbtype enum. i find hard think limitation of managed driver (number type unavailable). code snippet: string sql = "...where rownum & lt;= :rowstolock"; string connectionstring = "my connection string"; oracle.manageddataaccess

php - Invalid Credentials error when trying to add post to blogger using API -

Image
i have trying add post blogger using api since yesterday no luck. here code. when run it, "invalid credentials" error. i have posted screenshot below shows getting key in google developer console. may picking wrong key? code <?php $key = "j7c"; $blog_id = "123456"; $url = 'https://www.googleapis.com/blogger/v3/blogs/'.$blog_id.'/posts/'; $postdata = array( 'kind' => 'blogger#post', 'blog' => array('id' => $blog_id), 'title' => 'this title', 'content' => 'this content' ); $data_string = json_encode($postdata); $head = array(); $head[] = 'authorization: '.$key; $head[] = 'content-type: application/json'; $ch = curl_init(); curl_setopt($ch, curlopt_httpheader, $head); curl_setopt($ch, curlopt_url, $url); curl_setopt($ch, curlopt_returntransfer, true); curl_setopt($ch, curlopt_postfields, $data_string); curl_setopt($c

java - TimeoutException: WebViewClassic.finalize() timed out after 10 seconds -

i use android webview, dynamically added , removed based on timers. have noticed few crashes caused following exception. java.util.concurrent.timeoutexception: android.webkit.webviewclassic.finalize() timed out after 10 seconds @ android.os.messagequeue.enqueuemessage(messagequeue.java:318) @ android.os.handler.enqueuemessage(handler.java:626) @ android.os.handler.sendmessageatfrontofqueue(handler.java:618) @ android.webkit.webviewcore$eventhub.sendmessageatfrontofqueue(webviewcore.java:1873) @ android.webkit.webviewcore$eventhub.access$7200(webviewcore.java:1063) @ android.webkit.webviewcore.destroy(webviewcore.java:1987) @ android.webkit.webviewclassic.destroyjava(webviewclassic.java:2208) @ android.webkit.webviewclassic.destroy(webviewclassic.java:2183) @ android.webkit.webviewclassic.finalize(webviewclassic.java:4266) @ java.lang.daemons$finalizerdaemon.dofinalize(daemons.java:187) @ java.lang.daemons$finalizerdaemon.run(daemons.jav

iOS 9 new back button animation -

Image
so apple brought new functions ios9.. 1 of these tiny black back-button, appears when open app on popup or that. in app user can press button enter settings. new button appears. able register, when button pressed, animation appears, there such black background. there possibility change color of animation-background? as can see, mean button: this black background:

javascript - How to upload multiples image with cloudinary on rails -

i'm facing face problem. please me. wanna upload multiple images cloudinary on rails, used cloudinary's upload widget upload javascript follow link! . so, when upload images, auto upload cloudinary , can't each params image in javascript . want params image save in database . how can them? much! you can set widget's field_name parameter images[] . you'll have images included in params of submitted form array of identifiers of uploaded images.

java - HQL - List country and fetch all the state and currency -

i wanted list countries fetch respective state , currency. conffacade.java public result<list<country>> listcountries() { try { string hql = "select distinct o ocountry o left join fetch o.ostate, o.ocurrency"; list<country> list = em.createquery(hql).getresultlist(); return new result(status.success, list); } catch(exception e) { e.printstacktrace(); return new result<>(status.error, exception.general, e.getmessage()); } } conffacadelocal.java public interface conffacadelocal { public result<list<country>> listcountries(); } this jsp use , code it: listcountries.jsp <% try { initialcontext ctx = new initialcontext(); conffacadelocal conffacadelocal = (conffacadelocal)ctx.lookup("java:comp/env/tomin"); result<list<country>> result = conffacadelocal.listcountries();

html - Table with two tbody's next to each other in table, thead on top -

i want create html table looks this: left context | right context | delete row? ------------------------------------------- 1 [input] [input] y/n 2 [input] [input] y/n 3 [input] [input] y/n this seems simple enough. thing want make rows sortable jquery ui. that's easy enough (call .sortable() on tbody ), find ugly because number moves row. want "real" rows move, without indices (1, 2, 3 , on). numbers should in same spot, rows can move around. i thought make new tbody inside table, after thead, contain numbers, , call .sortable on tbody contains rows. however, doesn't work: tables don't float next each other, placed above each other. any ideas how deal this? test case on jsfiddle : <table class="table table-hover table-striped"> <thead> <tr> <th></th> <th>left context</th> <th>right context&

android - Failed to install *.apk on device 'emulator-5554': No space left on device -

i've seen questions posted issue. understand takes several minutes emulator configure , launch. if i'm getting specific error: i deploy project emulator finding problem at same time,i use genymotion simulator,but don't find on ddms thanks everyone!!!

php - Class not found error in Lithium Framework (li3) -

i using lithium framework. trying call class controller, class placed inside libraries folder.... showing error fatal error: class 'app\libraries\test' not found in /home/ali.mehdi/avontph/app/controllers/sessionsagentcontroller.php on line 34 in libraries folder created test.php having following code. <?php namespace app\libraries; class test{ public static function gettest(){ return "hi"; } } also inside controller.. used following using statements: use app\libraries\test; but why test class not found... missing something? appreciated. as @matei mihai has commented, in app\config\bootstrap\libraries.php add line libraries::add('.') , though i'd advise against (see below). be aware best practice put classes package , not drop them in libraries folder.

Creating users to administer facebook Apps -

this not direct programming question closely related. i'm developing facebook app company , need facebook user administer app. obvioslly don't want use private account. when create new account administer app considered facebook fake user because has no friends/posts/etc , api calls. enough facebook asks verify account phone , after goverment id. even if use real account develop, when job done, whom should transfer administer rights? ceo's real account? secretary's real account? it's looks absurd. can advise me how proper way ? thanks, vadim it's an application must have admin, real world user. i'd suggest add client cto admin.

c# - Prompting User Input and Displaying User Output Using An Array -

i need help. need prompt user enter index between 0 , 9. if user enters outside of array, need use "if" statement or "try catch" tell user "no such score exists". have far. public class program { public static void main(string[] args) { int[] gamescores = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; console.writeline("please enter index between 0 , 9"); int gamescores = int.parse(console.readline()); (int = 0; < gamescores.length;i++) { gamescores[i] = int.parse(console.readline()); } } // end main instead of using loop directly use contains check wheather desired value present in array or not. try out. int[] gamescores = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; console.writeline("please enter index between 0 , 9"); int gamescores = int.parse(console.readline()); if (gamescores.contains(gamescores)) { console.writeline("score exists&q