Posts

Showing posts from January, 2010

c# - How can I make each array, within an array perform a task? -

i getting data 1 of following names, adam, bob, cam, dan, earl, or fred. i want pairs operate on each other. right have string: string list="adam-bob;cam-dan;earl-fred"; then split them via semicolon string[] splitlist=list.split(';'); now have array of pairs so adam-bob cam-dan earl-fred [0] [1] [2] ideally, perform operation on each of them, instead find can following: split via ',' foreach (string s in splitlist) { string firstperson=splitlist[0]; string secondperson=splitlilst[1]; if (udpoutputdata.contains(firstperson)==true) { //record data string firstperson } if (udpoutputdata.contains(seoncdperson)==true) { //record data string secondperson } //if have data firstperson , secondperson, perform operation , give me output } unfortunately, if name adam, followed cam, operations disorganized. perhaps need automatically create string each name? or there eloquent way of operating data on first array... you array

Javascript regex for known script tag combinations -

another regex question, yes, context implementation within grunt process, known set of files iterate , in files known combinations of script tags. there 0 chance of user interference, , target files not change on time. here combinations want catch in single regex: <script>*</script> <script type="text/javascript">*</script> edit: above combo should exclude: <script src=""></script> <script src="" type="text/javascript"></script> <script src=""></script> <script src="" type="text/javascript"></script> and need second regex catch following: <!--[if lt ie 9]><script>*</script><![endif]--> and third regex catch following: <!--[if lte ie 9]><script>*</script><![endif]--> please don't combine regexes, need different outcomes each. for reference, i've worked way through answ

Efficiently merge 2 large csv files in java by common labels -

i need merge 2 large csv files (approximately 40 million data elements in each ~500mb) common row or column labels, can specified user. example, if dataset1.csv contained: patient_id x1 x2 x3 pi1 1 2 3 pi3 4 5 6 and dataset2.csv contained: patient_id y1 y2 y3 pi0 0 0 0 pi1 11 12 13 pi2 99 98 97 pi3 14 15 16 the user specify merge these 2 files row labels (the patient ids) , resulting output.csv be: patient_id x1 x2 x3 y1 y2 y3 pi1 1 2 3 11 12 13 pi3 4 5 6 14 15 16 since combine information patient ids common (intersection) both input files. strategy problem create hashmap, row or column labels merged (in case row labels, patient ids) keys , data patient id stored arraylist value. create hashmap each input data file , merge values based on similar keys. represent data 2-d arraylist of t

javascript - Animate TR to disappear on ajax request -

i using bootbox create following modal: $("a.delete").on("click", function() { var id = $(this).attr('id').replace('item_', ''); var parent = $(this).parent().parent(); var table = $(this).attr('rel'); bootbox.dialog({ message: "are sure want delete entry?", title: "delete confirmation", buttons: { success: { label: "yes", classname: "btn-danger", callback: function() { $.ajax({ type: "post", url: "", data: 'deleteitem=' + id + '&table=' + table, beforesend: function () { parent.animate({ 'backgroundcolor': '#e3e3e3' }, 400); }, success: function (msg) { if (msg == "suc

Setting a border for react native TextInput -

Image
using react native 0.26, my component this const search = () => { return ( <view style={styles.backgroundimage}> <textinput style={styles.textinput} onchangetext={(text) => console.log(text)} placeholder={"enter search term"}/> </view> ) } and styles : const styles = stylesheet.create({ backgroundimage: { flex : 1, flexdirection: "column", justifycontent: 'center', alignitems: 'center' }, textinput: { justifycontent: "center", alignitems: "stretch", borderrightwidth: 30, borderleftwidth: 30, height: 50, bordercolor: "#ffffff", } }) the problems facing are the border right width , left width not seem have effect , placeholder text begins on left edge. the background of textinput "grey" same view's background. expecting white default, (feels transparent). with ios simulator how bring keyboard

Python 3.5: json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0) -

Image
i have piece of python code: homedir = '/home/cloudera/' baseurl = 'http://ergast.com/api/f1/' apilist = ['seasons', 'results', 'qualifying', 'driverstandings', 'constructorstandings', 'drivers', 'constructors', 'circuits', 'status', 'laps', 'pitstops'] dir in apilist: target = homedir + str(dir) try: shutil.rmtree(target, ignore_errors=true) os.makedirs(target) except: pass parent_url = baseurl + "{y}/{api}.json?limit=100000" parent_fname = homedir + "{api}/{yf}.json" urls = [parent_url.format(y=y, api=a) y, in itertools.product(range(1950, 2016), apilist)] files = [parent_fname.format(yf=y, api=a) y, in itertools.product(range(1950, 2016), apilist)] url, file in zip(urls, files): print(url, file) response = requests.get(url).json() open(file, 'w') f: json.dump(response, f) w

python - Some questions on a function -

def get_party_stats(families, table_size=6): """to calculate number of attendees , tables needed. args: families(list): list of members. table_size(int): table size of 6. returns: mixed: people count & table count. examples: >>> get_party_stats([['jan'], ['jen', 'jess'], ['jem', 'jack', 'janis']]) '(6, 3)' """ table_num = 0 people_num = 0 people in families: table_num += -(-len(people)//table_size) people_num += len(people) return people_num, table_num how people_num return 6 , if len(people) 3 . table_num , having negative signs in -(-len(people)//table_size) , achieve? there way count number of attendees , tables, using simple examples? thank you. since sum on sizes of each family people_num come out len(['jan']) + len(['jen', 'jess']) + le

Set keep-alive in HttpClient in Spring xml -

we using apache httpclient library manage pool of connections java remoting. looking @ tcp traffic, appears keep-alive flag not being set, , our firewall chopping off these connections. our spring config looks this: <bean name="httpclient" class="org.apache.commons.httpclient.httpclient"> <property name="timeout" value="${pdccreditcheck.maxtimeout}"/> <property name="httpconnectionmanager" ref="remotingconnectionmanger"/> </bean> <bean id="remotingconnectionmanger" class="org.apache.commons.httpclient.multithreadedhttpconnectionmanager"> <property name="maxtotalconnections" value="5"/> <property name="maxconnectionsperhost" value="5"/> </bean> i hoping there might flag set here, corresponds tcp keep-alive flag. any appreciated. you might try use jvm flag http.keepalive . more

c++ - Visual Studio cannot open source file inspite of setup -

i'm running vs2015 on windows 10 , i'm having issues include directories. have setup additional include directories in c/c++ -> general , include directories in vc++ directories point right path (f:\boost_1_61_0). keep getting "cannot open source file" error. if move cursor include statement full include path in definition bar points correct address. happens when working google mock . core , stl includes work fine. i've stripped down code try , work on basic boost test code: #include <boost/lambda/lambda.hpp> #include <iostream> #include <iterator> #include <algorithm> int main() { using namespace boost::lambda; typedef std::istream_iterator<int> in; std::for_each( in(std::cin), in(), std::cout << (_1 * 3) << " " ); } i've built code using netbeans adding additional include directory project without issues, not file access issue. compiler used netbeans g++, vs used msvc , t

Use of wildcards in java generics -

i attempting understand java generic wildcards.i came across basic program.it appears me thing can added list s "null". cannot add example s.add(new integer (4)); or s.add(new char(a)); before reading lot of material , confusing mind,i attempting understand java designers going introducing wildcards in generics.from point of view cannot see useful feature coming generic wildcards.it possible appears due lack of experience , since new java.it if people share thoughts on matter. import java.util.linkedlist; import java.util.iterator; public class wildcardexampleone { public static void main(string[] args) { linkedlist<?> s = new linkedlist<integer>(); s.add(null); iterator<?> x = s.iterator(); object o = x.next(); system.out.println(o); /* note linkedlist<?> not same type linkedlist<object> * here statements wouldn't compile: */ // s.add(new int

java - Can't get my image to move using KeyListner -

i'm making pokemon game , class supposed paint map screen , move character around according keystrokes detected on arrow keys keypressed method isn't detecting keystrokes , character won't move. can't figure out. import java.awt.*; import java.applet.*; import java.io.*; import javax.swing.*; import java.awt.event.*; import java.lang.math.*; import java.util.*; import java.util.arraylist; import java.awt.image.*; import java.awt.event.keyevent; public class map extends japplet implements keylistener { image grass; image sgrass; image sand; image chardown, charup, charleft, charright; image finalboss; image drawn; image[][] gr = new image[13][15]; public int x; public int y; javax.swing.timer t; double ttt = 0; double b = 0; public void init() { addkeylistener (this); grass = getimage(getcodebase(),"grass.jpg"); sgrass = getimage(getcodebase(),"non-grass.jpg"); sand = getimage(getcodebase(),"sand.jpg"); finalboss

Consume web service using WSDL in JAVA -

i have been workin in java while, project i'm doing requires data web service(well have never worked in web services befor :d). have wsdl file , link wsdl file. wanted know how call webservice in java program input variables web service. thank in advance. you can generate web service client classes using jaxws utilities , published wsdl e.g. something wsimport -target 2.2 -s c:\temp\outputcode -p com.package.name http://1.2.3.4/jaxsws/wsname?wsdl this put classes c:\temp\outputcode can use in project. look class extending service. have number of constructors allow wsdl location overridden. from service obtain handle (proxy) web service port. (this generated interface methods corresponding web service methods in wsdl). invoke method , call web service. there further information here how wsimport generated client work?

javascript - Using Knockout and Breeze with Cascading Dropdowns -

so i've been @ , forth quite long time now, i'll point. i creating application based on hottowel template, i'm using knockout, breeze, q etc. i'm using breeze query data server, , load data first select (as options). changes selectedmodel observable , subscription triggers ( subscription current "solution", have used data-bind etc same results). subscription takes new selectedmodel value , uses data second observable. query passes , results stored in modelproperties observable array, yet ui not update second select (it's empty). strange thing is, pressing ctrl + f5 (i tried 50 times in row) populates correctly, never on first load. tldr; 2 selects, selected option of first 1 defines query options of second one. queries work, observables populated, first select populated, second never on first boot on following ctrl+f5. here snippets regarding piece of application: viewmodel: define(['services/logger', 'services/datacontext'], fu

android - Xml invalid token error -

i getting invalid token error on following code: <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingbottom="@dimen/activity_vertical_margin" android:paddingleft="@dimen/activity_horizontal_margin" android:paddingright="@dimen/activity_horizontal_margin" android:paddingtop="@dimen/activity_vertical_margin" tools:context=".mainactivity"> <textview android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/hello_world"/> on eclipse ide error red 'x' @ android:paddingleft line. insight appreciated! i deleted project since test. messing textview of xml before that, though. though guys!

java - Conditional write item if attribute not equals with DynamoDBMapper -

is possible conditional write/update using dynamodb mapper when want have condition like: write if attribute not equal x? want conditional write this: dynamorecord record = mapper.load(dynamorecord.class, hashkey); if (record.getsomeattr() != terminationvalue) { mapper.save(newrecord); } the attribute exists. can have multiple values , represents condition after updates record should stop. i read this article , aws documentation , bunch of other posts seems == operator supported along exists check. possible != conditional write using mapper? if so, pointers appreciated. thanks. summary @notionquest's answer use comparisonoperator.ne if attribute boolean, annotate using @dynamodbnativeboolean correct results while using expectedattributevalue(new attributevalue().withbool(true)) . see here details. please use "withcomparisonoperator(comparisonoperator.ne)" notequals condition. refer below example. dynamodbsaveexpression saveexpressio

python - How do I run another script, inside my main script -

i don't know how run script inside main python script. example: index.py: category = "math" print (category) print ("you can use calculator") print ("what 43.5 * 7") #run calculator.py answer = int(input("what answer")) how run calculator script inside of without having write calculator code inside of index script? since other "script" python module (.py file) can import function want run: index.py: from calculator import multiply # import multiply function calculator.py category = "math" print(category) print("you can use calculator") print("what 43.5 * 7") #run calculator.py real_answer = multiply(43.5, 7) answer = int(input("what answer")) calculator.py def multiply(a, b) return * b

ios - file_key parse server does not work -

i have been trying 6 weeks find out how fix problem parse server , legacy pffiles. not looking migrate legacy pffiles, use them in testing , development while parse maintains them. after testing, install s3 file adapter. my app, running ios 9.3, written in objective c , stores images , video , runs fine while connected parse.com site. wanted test parse server , incrementally correct problems completed migration. however, have not been able correct (seemingly simple) failure occurs message {"code":1,"message":"internal server error."}. my mongodb mlab , have appropriately included uri (and login) , filekey parse required. have information in app.config file, in environment of parse server instance on aws, , in appropriate references environment data via index.js file. if query collection not have pffile items, query successful (i.e. normal). however, if query collection has pffiles query fails {"code":1,"message":"in

javascript - Input isn't autofocusing when triggered -

codepen basically want input field contained within div autofocus when opens. @ moment, auto-focus, when div closing. the div input contained trigger 2. <ul> <li> <span class="trigger" data-target-id="target-1">trigger 1</span> <div id="target-1" class="target">target reveal when press trigger 1</div> </li> <li> <span class="trigger" data-target-id="target-2" id="search-trigger">trigger 2</span> <div id="target-2" class="target">target reveal when press trigger 2 <input id="boom" type="text"> </div> </li> <li> <span class="trigger" data-target-id="target-3">trigger 3</span> </li> </ul> <div id="target-3" class="target">thi

php - Doctrine - ManytoMany Filter Result -

i need filter result many many relationship in doctrine. class users extends recorditem { /** * @id @column(type="integer") @generatedvalue * @var int **/ protected $id; /** * @manytomany(targetentity="company") * @jointable(name="users_join_company", * joincolumns={@joincolumn(name="user_id", referencedcolumnname="id")}, * inversejoincolumns={@joincolumn(name="company_id", referencedcolumnname="id")} * ) */ protected $companys; /** * @column(type="string", length=100) * @var string */ protected $username; //edit - > added array collection - forgotten public function __construct() { $this->companys = new arraycollection(); } } class company extends recorditem { /** * @id @column(type="integer") @generatedvalue * @var int **/ protected $id; /*

computer vision - the measurement matrix 's jacobi to velocity should be zero ? -

as state [x v] , x current state , , v state velocity , in transition matrix x(k) = x(k-1) + v(k-1) but in update step , observe has no relationship velocity ,like observe = f(x, else) , f observe function , question measurement jacobi matrix should have ∂f/∂v , should 0 , or ∂f/∂v = ∂f(x+v)/∂(v) ?

Pulling Youtube Live Cast CHAT into c# -

i learn best through examples. could please me quick , dirty example of how pull live chat youtube live stream? (i need able pull out people's questions/comments analysis later.) have looked through partial examples listed i'm bit lost how implement them. basically, need able pull live video chat c# in following format: chat name --- comment i tried creating browser element scrape data, doesn't seem pulling anything. if can provide example me, thank you. if want point me solution has somewhere great! (i wasn't able find after 10+ hours of searching. thank offered.

android - cordova 3.0 FileWriter THREAD WARNING: exec() call to File.write blocked the main thread...should use CordovaInterface.getThreadPool() -

i'm using filewriter , works fine except these messages in logcat when write largish files of various sizes upto 3mb. i had @ fileutils.java source , write function doesn't use getthreadpool() interface (the reader does). as test thought i'd adapt filewriter use runnable interface , able code compile , execute - unfortunately logcat messages still show up... the blocking times between 25ms , 1200ms far. haven't run serious comparison tests determine if change makes real difference - looking absence of logcat messages. would these changes below make real difference? are these message should worry about? my java pretty basic - here changes made - following reader implementation. else if (action.equals("write")) { this.write(args.getstring(0), args.getstring(1), args.getint(2), args.getboolean(3), callbackcontext); } /* original code else if (action.equals("write")) { long filesize = this.write(args.getstring(0), args.getstring

Use twig to filter variable into url -

i have variable {{ name }} outputs treatment & support . need remove & symbol , convert name useable url slug twig example: treatment-support. i have having trouble finding correct twig fitlers. looking @ looking @ http://twig.sensiolabs.org/documentation . far have {{ name |lower }} to reiterate need use twig turn treatment & support treatment-support using {{ name }} variable. any appreciated. you can use twig replace filter : {{ name|replace({' & ': '-', '&amp;': '-'}) }} as @darkbee said in comment, more complex, can use slugify

Python 2.7 - How to compare two image? -

in python 2.7, want compare 2 image same, how this? please show me step step. thanks! there many ways do. using opensource library, opencv , scikit learn , tensorflow . to compare 2 images, can template matching in opencv import cv2 import numpy np matplotlib import pyplot plt img = cv2.imread('img.jpg', 0) img2 = img.copy() template = cv2.imread('img2.jpg', 0) w, h = template.shape[::-1] methods = ['cv2.tm_ccoeff', 'cv2.tm_ccoeff_normed'] meth in methods: img = img2.copy() method = eval(meth) res = cv2.matchtemplate(img, template, method) min_val, max_val, min_loc, max_loc = cv2.minmaxloc(res) if method in [cv2.tm_sqdiff or cv2. tm_sqdiff_normed]: top_left = min_loc else: top_left = max_loc bottom_right = (top_left[0] + w, top_left[1] + h) cv2.rectangle(img, top_left, bottom_right, 255,2) plt.subplot(121), plt.imshow(res) plt.title('matching result'), plt.xticks([]),

c++ - How can I store in a vector<vector<double>> values from a File? -

values txt file i have values .txt file, , want store in variable. in first row in file have 13 values, in others rows, , want store in next form: vector<vector<double>> x; --first row x[0][0] has value of first row , first col x[0][1] has value of first row , second col x[1][0] has value of second row , first col... , successively [edit] i'm not sure i'm helping answer, since didn't provide problem, did not tried, , failed. you should not expect people find solution problem, interested it, posted findings. but not how forum should work, programming learning, , if ask without trying nor explaining thought process until not learn. anyway, read answer 1 inspired, there key elements learn from. [/edit] this code inspired answer , should helpful understand key concepts of c++. explanation emplace_back vs push_back. explanation range-based loop: "for (auto : collection)" #include <vector> #include <st

php - How to delete hyperlink from cell in phpexcel -

i trying edit sheet , delete rows, when so, cells email address (with mailto hyperlink) retain hyperlink although cell values replaced new cell shifting place. for example cell a1 has email address abc@abc.com, cell a2 had blank cell, when delete row 1 using $sheet->removerow fucntion, row gets deleted, a1 blank cell mailto link abc@abc.com i unable delete hyperlink on cell using phpexcel i have tried following $cell->gethyperlink()->seturl(); $cell->sethyperlink(new phpexcel_cell_hyperlink('')); any appreciated pass value null in sethyperlink method against cell from looking @ code, finds worksheet cell attached , removes hyperlink if value null $cell->sethyperlink(null); worksheet.php https://github.com/phpoffice/phpexcel/blob/1.8/classes/phpexcel/worksheet.php#l2702 cell.php https://github.com/phpoffice/phpexcel/blob/1.8/classes/phpexcel/cell.php#l461

php - Variable binding in aura/sqlquery when using mysqli_* connection -

i've got legacy app uses mysqli_*() functions (actually, uses mysql_*() functions. gah!). using aura/sqlquery sql query generator. example: $queryfactory = new aura\sqlquery\queryfactory('mysql'); $select = $queryfactory->newselect(); $select->from('sometable t') ->where('t.field1 = 0') ->where("t.field2 <> ''"); then raw sql casting string: $sql = (string) $select; now want do variable binding in where() : $select->where('t.somefield = ?', $somevalue); when cast string, escaping/binding never seems occur. appears binding takes place when 1 uses pdo , prepared statements. any ideas how variable binding in aura/sqlquery when using mysqli connection? if php version >= 5.6, here function can use run query aura/sqlquery against mysqli function mysqli_query_params($mysqli, $query, $params, $types = null) { $statement = $mysqli->prepare($select); $types = $types

kafka cluster configuration -

i'm new on kafka. have question kafka configuration. i want using seperate server below, server1: kafka producer server2: kafka broker, kafka consumer, zookeeper but, can't send message broker. , got error messages. on console-producer(server1), console stdout error message ` [2016-05-24 16:41:11,823] error error when sending message topic twitter key: null, value: 3 bytes error: failed update metadata after 60000 ms.(org.apache.kafka.clients.producer.internals.errorloggingcallback) ` on kafka producer(server2), console stdout error message ` [2016-05-25 10:20:01,588] debug connection /192.168.50.142 disconnected (org.apache.kafka.common.network.selector) java.io.eofexception @ org.apache.kafka.common.network.networkreceive.readfromreadablechannel(networkreceive.java:83) @ org.apache.kafka.common.network.networkreceive.readfrom(networkreceive.java:71) @ org.apache.kafka.common.network.kafkachannel.receive(kafkachannel.java:160) @ org.apache.k

c++ - large arrays, std::vector and stack overflow -

i have program reading data large arrays, divided program in 2 separate projects in visual studio , each 1 separately worked fine, when tried put them program acted funny skipping steps while debugging. i'm new on c++ started doing research , found maybe filling stack huge arrays , should try put them on heap instead. i decided change each of arrays std::vector , initialize them way: std::vector<double> meantimeao = { 0.4437, 0.441, 0.44206, 0.44632, 0.4508, 0.45425,...} but after changing of arrays when try compile compiler crashes stack overflow, thought liberating memory space stack changing arrays vector seems had opposite results, why that?? and how should deal these big arrays? (they fixed never changing values or size) if array of fixed size, , elements don't change, there no real need use vector . use std::array , array of const or constexpr instead. constexpr float meantimeao[] = { 0.4437f, 0.441f, 0.44206f, 0.44632f, 0.4508f, 0.45425f,.

Dart's pub get command can't find latest versions of some dependencies -

i've noticed on few occasions when setup dependencies in pubspec.yaml pointing latest version, aren't found when run pub get . for instance, dependency source_gen . latest version of source_gen 0.5.0+1 . i'll setup pubspec.yaml file follows: dependencies: source_gen: "^0.5.0+1" then run pub get , , following error: resolving dependencies... package source_gen has no versions match >=0.5.0+1 <0.6.0 derived from: - servererrors depends on version ^0.5.0+1 i tried several of recent versions, without luck. if following: dependencies: source_gen: and run pub get , source_gen version 0.4.7 installed. i'm not sure understand why. i'm using dart sdk version 1.16.0. second dependency i've had issue , i'm little confused. edit: requested gunter, full list of dependencies: dependencies: http: "^0.11.3+7" dartson: "^0.2.5" intl: "^0.12.7+1" mailer: "^1.0.0" that's kno

How can I convert the following Django view to return JSON with Django Rest Framework? -

i returning bunch of tuples following code. returned values involves data number of different models. wondering how serialize data , return in json format. def stream(request): questions = question.objects.all() answers = answer.objects.filter(hearts__gte=1) combined = sorted(chain(questions, answers), key=attrgetter('created'), reverse=true) queryset = [] item in combined: if hasattr(item, 'parent'): try: qs_heart = answerheart.objects.get(answer=item, user=request.user) if qs_heart: hearted = true except answerheart.doesnotexist: hearted = false try: qs_flag = answerflag.objects.get(answer=item, user=request.user) if qs_flag: flagged = true except answerflag.doesnotexist: flagged = false queryset.append((item, hearted, flagged)) else:

operating system - Difficulty in understanding Petersons Algorithm -

i having bit difficulty understanding peterson's algorithm: algorithm says: flag[i] = true; turn = j; while (flag[j] && turn == j); // critical section ... // end of critical section flag[i] = false; now lets suppose flag[0]=flag[1]=true if p1 starts executing, busy waiting @ while loop since flag[0] , turn==0 both true. if p0 not want execute, p1 never execute critical section. please clear doubt;there may gaps in understanding. thanks now lets suppose flag[0]=flag[1]=true now if p0 not want execute, p1 never execute critical section. both flags should initialized false . way both set true if both processes want execute or executing critical section. therefore if p1 waiting execute, flag[0] true , p0 must either execute critical section, or in middle of executing it, after flag[0] set false , p1 can enter critical section. also, if p1 waiting execute, p0 cannot waiting execute, because waiting conditions mutually exclusive (since turn

java - how to cancel method of count down timer to stop working -

i have list of music user set time play. want have button cancel m count down timer . test way doesn't work @ all. here code play , set time play. public class main extends activity { public static int hour_device, minute_device; public static int hour_user, minute_user; splash splash; listview listview; adaptor adaptor; private mediaplayer mediaplayer; static view lastview = null; static myindexstore indexstore; list<string> lines1 = new arraylist<string>(); list<string> lines2 = new arraylist<string>(); static list<string> array_audio = new arraylist<string>(); inputstream in; bufferedreader reader; string line = "1"; string[] tracks; string[] names; string[] infos; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); indexstore = new myindexstore(getapplicationcontext()); setcontentview(r.layout.main_activity); splash = new splash(this); splash.set_identity

mysql - Invalid default value for 'date' field -

i took @ possibly dupicated article , still did not find result looking for. answer question explained how things work, did not provide how solve problem. there solution mysql bench, working terminal on mac ox. birthday date not null default '0000-00-00' returns: error 1067 (42000): invalid default value 'birthday'. how fix problem? can provide full syntax? working terminal on mac ox. your appreciated! according mysql documentation ( http://dev.mysql.com/doc/refman/5.7/en/datetime.html ) supported range '1000-01-01' '9999-12-31'

ejb - How to pass value from managed bean to custom jsf component? -

this question has answer here: jsf 2 custom components having expression language attribute value don't trigger attribute setter 1 answer i have created custom jsf component following code: @facescomponent("mainmenu") public class menucomponent extends uicomponentbase { private list<menuitem> items; private string title; public menucomponent() { } public string gettitle() { return title; } public void settitle(string title) { this.title = title; } public list<menuitem> getitems() { return items; } public void setitems(list<menuitem> items) { this.items = items; } public string getfamily() { return ui.family; } } then added renderer component: @facesrenderer(componentfamily = ui.family, renderertype = "mainmenurenderer")

iphone - How to dealloc a singleton? -

i have class named 'capture' subclass of nsobject , adds views superview. i have added settings.bundle consists of slider. when slider value 'on/1' show views in 'capture' in main window subview. when slider value 'off/0' have remove view added 'capture' , release objects present in 'capture'. i don't want hide views created 'capture' class on main view, when slider value 'off/0'. i want dealloc 'capture' when app in sent background , not when app terminates, cannot use notification uiapplicationwillterminatenotification dealloc singleton. if hide views displayed 'capture', there unnecessary use of memory 'capture' class so how dealloc singleton. 'capture' class views on top of every view controller, when events occurs. allocated once class method called in appdelegate. singleton created way: static screencapture *sharedscreen = nil; +(capture *)sharedscreencapture {

php - What does exclusive option in hasMany? -

in cakephp, there option called "exclusive" in "hasmany" field in models. documentation says: when exclusive set true, recursive model deletion delete deleteall() call, instead of deleting each entity separately. improves performance, may not ideal circumstances. but not clear. want know option exactly, , happens if don't use it? thanks. say example, 1 author has many books.so can write in form of $hasmany association below, var $name = 'author'; var $hasmany = array('book' => array('classname' => 'book', 'conditions' => '', 'foreignkey' => 'author_id', 'dependent' => true, 'exclusive' => true ) ); dependent: when dependent set true, recursive model deletion possible. in example, book records deleted when associated author record has been deleted. exclusive

How to create web separate pages for user profiles using PHP and mySql? URL rewriting? -

i trying figure out best way/how go - i relatively new mysql , php , need create user profile pages display different values mysql database have been uploaded each user - for example if clicked on john's profile, page display john's name, age, other values have stored on john in mysql table. perspective of else logged in wants view john's page. since index.php files different web pages in own folders (i.e. page, settings page, etc) thought have user profile folder , index.php outputs right information in accordance $user_id of user clicked. way can think accomplish this. my problem not allow person access user profile via url (i.e. website.com/user1) , not sure approach best/correct way create user profile pages. have explored this question , read on url rewriting still unclear - what correct way create separate user profile web pages , how url rewriting tie actual contents of page's index file? is there way (this poorly worded) store separate index.ph

android - Where can be use onSaveInstanceState where parameters are passed different Activity? -

for acitivity there method called onsaveinstacestate(bundle) used store data of activity overridden method. as see, there 2 different onsaveinstancestate parameters passed differently below. @override public void onsaveinstancestate(bundle outstate, persistablebundle outpersistentstate) { super.onsaveinstancestate(outstate, outpersistentstate); log.i("test", "onsaveinstancestate called **********"); } and @override protected void onsaveinstancestate(bundle outstate) { super.onsaveinstancestate(outstate); log.i("test", "onsaveinstancestate bundle called"); } so, @ circumstances 2 methods can use? please describe in detail. in advance. from api level 21, onsaveinstancestate() has new parameter called takes object of persistablebundle . can read more persistablebundle on docs in short, for api 21 , above @override public void onsaveinstancestate(bundle outst