Posts

Showing posts from June, 2011

java - Call start method two times -

java - Call start method two times - why next code throws exception? class mythread extends thread { public static void main (string [] args) { mythread t = new mythread(); t.start(); system.out.print("one. "); t.start(); system.out.print("two. "); } public void run() { system.out.print("thread "); } } could point me out jls ? that's contract of start() method : public void start() causes thread begin execution; java virtual machine calls run method of thread. result 2 threads running concurrently: current thread (which returns phone call start method) , other thread (which executes run method). never legal start thread more once. in particular, thread may not restarted 1 time has completed execution. throws: illegalthreadstateexception - if thread started. you can't start thread twice. java multithreading

Problems in Swift -

Problems in Swift - so got in swift programming , i'm next bloc's tutorial. so, when create block class, copied downwards letter, still says "type 'block' not conform protocol equatable", , have no thought how prepare it. says "consecutive declarations on line must separated ';'", "expected declaration", , "operators allowed @ global scope". here's code: class block: hashable, printable { allow color: blockcolor var column: int var row: int var sprite: skspritenode? var spritename: string { homecoming color.spritename } var hashvalue: int { homecoming self.column ^ self.row } var description: string { homecoming "\(color): [\(column), \(row)]" } init(column: int, row: int, color: blockcolor) { self.column = column self.row = row self.color = color } func == (lhs: block, rhs: block) -> bool { homecoming lhs.column == rhs.column && lhs.row == rhs.r...

logging - Output SQL with log4j in Jaspersoft Studio -

logging - Output SQL with log4j in Jaspersoft Studio - some background first. i'm using jaspersoft studio 5.6.0 final , have followed instructions here setup log4j. i'm trying log4j output sql query when study run. have problem query , need see sql outputed jaspersoft studio. have working datasource setup connection datasource not problem. i thought next instructions @ link above , adding log4j.logger.net.sf.jasperreports.engine.query.jrjdbcqueryexecuter=debug log4j-config.properties file allow me see output sql, it's not working. to run study compile jrxml , click preview tab. since followed instructions in link above, shouldn't sql outputed log4j log file when that? i need working can prepare query. help appreciated. please add together net.sf.jasperreports.engine.query.jrjdbcqueryexecuter = logging-config.properties...also run jasper studio administrator. works me..i using java util logging(-djava.util.logging.config.file=c:/jsslog/config/lo...

codeigniter - MySQL Query - Return data for past 4 months and if no data for a particular month return 0 -

codeigniter - MySQL Query - Return data for past 4 months and if no data for a particular month return 0 - my question similar question: mysql query - homecoming value past 12 months record each month but can't work out how implement query. i require info previous 4 months , if there none output 0 month. here current queries in codeigniter model: function getmonthlysumorders() { $this->db->select("sum(price_each*quantity) sum_monthly_price, date_format(job.order_date, '%m') 'order_date', customer.company_name", false); $this->db->join('job', 'job.job_id = job_details.job_id'); $this->db->join('customer', 'customer.company_id = job.company_id'); $this->db->where('job.company_id', $this->uri->segment(3)); $this->db->where('month(job.order_date)<=', date("m")); $this->db->where('month(job.order_date)>=', da...

angularjs - Ng-grid search bar in the grid -

angularjs - Ng-grid search bar in the grid - right using ng-grid , grid option, showfilter: true this places triangle drop downwards in top right corner of grid, when clicked pops search bar. is there way ng-grid have search bar straight visible in grid without need click triangle? sure, create input text wherever want in view ng-grid: <input type="text" data-ng-model="outside_search_text" placeholder="search" class="form-control" data-ng-change="search()"> <div class="gridstyle" data-ng-grid="gridoptions"> </div> and in controller: $scope.sortoptions = { fields : ['id'], directions : ['desc'] }; $scope.totalserveritems = 0; $scope.gridoptions['sortinfo'] = $scope.sortoptions; $scope.gridoptions['columndefs'] = [ {field ...

mysql - Get ID of php populated select option -

mysql - Get ID of php populated select option - i populate html select drop downwards using info mysql table. need fetch id of alternative , submit different table, have no clue how it. here's how it's populated: $query = $mysqli->query("select racename race order racename"); ?> <select class="pure-input-2" required="required" name="racename"> <option value="" disabled="disabled" selected>select race</option> <?php while($option = $query->fetch_object()){ ?> <option><?php echo $option->racename; ?></option> <?php } ?> </select> how can retrieve id of selected alternative submit different table? i guess in select query select raceid, how can pass through submit button? thanks. like this: $query = $mysqli->query("select raceid, racename race order racename"); ...

ios - What does this mean? "'NSUnknownKeyException', reason:This class is not key value coding-compliant for the key X" -

ios - What does this mean? "'NSUnknownKeyException', reason:This class is not key value coding-compliant for the key X" - i'm trying link uilabel iboutlet created in class. my application crashing next error. mean? how can prepare it? *** terminating app due uncaught exception 'nsunknownkeyexception ', reason: '[&lt;uiviewcontroller 0x6e36ae0> setvalue:forundefinedkey:]: class not key value coding-compliant key xxx.' your view controller may have wrong class in xib. i downloaded project. the error getting 'nsunknownkeyexception', reason: '[<uiviewcontroller 0x3927310> setvalue:forundefinedkey:]: class not key value coding-compliant key string.' it caused second view controller in mainwindow.xib having class of uiviewcontroller instead of secondview . changing right class resolves problem. by way, bad practice have names "string" in objective-c. invites runtime naming col...

sql - Conditional Logic within SUM -

sql - Conditional Logic within SUM - i'm combining 2 tables through union query , performing sum , grouping operations on result. working expected, have unique requirement can't seem figure out how implement. aim write sql says "when dev_age column >= 12 set revenue value if column 12". provide code below know description can bit confusing: revenue table: acc_yr dev_age state revenue loss 2012 3 ma 4000 0 2012 6 ma 8000 0 2012 9 ma 12000 0 2012 12 ma 16000 0 loss table: acc_yr dev_age state revenue loss 2012 3 ma 0 2000 2012 6 ma 0 7000 2012 9 ma 0 9000 2012 12 ma 0 10000 2012 15 ma 0 14000 2012 18 ma 0 14000 2012 21 ma 0 14000 2012 24 ma 0 15000 2012 2...

insert - Efficient way for adding music to ringtone on Android -

insert - Efficient way for adding music to ringtone on Android - i have problem adding music (stored in sdcard) ringtone of android. have code here insert : contentvalues values = new contentvalues(); values.put(mediastore.mediacolumns.data, filepath); values.put(mediastore.mediacolumns.title, songtitle); values.put(mediastore.mediacolumns.size, file.length()); values.put(mediastore.mediacolumns.mime_type, "audio/" + filetype); values.put(mediastore.audio.media.artist, singername); values.put(mediastore.audio.media.duration, duration); values.put(mediastore.audio.media.is_ringtone, true); values.put(mediastore.audio.media.is_notification, true); values.put(mediastore.audio.media.is_alarm, true); values.put(mediastore.audio.media.is_music, true); /* delete bug here */ uri uri = mediastore.audio.media.getcontenturiforpath(filepath); uri newuri = context.getcontentresolver().insert(uri, values); if (isringtone) ...

string - "" + something in C++ -

string - "" + something in C++ - i've been having freaky stuff happening in code. believe have tracked downwards part labeled "here" (code simplified, of course): std::string func() { char c; // stuff assign c homecoming "" + c; // here } all sorts of stuff happen when seek cout result of function. think i've managed pieces of underlying c++ documentation, , many segmentation fault. it's clear me doesn't work in c++ (i've resorted using stringstream conversions string now), know why. after using lots of c# quite while , no c++, has caused me lot of pain. "" string literal. have type array of n const char . particular string literal array of 1 const char , 1 element beingness null terminator. arrays decay pointers first element, e.g. in expressions pointer required. lhs + rhs not defined arrays lhs , integers rhs . defined pointers lhs , integers rhs, usual pointer arithmetic. char i...

html - Align buttons in For Loop -

html - Align buttons in For Loop - this html code @ moment: <title>cashier/customer application</title> </head> <body> <h1>cashier/customer application</h1> <div id="createorderdiv"> <input id="createorderbutton" type="button" value="new order" onclick="showorderoptions();"/> </div> <div id="createordertable" style="display:none;"> <form action='controller' method='post'> <table> <tr> <td>coffee type:</td> <td> <select name="ordertype" id="coffeetype"> <option value="espresso">espresso</option> <option value="macchiato">macchiato</option> ...

c++ - QUdpSocket: Program send but do not receive -

c++ - QUdpSocket: Program send but do not receive - i have problem qudpsocket . want create simple programme send , receive info using udp protokol. read many similar topic not found solved. communication worked qhostadress::localhost , give same info send, if want send info outside set concrete address, illustration 194.181.161.134 , not worked. mean info send can't receive. code: class okno_gl : public qmainwindow { q_object public: explicit okno_gl(qwidget *parent = 0); qwidget *wg; qpushbutton *pb; qpushbutton *pl; qgridlayout *gr; qudpsocket *socket; qhostaddress host; qhostaddress bcast; signals: public slots: void slot_write(); void slot_load(); }; class receiver : public qobject { q_object public: receiver(); qudpsocket *udpsocket; public slots: void slot_processpendingdatagrams(); void slot_stch(qabstractsocket::socketstate state); }; okno_gl::okno_gl(qwidget *parent) : q...

android - .9.png that de-compiled from apk causes error -

android - .9.png that de-compiled from apk causes error - i de-compiled or unzip apk file , gain .9.png image. when utilize .9.png image in project, causes error, showing bad patches. i see give-and-take on google code. know it possible utilize .9.png image unziped or de-compild apk in own project. android

c# - Can my soft be noticed of a change in the Windows Certificate Store ? (.NET) -

c# - Can my soft be noticed of a change in the Windows Certificate Store ? (.NET) - as title suggests, want know if there kind of event grab know when certificate store has changed. the goal observe when user entered specific kind of usb smartcard / stick signing certificate/token in it. certificate registered in windows cert store, ("my", personnal certificates). i don't thought of detecting usb events, because there variable delay between moment when key plugged , moment certificate registered (and usable). of course, can set timer checks store every 10 sec or so, hope you'll agree not elegant solution. of course of study if no other alternative available, that's i'll end doing guess. thank you how hybrid approach? watch usb events, when usb key plugged in, start polling store every couple of seconds until see new cert. still not ideal, much closer dumb poll every 10 seconds, 24/7/365. the trick knowing when usb key of particular t...

Specifying a file extension in C -

Specifying a file extension in C - for project getting file name user , sending function create actual file/open if exists. problem having when compiler creates file...it literally that, file. how can specify file type after receiving name via command line? from main: printf("enter name of file in wish create\nor if know name of exisiting file, come in file name:\n"); scanf(" %s", fname); file = fileopen(fname); the function: file *fileopen(char* fname) { file* pfile; pfile = fopen(fname,"rb+"); if (!pfile) pfile = fopen(fname,"wb+"); homecoming pfile; here ended doing after digging around/help friend. sprintf(fname, "%s%s", fname, ".dat"); thanks replies c file-io

stata - Combining multiple graphs with a loop -

stata - Combining multiple graphs with a loop - i create multiple graphs , combine them using loop. used next code: local var connecticut delaware minnesota missouri rhode island tennessee vermont wisconsin hawaii local n: word count `var' forvalues i=1/`n'{ local a: word `i' of `var' line prop_report_agencies modate if statename=="`a'" , ytitle(proportion_agency reports `a') saving(gg`a',replace) local gg `gg' "gg`a'" } local gg: subinstr local gg "gg`a'" `""gg`a'""' gr combine `gg' graph drop _all when error ggconnecticut not memory graph the first part of code seems work: code creates graphs individually , stores them; however, cannot combine due error. first of all, let's right code, while shrinking meandering stream straight line: local s connecticut delaware minnesota missouri "rhode island" tennessee vermont wisconsin hawaii foreac...

.Net Library to Transform JSON to JSON -

.Net Library to Transform JSON to JSON - does .net library exist json json transformation? i've found 1 java (jolt) , 1 node.js (json2json), not .net/c# library. i've seen posts suggesting json->xml->xslt->xml->json solution, seems hokey @ best. thoughts? .net json transform

algorithm - write a number as sum of a consecutive primes -

algorithm - write a number as sum of a consecutive primes - how check if n can partitioned sum of sequence of consecutive prime numbers. for example, 12 equal 5+7 5 , 7 consecutive primes, 20 equal 3+17 3 , 17 not consecutive. note that, repetition not allowed. my thought find , list primes below n , utilize 2 loops sum primes. first 2 numbers, sec 2 numbers, 3rd 2 numbers etc. , first 3 numbers, sec 3 numbers , far. takes lot of time , memory. realize consecutive list of primes defined 2 pieces of information, starting , ending prime number. have find these 2 numbers. i assume have primes @ disposal, sorted in array called primes . maintain 3 variables in memory: sum 2 (the smallest prime), first_index , last_index 0 (index of smallest prime in array primes ). now have "tweak" these 2 indices, , "travel" array along way in loop: if sum == n finish. have found sequence of primes. if sum < n enlarge list adding next availa...

javascript - Extremely poor sails.js-based web site mobile performance -

javascript - Extremely poor sails.js-based web site mobile performance - for first foray web development turned node.js, sails.js framework. i've nail wall when comes mobile performance. the site beta.astadke.org, , when seek on mobile device performance unbearable - 10s of seconds render page, twitter bootstrap (v3) menu button not work, , site on mobile unusable. since first experience building web site, i'm having problem figuring out might issue. i've turned google pagespeed , site seems ok test, performance issues remain. i'm not sure if i've made fundamental mistakes, or if i'm optimization away fixing this. i'm looking help on issue might or tools can turn to farther diagnose issue. github source site: https://github.com/zwrose/deke-list javascript node.js performance mobile sails.js

java - How can i calculate a linear system using Matrix on Android? -

java - How can i calculate a linear system using Matrix on Android? - i'm trying solve linear scheme on android platform perform image processing. (opengl or java matrix). have 4x4 matrix , 4x1 vector represented matrix4f , float4f respectively. want split them , save output vector. need utilize matrix because later i'll draw on device screen image transformed matrix i'll generate vector result. could't find how multiply 2 on android. saw answers suggesting using 3rd party library ( jscience library ), prefer not so, lastly resort. thanks. java android image-processing opengl-es linear-algebra

angularjs - angular-bootstrap-ui full-width table or list inside accordion -

angularjs - angular-bootstrap-ui full-width table or list inside accordion - i working angularjs , angular-bootstrap-ui package. specifically, using bootstrap list-groups within body of accordion-group. list-group-items extend way containing accordion-group's border. here fiddle of fragment, http://jsfiddle.net/qwesmv1d/1/. list-group-items beingness displayed padding; however, 'full-width' in example, http://getbootstrap.com/components/#panels-list-group. code snippet ... <accordion> <accordion-group heading="subject"> <ul class="list-group"> <li class="list-group-item">one</li> <li class="list-group-item">two</li> </ul> </accordion-group> </accordion> any help appreciated .. thanks. override panel-body padding: add together main css .panel-body{ padding : 0px; } angularjs twitter-bootst...

can't add realm to android studio -

can't add realm to android studio - i added: compile 'io.realm:realm-android:0.72.0' to dependencies then getting error: error:failed find: io.realm:realm-android:0.72.0 open fileopen in project construction dialog probably missing repositories { jcenter() } in gradle.build. android realm

Android - Content Provider query cursor -

Android - Content Provider query cursor - i cannot seem grasp concept of content provider. think bloats code, over-complicates it, , plainly awful. btw first illustration code of multi-table contentprovider find on web. there absolutelly none other, except maybe contactsprovider ("veeeerrrrry usefull" - beingness super-stuffed , indescifrable). sure many noobs me appreciate this. please help me create simple cursor content provider. have normal code bellow (using simple sqliteopenhelper), , need translate content-provider code: button btnp = (button) findviewbyid(r.id.btnproc); btnp.setonclicklistener(new view.onclicklistener() { @override public void onclick(view view) { context mycontext = getapplicationcontext(); sqlitedatabase db = new mydbhelper(mycontext).getwritabledatabase(); string sql = "select _id,data,titlu,cont notificari date(data)<=date(datetime())"; cursor cursor = db.rawquery(...

xml - What are some real-life use cases for XSLT 3.0 streaming? -

xml - What are some real-life use cases for XSLT 3.0 streaming? - could technology used stock tickers, social media streams, etc? xslt beingness used either of these purposes? some of utilize cases studied xslt working grouping during requirements phase xslt 3.0 (or xslt 2.1 then) described here: http://www.w3.org/tr/xslt-21-requirements/ they based on practical experience of wg members, "real-life" in sense, of course of study abstracted draw out requirement. xml xslt saxon xslt-3.0

javascript - How to scroll an overlay div on mobile -

javascript - How to scroll an overlay div on mobile - i've got mobile website has navigation menu displayed on click of fixed position button in top right. menu fixed top of menu starts 10px below bottom of button. problem navigation menu can longer height of device beingness used, , when seek , scroll scroll content behind navigation menu seeing fixed. can help me around this? as per comment: you need utilize js find height of screen, top of menu , set max height of menu difference of these for height of window utilize $('window').height() for menu's distance top of browser: $('.menu').offset() the function should live in show menu event listener: var maxheight = $(window).height() - $('.menu').offset(); $('.menu').css({ "max-height" :maxheight}) make sure overflow:scroll; set on menu javascript html css responsive-design

Excel VBA: what is the transforming formula given {X;Y} pair of Chart.MouseDown event to a {Category;Value} pair? -

Excel VBA: what is the transforming formula given {X;Y} pair of Chart.MouseDown event to a {Category;Value} pair? - i trying find formula transforming x , y coordinates of mousedown / mouseup event of chart axes 's coordinate system, i.e pair {category;value}. excel object model reference chart.mousedown event says: the x coordinate of mouse pointer in chart object client coordinates. i've found useful methods , properties task: axis: left, width mousedown/mouseup: x, y chartobject: left, width application: centimeterstopoints, inchestopoints, measurementunit window: activepane, pointstoscreenpixelsx, pointstoscreenpixelsy pane: pointstoscreenpixelsx, pointstoscreenpixelsy i've found x y values of "mouse" event in pixels -- see test: private sub m_target_mousedown(byval button long, byval shift long, byval x long, byval y long) dim v_l long, v_r long 'x , y in pixels! m_target v_l = activewindow.activepane.pointstoscreenpixe...

Google CSE: File uploading is not successful -

Google CSE: File uploading is not successful - i'm getting above error when seek uploading auto-suggest xml file google's custom site search. tried trimming file downwards bear minimum see if isolate problem next won't upload: <?xml version="1.0" encoding="utf-8"?> <autocompletions> <autocompletion term="my term" type="1" /> </autocompletions> am missing blindingly obvious? kind regards, karl it turns out, despite google info contrary, 'language' attribute required if it's value blank. added , file imported. <?xml version="1.0" encoding="utf-8"?> <autocompletions> <autocompletion term="my term" type="1" language="" /> </autocompletions> google-cse

Age Calculation duplicate column using sql server 2008 R2 -

Age Calculation duplicate column using sql server 2008 R2 - i have login table dob column. need duplicate column age. can't this. can convert dob column convert age lone `select floor(datediff(day,'10/10/1990' , getdate()) / 365.25)` works fine. but need convert whole column. if i'm using select floor(datediff(day,select dob login_tbl , getdate()) / 365.25) this, it's throwing error. how can it? thankyou your approach wrong result in such cases below: declare @now date set @now = '11/10/2014' select floor(datediff(day,'11/10/2013' , @now) / 365.25) -- should 1 0 , floor(datediff(day,'11/10/2012' , @now) / 365.25) -- should 2 1 , datediff(day,'11/10/2013' , @now) , datediff(day,'11/10/2012' , @now) my suggestion : declare @now date set @now = '11/10/2014' select (convert(int,convert(varchar(8), @now ,112)) - convert(int,convert(varchar(8),convert(date,'11/10/201...

javascript - 'Replace' changes entire src and not just the ending.. why? -

javascript - 'Replace' changes entire src and not just the ending.. why? - situation: have 10 grayness divs (each image , text) buttons. want buttons have darker text , darker image when active. when active button clicked want deactivate. want deactivate when button becomes active. problem: when replace ending on image sources, changes finish source on images same active one... changes other images same icon. jsfiddle: http://jsfiddle.net/messedup90/gtf1dk0m/ warning: jsfiddle shows problem having other images changing same reason active image not alter color. works fine in dreamweaver not concerned that. $(document).ready(function(){ var x = 300; $("[id^=pport]").click(function () { var src = $('.butt', this).attr('src'); if($(this).hasclass('highlight')){ $(this).removeclass('highlight'); $('.butt', this).attr('src', src.replace(/_dark(\.[^.]+)?$/, '_...

mysql - Trying to return student's GPA during given timespan by Creating a function receiving error message expecting (;) and I have semicolon stating end -

mysql - Trying to return student's GPA during given timespan by Creating a function receiving error message expecting (;) and I have semicolon stating end - my input parameters studentid int, classstartdatestart datetime, classstartdateend datetime. trying output gpa classes taken pupil within classstartdatestart , classstartdateend. function script below: create function `totalassignmentgrades` (studentid int,classstartdatestart datetime, classstartdateend datetime) returns integer begin declare startdate datetime; declare classgpa dec select studentid; receiving error stating expecting (;) student_classes startdate between '2012-01-01' , '2012-12-31'; could please tell me missing retrieve numbers gpa pupil during given date line. homecoming (*); mysql function

solr4 - Remove search results with lower score than specified value in Solr -

solr4 - Remove search results with lower score than specified value in Solr - on big volume of index, of query getting search results in lacs number of features. so want display search results more specified score value, , not results. how remove results lower score specified value in solr? solr solr4 solrnet

uitabbarcontroller - Disable "Edit" Button that appear in more selection of tab bar ios -

uitabbarcontroller - Disable "Edit" Button that appear in more selection of tab bar ios - i new in ios. utilize 7 tab bar item in tab bar controller story board , when run app shows more buttons when click on it show edit button. not want edit button. how can done? this code: [[[tabbarcontroller morenavigationcontroller] visibleviewcontroller] settitle:@""]; but not work. you had none of view controllers customizable. edit button disappears. please docs. [tabbarcontroller.customizableviewcontrollers = @[]; docs: "this property controls items in tab bar can rearranged user. when user taps more item on tab bar view, custom interface appears displaying items did not fit on main tab bar. interface contains edit button allows user rearrange items. items associated view controllers in array can rearranged interface. if array empty or value of property nil, tab bar not allow items rearranged." ios uitabbarcontroller

c# - Returning Struct from Class -

c# - Returning Struct from Class - so trying phone call function in class called dmlib. if homecoming list of structs, how can bring main. example: struct: public struct folder { public int fid; public string name; public int type; public int totalmessages; } class fellow member decleration: public list<folder> getfolders(string sessionkey) class fellow member phone call main.cs: list<folder> folders = new list<folder>(); folders = (list<folder>)dmlib.getfolders(sessionkey); error: this error says list of struct folder defined in main.cs can not converted list of struct folder class. how can create conversion happen? either alter declaration of folder type qualified include namespace, or declare using aliases @ top, each of namespaces 2 folder types reside in, , utilize alias in code. c# struct return

Matching using the new Azure Machine Learning -

Matching using the new Azure Machine Learning - does have illustration of doing matching using new machine learning functionality in microsoft azure? the examples of doing classification create sense, , wondering if there illustration of doing matching using built in tools. instead of using classification , comparing own custom codes. either way illustration nice. i want match 2 different entities based on location, demographic data, etc. usually, matching specific industry. in general sense, can utilize hierarchal clustering in r, featurize entities using entity-properties , cluster based on euclidean distance. not natively available in azure ml can utilize create r , execute r modules in azure ml integrate r-scripts. azure azure-ml azure-machine-learning

hex - How to initialize parameter array in verilog? -

hex - How to initialize parameter array in verilog? - how can 1 initialize parameter type array in verilog each of members 32 bit hexadecimal notation numbers? have tried next gives me syntax error. parameter [31:0] k[0:63] = {32'habc132, 32'hba324f, ...}; i'm using latest version of iverilog compiling. on eda plyground next illustration works using modelsim 10.1, file has .sv extension, causing interpreted systemverilog: module test; parameter [31:0] k [0:1] = {32'habc132, 32'hba324f}; initial begin $displayh(k[0]); $displayh(k[1]); end endmodule if setting systemverilog not work or not available simulator suggest including syntax error in question. parameters hex verilog

Clear Android activity stack -

Clear Android activity stack - i've made little android application handle activities , i'm facing weird issue. to determine if can move previous activity , utilize next code: activitymanager = (activitymanager) getsystemservice(activity_service); list<activitymanager.runningtaskinfo> tasklist = am.getrunningtasks(3); homecoming tasklist.get(0).numactivities; basically, returns integer total activities beingness on state onstop plus 1 (the current activity ). on launch, fist run splashscreen display simple infos , move login activity . to sure not activity stack equals 2, use: intent intent = new intent(asplashscreenactivity.this, activitytolaunch); intent.setflags(intent.flag_activity_clear_top); startactivity(intent); finish(); at point, expect 1 activity in stack, gives 2. why ? thanks help. android activity-stack

python - List function parameters not equal to their default values -

python - List function parameters not equal to their default values - given python function definition of form: def foo(a=none, b=1, c='bar'): how can dynamically determine parameters have been set value different default value? instance: foo(48) i want able dynamically identify a parameter set. solution i'm seeking go on work if added additional parameters signature (i.e. don't want manual check if == none , etc.). ==update== to clarify goal: users of function foo, allow executed regardless. if identify user of user type/class/category bar want allow succeed only if called foo argument parameter a . if provided arguments (or @ least, arguments not equal defaults) other parameter exception should raised. (i know user calling function based on other global data). again, if b != 1 or c != 'bar' , have update every time foo 's signature gets modified. i think best course of study of action utilize inspect . import inspect ...

java - Evaluating an Expression using MVEL -

java - Evaluating an Expression using MVEL - i need evaluate look in mvel containing date. basically, i need add together number of days given date , value. when trying evaluate look in mvel, getting exceptions. here code:: package mvel; import java.io.serializable; import java.text.parseexception; import java.text.simpledateformat; import java.util.calendar; import java.util.date; import java.util.hashmap; import java.util.map; import org.mvel2.mvel; import org.mvel2.integration.variableresolverfactory; import org.mvel2.integration.impl.mapvariableresolverfactory; public class mveldatetest { public static void main(string[] args) throws parseexception { // todo auto-generated method stub map<string, object> m1 = new hashmap<string, object>(); m1.put("name", "xyz"); simpledateformat sdf = new simpledateformat("dd/mm/yyyy"); date d1 = sdf.parse("02/10/2014"); m1.put(...

java - Possible to log data from a game chat? -

java - Possible to log data from a game chat? - i looked unable find if of such exist. is possible build java program, can read sudden strings chat within game? it used log sudden info mysql comparison. if knows of sort, direction high appreciated. you can't directly. need have access game's methods in order know when new chat entry appears, , how content. appart that, kenyanke explains, games might save chatlog on computer, yet won't help anyway, since have no thought of when these logs saved, or if saved matter. java

apache spark - How to convert Scala RDD to Map -

apache spark - How to convert Scala RDD to Map - i have rdd (array of string) org.apache.spark.rdd.rdd[string] = mappedrdd[18] , convert map uniqueids did ' val vertexmap = vertices.zipwithuniqueid ' gave me rdd of type 'org.apache.spark.rdd.rdd[(string, long)]' want ' map[string,long] ' . how can convert ' org.apache.spark.rdd.rdd[(string, long)] map[string,long] ' ? thanks there's built-in collectasmap function in pairrddfunctions deliver map of pair values in rdd. val vertexmap = vertices.zipwithuniqueid.collectasmap it's of import remember rdd distributed info structure. can visualize 'pieces' of info spread on cluster. when collect , forcefulness pieces go driver , able that, need fit in memory of driver. from comments, looks in case, need deal big dataset. making map out of not going work won't fit on driver's memory; causing oom exceptions if try. you need maintain dataset rdd. if creatin...

linux - Shell-Script:Create File List Based on Certain Charachter -

linux - Shell-Script:Create File List Based on Certain Charachter - i need create 1 file list below files: apple_001 apple_002 bbb_004 apple_003 i need create file_list apple_001 apple_002 apple_003 thanks, ipsita your specifications not narrow, here bash script match request : #!/bin/bash if [[ $# < 2 ]] echo "[error] script expects 2 arguments, input file , output file" >&2 exit 1 fi input_file=$1 output_file=$2 if [[ ! -f $input_file ]] echo "[error] input file '$input_file' missing" >&2 exit 1 fi if [[ -f $output_file ]] echo "[error] output file '$ouput_file' exists please move away" >&2 exit 1 fi while read line if [[ $line =~ apple_[0-9]+ ]] echo $line >> $output_file else echo "'$line' not match expected pattern, skip it" fi done < $input_file if [[ -f $ouput_file ]] echo "'$output_fi...

How to make a java class only available to one other class in a package -

How to make a java class only available to one other class in a package - i have 3 classes, bst, term, , webpages. bst binary search tree terms in each node. webpages instantiates bst. how can ensure bst class only available webpages class? (that requirement of project) they should in same package, thing makes sense me nested class within webpages. there other way restrict access entire class 1 other class in same bundle can "see" it? looks inner class best alternative you here quote javaworld descirbes same situation! for example, tree class may have method , many helper methods perform search or walk of tree. object-oriented point of view, tree tree, not search algorithm. however, need intimate knowledge of tree's info structures accomplish search. inner class allows remove logic , place own class. java

.net - c# run a thread each one minute despite the thread time -

.net - c# run a thread each one minute despite the thread time - i want run process every 1 minute, have been told timer working every x min + time required process finish . want thread work every 1 min though thread process may maintain working 1 hour. i hope got me, in final image, may have 10 threads working together. is possible ? depends on timer. simple test shows system.threading.timer works way want: var timer = new timer(s => { "start".dump(); thread.sleep(10000); "hi!".dump(); }, null, 1000, 1000); thread.sleep(20000); timer.dump(); the callback executes every sec though takes 10 seconds execute. this because callback particular timer posted threadpool, while e.g. system.windows.forms.timer tied ui thread. of course, if start new thread (or queue work, or start new task etc.) in callback of winforms timer, work in similar (albeit less precise) way. using right tool job makes things much easier :...

Check app in device is latest version or not latest version by code android -

Check app in device is latest version or not latest version by code android - at moment,i have android project , using google text speech speack japanese. japanese back upwards @ latest of google text speech while google text speech in device not latest version. want check google text speech latest version or not latest. if not latest,go page google text speech in google play store update. how must ? have tried using packagemanager? example: packagemanager manager = this.getpackagemanager(); seek { packageinfo info = manager.getpackageinfo("android.speech.tts", 0); // utilize exact name! string packagename = info.packagename; int versioncode = info.versioncode; string versionname = info.versionname; } grab (namenotfoundexception e) { // todo auto-generated grab block } android version updates

Can't get java to match regex with matches() -

Can't get java to match regex with matches() - i have problem i'm trying parameter match format 'uddd' 'u' must letter u , 'ddd' can 3 digits 0-9. my current code: //borrow method public boolean borrow(string borrowerid) { //if borrower id matches format 'uddd' if (borrowerid.matches("u([0-9]{3})")) { //if status available if (status == 'a') { this.borrowerid = borrowerid; this.status = 'o'; this.dateborrowed = currentdate; homecoming true; } //is not available else { homecoming false; } } //does not match format else { homecoming false; } } for reason it's not validating properly. when tried inputting '1' parameter, still returned true. is there i'm missing? it should not possible method homecoming true if input "1" . can su...

input - getKey from Ti-Basic in Python? -

input - getKey from Ti-Basic in Python? - i wondering how getkey command works , how utilize in python, there no command (right?). somehow, stackoverflow not short questions. writing programme on calculator , thought, why not set computer using python? realized not because don't know getkey. not sure question, utilize of getkey command in ti-basic: :while 1 #loop :repeat x #make sure key presssed :getkey→x #store key in variable :end #end loop :disp x :end getkey returns value corresponds key on ti-"keyboard". can key values in image below. to functionality in python search site it. utilize .char , .keysym this. more info: keypress detection python python input ti-basic

Prevent ngRepeat flicker with promise in AngularJS -

Prevent ngRepeat flicker with promise in AngularJS - i have collection of objects, products , can interact using $resource . on index page, i'd either display collection, or, in case collection empty, display helpful message. i.e. in controller class="lang-js prettyprint-override"> $scope.products = products.query(); in template class="lang-html prettyprint-override"> <div ng-repeat="product in products"> ... </div> <div class="alert" ng-hide="products.length"> <p>oops, no products!</p> </div> this works fine, provided user isn't staring @ spot ng-repeat occur. if are, or if there delay in response server, may notice slight flicker, before promise resolved. given that, "invoking $resource object method returns empty reference" (see here), such flicker in example. instead, find myself writing: class="lang-html prettyprint-override"> ...

How to retrieve thumbnail and image filepath with just one query in Android -

How to retrieve thumbnail and image filepath with just one query in Android - i retrieve file path images , thumbnails 1 query. code below retrieves file paths thumbnails: final string [] mprojection = {mediastore.images.thumbnails.data}; cursor imagecursor = getcontentresolver().query( mediastore.images.thumbnails.external_content_uri, mprojection, null, null, null ); arraylist<string> thumbfilepaths = new arraylist<string>(); int thumbcolumnindex = imagecursor.getcolumnindex(mediastore.images.thumbnails.data); uri thumburi; while(imagecursor.movetonext()) { thumburi = uri.parse(imagecursor.getstring(thumbcolumnindex)); thumbfilepaths.add(thumburi.getpath()); } imagecursor.close(); i can alter code retrieve file paths image, not sure how alter both image , thumbnail paths retrieved ima...

tfs - GIT and ignore existing data -

tfs - GIT and ignore existing data - i have git repository on nas. utilize windows , linux smartgit/hg interface it. had took old repository create in tfs , convert git one, far (difficult procedure had success). new project can tell git (before first "commit") directory want exclude, converted repository automatically set in git directory heritace tfs. suppose tfs had alter of directory. so thought can tell git ignore directory smartgit/hg seems if directory/file committed 1 time can't set ignore directory, how can tell git ignore future directory? you need remove folder index (but not disk): git rm --cached -r yourfolder (see " gitignore after commit" , "how remove directory in github repository?") then .gitignore able ignore folder. yourfolder/ git tfs ignore

android - Flow sample SimpleSwitcher subcontainers -

android - Flow sample SimpleSwitcher subcontainers - in recent update of flow sample app, introduced simpleswitcher uses pathcontext way of allowing customised sub-containers. could elaborate on term and/or give illustration on meant sub-containers? also how impact mortar implementations? since creating mortar scopes require parent context, pathcontext create chain of screen scopes: i.e. homescreen -> listscreen -> detailsscreen , each depending on ancestor. when destroy homescreen scope, lose rest of screen scopes , become sad. don't see point of holding on previous screen scopes after leave them , rather have activityscope parent of each 1 (similar previous mortar example). case require different screenswitcher impl or missing something? edit: screenswitcher, not screenscoper android mortar square-flow

sql server - My SSIS Package works, but fails as a SSMS job (Error: 0xC0016016) -

sql server - My SSIS Package works, but fails as a SSMS job (Error: 0xC0016016) - my ssis bundle works, fails ssms job (error: 0xc0016016) i posting question , sharing solution issue own question because didn't see posed problem match specific issue encountered , answers seemed scattered in different forum questions. background: i have 4 ssis packages on sql server 2012 import table sql server 2008 r2, 2008, or 2005, depending on specific package. utilize designated sql server login , password source database , integrated windows security target database. within ssis able run each bundle without problem. to ensure bundle ran on schedule, set ssms job on same server ssis package. in job step properties, chose: sql server integration services bundle > run sql sever agent service business relationship > bundle source: file system). the symptom: when manually running job create sure worked, got error , saw in log file viewer. first of several errors, chrono...

c++ - Video players questions -

c++ - Video players questions - given ffmpeg leading multimedia framework , of video/audio players uses it, i'm wondering somethings audio/video players using ffmpeg intermediate. i'm studying , want know how audio/video players works , have questions. i reading ffplay source code , saw ffplay handles subtitle stream. tried utilize mkv file subtitle on , doesn't work. tried using arguments such -sst nil happened. - reading subtitles , how video files uses (or may containers?). saw there's 2 ways putting subtitle: hardsubs , softsubs - speaking hardsubs mode burned , becomes part of video, , softsubs turns stream of subtitles (i might wrong - please, right me). the question is: how handle this? mean, when subtitle part of video there's nil do, video stream shows subtitle, softsubs? how handled? (i heard text subs well). - how subtitle appears on screen , can configured changing fonts, size, colors, without encoding again? i studying video players sou...

vb.net - looping through data in DAL -

vb.net - looping through data in DAL - in dal loops through each in datatable applies object class. want able before passed object class check if row passed has same product code. example; current row of info is; productcode quantity 100001 500 if previous line of info passed has same product code; productcode quantity 100001 500 it add together quantity previous line create 1000. if not same productcode apply object class normal so want running total in datatable ? utilize linq: var runningtotalspercode = table.asenumerable() .select(row => new { productcode = row.field<int>("productcode"), quantity = row.field<int>("quantity"), allfields = row.itemarray }) .groupby(x => x.productcode) // grouping product-code .selectmany(g => g. // flatten grouping after running-total calculated select((x, index) => new { x.productcode, x.quantity, ...