Posts

Showing posts from March, 2012

pass by value in java (primitive and arrays) -

this question has answer here: is java “pass-by-reference” or “pass-by-value”? 73 answers are arrays passed value or passed reference in java? [duplicate] 7 answers suppose have following code: public static void main(string[] args) { int x = 5; int [] array = new int[10]; swtich (x, array); system.out.println("x = " + x); system.out.println("y[0] = " + y[0]); } public static void switch(int number , int[] array){ number = 10; array[0] = 150; } why program prints 5 (doesn't change value) , prints number ordered in array[0] 150? thanks.

UBER with SSO using uber rides-android-sdk -

i'm trying data all_trips scope. i'm running few issues. 1) once add scope.all_trips .setscopes redirected verse being able login obtain token, therefore necessary data currentride() method. configuration = new sessionconfiguration.builder() .setclientid(client_id) .setredirecturi(redirect_uri) .setscopes(arrays.aslist(scope.history, scope.profile, scope.ride_widgets, scope.all_trips)) .setenvironment(sessionconfiguration.environment.sandbox) .build(); validateconfiguration(configuration); error: webpage not available webpage @ market://details?hl-en&id=com.ubercab&referrer=mat_cli%3 and goes on , one. once remove all_trips scope ability sign in. any great can move forward getting details driver, vehicle, rideid. private void loadalltrips(){ session session = loginmanager.getsession(); ridesservice alltrips = uberridesapi.with(session).build().create

Is this interface being instantiated? (Java 8) -

as far know, interfaces cannot instantiated directly. however, whenever compile following code: interface {}; public class test { public static void main(string[] args){ a = new a() {}; system.out.println(a); it outputs tostring() of object of class test: test$16d06d69c and when change a = new a() {}; to a = new a(); it doesn't compile. why happening? interface being instantiated, or else happening behind scenes? you defining new anonymous inline class implements interface statement: a = new a() {}; and in same statement constructing new instance of new anonymous class definition. so no not instantiating interface.

xaml - StaticResource into MarkupExtension -

i'm trying use static resource extension entry's fontsize property. have code piece of code: <?xml version="1.0" encoding="utf-8" ?> <contentpage x:class="project.sources.pages.extras.editprofilepage" xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:control="clr-namespace:project.sources.controls;assembly=project" xmlns:extension="clr-namespace:project.sources.extensions;assembly=project" xmlns:sys="clr-namespace:system;assembly=mscorlib"> <contentpage.resources> <resourcedictionary> <color x:key="nl_bluenight">#0e1728</color> <color x:key="nl_orangebeer">#e87e07</color> <color x:key="nl_orangesky">#bd4327</color> <color x:key="nl_white">#ececec<

javascript - Listening for specific DOM element insertion -

i wrote script lets me delete iframes page pressing button: window.addeventlistener('load', function() { var addbutton = document.createelement("button"); addbutton.innerhtml = "delete iframes"; addbutton.onclick = removealliframes; document.body.appendchild(addbutton); }); function removealliframes() { var iframes = document.getelementsbytagname("iframe"); (var frame of iframes) { frame.parentnode.removechild(frame); } } while works, wondering if possible listen iframe insertions , delete them appear on page. there sort of window.listentoelementinsertionbytag() method can automate this? otherwise use setinterval() , execute removealliframes() method on interval.

jersey - Map JAX-RS @PathParam to POJO Constructor With Annotations -

i want create endpoint has pathparam automatically calls constructor of object injected, has constructor of string argument. spell out in code: here resource @get @path("/{apiversion}" + "/item") public response version(@pathparam("apiversion") apiversion apiversion) { return response.ok().build(); } i want string automatically used in call apiversion constructor. in apiversion class public apiversion(string apiversion) { this.versionstring = apiversion; } is possible access annotations? not have access resourceconfig . yes, possible, without annotations other @pathparam , example you've given should work as-is. see https://jersey.github.io/documentation/latest/jaxrs-resources.html#d0e2271 (emphasis mine) : in general java type of method parameter may: be primitive type; have constructor accepts single string argument; have static method named valueof or fromstring accepts single string argument

ruby on rails - How to create record in console - ROLLBACK TO SAVEPOINT active_record_1? -

i'm new rails , not sure error here when trying create cost code: [21] pry(main)> costcode => costcode(id: integer, biller_type: text, biller_id: integer, position: integer, parent_id: integer, code: text, name: text, updated_at: datetime, long_name_helper: text, deleted_at: datetime, sortable_code: text, created_at: datetime, standard_cost_code_id: integer) [22] pry(main)> costcode.create(code: '87678', name: "hex") (0.3ms) savepoint active_record_1 (0.2ms) set local procore.user_id=''; set local procore.company_id=''; set local procore.project_id=''; costcode exists (0.4ms) select 1 one "cost_codes" ("cost_codes"."code" = '87678' , "cost_codes"."biller_type" null , "cost_codes"."biller_id" null , "cost_codes"."parent_id" null , "cost_codes"."deleted_at" null) limit

java - Running SpringBoot application that implements CommandLineRunner with Cuccumber, run's main application before running Feature test cases -

i new cucumber , spring boot,i developeing spring boot application implements commandlinerunner , trying integrate cucumber framework run tests , create corresponding reports. cucumber test cases running fine before running test cases runs springboot application (application.java). expected behaviour or there someway run tests only. main spring boot class - application.java class:- /** * main application class */ @springbootapplication public class application implements commandlinerunner { @override public void run(string... args) { @autowired private gwmlcontroller gwmlcontroller; @autowired private smartxmlcontroller mxmlcontroller; @autowired private reportingcontroller reportingcontroller; @autowired private comparisionreportcontroller comparisionreportcontroller; .... ... busniess logic } now cucumber class are:- abstractdefination.java package cucumberjava.steps; import org.junit.runner.runwith; import org.springfr

r - Using dplyr first function but ignoring a particular character -

i wish add first feature in following dataset in new column mydf <- data.frame (customer= c(1,2,1,2,2,1,1) , feature =c("other", "a", "b", "c", "other","b", "c")) customer feature 1 1 other 2 2 3 1 b 4 2 c 5 2 other 6 1 b 7 1 c by using dplyr . however, wish code ignore "other" feature in data set , choose first 1 after "other". so following code not sufficient: library (dplyr) new <- mydf %>% group_by(customer) %>% mutate(firstfeature = first(feature)) how can ignore "other" reach following ideal output: customer feature firstfeature 1 1 other b 2 2 3 1 b b 4 2 c 5 2 other 6 1 b b with dplyr can group customer

Google Firebase Realtime Database setValue IF (condition) -

firebase database: { "balance" : 10 } application 1 (pseudocode): if (balance-10 >= 0) { // application freezes few seconds. (connection/hardware issue or whatever reason) balance -= 10; } application 2 (pseudocode): if (balance-10 >= 0) { // application executed without problems. balance -= 10; } if both applications start @ same time, final "balance" value "-10" instead of "0". in mysql problem easy fixed by: update `table` set balance=if(balance-10>=0, balance-10, balance); what possible solutions firebase? this handled through transactions . since don't specify technology i'm showing web code: balanceref.transaction(function(current) { if (current && current > 10) { return current - 10; } return (current || 0); } if multiple applications run code @ same time, 1 of them transaction rejected , retry. also see: when should use firebase transaction

linux - Plesk email alert when admin login -

can set email alerts plesk admin login ? how can in linux server ? the email id should receive alert when logs in admin user. in plesk event manager can use "plesk user logged in" event , special script should detect admin , send notification in case of admin login.

amazon web services - What are the required Plist settings for the AWSCognitoIdentityProvider in iOS? -

i've been using ios aws sdk , it's pretty awesome, if documentation but. ;) reasons not germane post, attempting use awscognitoidentityprovider provided in aws sdk. unfortunately moment app attempts instantiate object, following error received: ...exception 'nsinternalinconsistencyexception', reason: 'the service ? configuration nil . need configure info.plist or set defaultserviceconfiguration before using method.' familiar territory, had seen s3, etc...it means need configured in plist. problem - unlike s3, there doesn't seem documentation on plist settings should object. aws mobilehub sample code doesn't utilize object , github samples don't either. what's actual configuration object supposed be? aaaaand answering own question (after trial , error educated guessing) can other poor souls... the plist setting require is: <dict> <key>cognitoidentityprovider</key> <dic

How to set persistence in Firebase Storage on Android? -

i'am using firebase storage list of images on android, every time when app started list downloaded, want store persistence on android images , download if necessary. need check if images downloaded on smartphone. i'am using firebasedatabase store name of files, database can check persistence. think need store images on storage of device, don't know check before download, best way set persistence firebasestorage if possible. my code looks this: firebasedatabase: final firebasedatabase database = firebasedatabase.getinstance(); databasereference databasereference = database.getreference().child("nomes_imagens"); final map<string,object> mapnomesimagens = new hashmap<>(); databasereference.addlistenerforsinglevalueevent(new valueeventlistener() { @override public void ondatachange(datasnapshot datasnapshot) { log.i(tag,"ondatachanged()"); iterator<data

javascript - Rails emoji picker won't load for Simple_Form textarea -

i'm using gem called rails_emoji_picker implement emoji solution project. gem not loading emoji picker inside of textarea, though followed instructions given. see no errors in javascript debugging console. how can make emoji picker display inside of textarea? i'm using rails 5 . https://github.com/id25/rails_emoji_picker post _form.html.erb <div class=container"> <%= simple_form(@post, multipart: true, remote: true) |f| %> <div class="row"> <div class="col-6"> <p class="emoji-picker-container"> <%= f.input :body_text, class: 'form-control', label: false, id: 'text-area-reset', placeholder: 'write something', data: {emojiable: true} %> </p> </div> </div> <div class="row"> <div class="col-6> <%= f.button :submit, 'post it', class: 'btn btn-outl

numpy - logits and labels must have the same first dimension, got logits shape [1312,48] and labels shape [41] -

i'm building cnn classifing (256,16,1) array (sound @ spectral format) i'm having problems. build graph can't feed y value due logit error: invalidargumenterror (see above traceback): logits , labels must have same first dimension, got logits shape [1312,48] , labels shape [41] i've lost hours trying run don't know whats happening.... can please me? the code of graph: :: :: tf.name_scope("inputs"): x = tf.placeholder(tf.float32, shape=[none, n_inputs], name="x") x_reshaped = tf.reshape(x, shape=[-1, height, width, channels]) y = tf.placeholder(tf.int32, shape=[none], name="y") training = tf.placeholder_with_default(false, shape=[], name='training') :: :: pool2_fmaps = conv2_fmaps tf.name_scope("pool2"): pool2 = tf.layers.max_pooling2d(inputs=conv2, pool_size=[2, 2], strides=2) pool2_flat = tf.reshape(pool2, shape=[-1, 8 * 1 * pool2_fmaps]) pool2_flat_drop = tf.layers

facing issue with "wget" in python -

i novice python. facing issue "wget" " urllib.urlretrieve(str(myurl),tail)" when run script it's downloading files filename ending "?" my complete code : import os import wget import urllib import subprocess open('/var/log/na/na.access.log') infile, open('/tmp/reddy_log.txt', 'w') outfile: results = set() line in infile: if ' 200 ' in line: tokens = line.split() results.add(tokens[6]) # 7th token result in sorted(results): print >>outfile, result open ('/tmp/reddy_log.txt') infile: results = set() line in infile: head, tail = os.path.split(line) print tail myurl = "http://data.xyz.com" + str(line) print myurl wget.download(str(myurl)) # urllib.urlretrieve(str(myurl),tail) output : # python last.py 0011400026_recap.xml http://data.na.com

UML Representation in specific cases of C# Application -

i have uml representation of class relationship (association, aggregation , composition) questions in c# windows program have program calls main(). main() calls our form form1. what relationship between class program , class form1 a class c1 has method m1 takes 1 parameter of type enum flag what relationship between class c1 , enum flag class c1 has property list collection of c2 objects c2 class what relationship between class c1 , class c2 form 1 calls customer dialog form 2 value what relationship between class form1 , class form2 class c1 has property of type enum flag what relationship between class c1 , enum flag thank you this association main --> form1 put role name (e.g. theform1 ) on right side of association this simple dependency c1 - - > flag also simple association multiplicity on c2 side of association. use composite aggregation of want connect lifetime of aggregated children aggregator. this same 1. this same 2.

php - Create laravel blade table view that -

i have laravel db::query give me result this arrayresult = array('nip' => '12345678', 'nama' => 'rachmat', 'month' => '1', 'sum' => 13'), array('nip' => '12345678', 'nama' => 'rachmat', 'month' => '3', 'sum' => 10'), array('nip' => '12345678', 'nama' => 'rachmat', 'month' => '8', 'sum' => 9')); then create multidimensional array this foreach ($pegawai $key ) { $peg[$key->nip]['nama'] = $key->nama; $peg[$key->nip]['nip'] = $key->nip; $peg[$key->nip]['month'][$key->month] = $key->sum; } the result of array this array(12345678 ('nama' => 'rachmat', 'nip' => '12345678', month(1 => 13,

javascript - Is it possible for a Java controller to pass an attribute to a success ajax call? -

as title says, want pass variable controller success ajax call function possible? example: i have java class controller this: @requestmapping(value = "checkfruit", method = requestmethod.post) @responsebody public modelandview checkfruit(httpservletrequest request, string fruitinput) { modelandview modelandview = new modelandview(); if (fruitinput.equals("apple")) { modelandview.addobject("fruittype", 1); //this want pass success ajax call. } else if (fruitinput.equals("orange") { modelandview.addobject("fruittype", 2); //this want pass success ajax call. } modelandview.setviewname("fruitgarden"); return modelandview; } and jsp view ajax call this: $("#checkfruitbtn").click(function () { var fruitinput = $("input[name=fruitinput]").val(); $.ajax({ type: 'post', url: 'checkfruit', data: 'fruitinput=

batch file - cannot replace this character from a variable -

i trying remove special characters ’ filenames set "filename=%filename:’='%" this works command line not script. just finish up, here's answer. change codepage more supported codepage, such unicode utf-8. corresponding codepage id 65001 . change this, add: chcp 65001 you can add snippet anywhere before set statement.

python - Cancel button on QFileDialog -

i running issue, when choose not save file , click "cancel" on system window program crash. here error receive: traceback (most recent call last): file "basicemail.py", line 166, in save_content open(file_name[0], 'w') f: filenotfounderror: [errno 2] no such file or directory: '' this code using: def save_content(self): file_name = qtwidgets.qfiledialog.getsavefilename(self,'save file',os.getenv('home')) if file_name: open(file_name[0], 'w') f: my_text = self.content.toplaintext() f.write(my_text) thank in advance. know must missing something. the if file_name: statement true since getsavefilename() function returns tuple, has following structure: (filename, filters) , best name , verify string not empty. def save_content(self): file_name, _ = qtwidgets.qfiledialog.getsavefilename(self, 'save file', os.getenv('home')) if file_name != &quo

github - git fork repo to same organization -

how fork repo in organization same organization can regularly sync fork upstream repository? in stackoverflow question copy/fork git repo on github same organization asker wanted create 2 separate disconnected repos 1 cloned other. how create forked project multiple people able see , work on 1 organization? further background one of repos in our organization template framework use build dozens of other applications. looking solve issue of when add updates / patches template, other repos able pull these changes. i don't want fork individual account awful visibility organization in future.

javascript - js.node n00b using axl -

Image
i trying run axl query against cucm. have working example(shamelessly stolen) here: https://gist.github.com/darrenparkinson/9978397 i'm trying simple , replace soap portion sql query which, when use curl send request looks like: <?xml version="1.0" encoding="utf-8"?> <soapenv:envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> <soapenv:body> <axlapi:executesqlquery sequence="1" xmlns:axlapi="http://www.cisco.com/axl/api/8.0" xmlns:axl="http://www.cisco.com/axl/api/8.0" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://www.cisco.com/axl/api/8.0 axlsoap.xsd"> <sql>select count(*) device</sql> </axlapi:executesqlquery> when attempt node.js get node device.js syntaxerror: invalid or unexpected token here soap portion attempted send node.js: any appreciate

React Native - How can React Navigation Drawer be re-rendered when opened? -

i using react-navigation , drawernavigator main navigator. i need re-render drawer if drawer opened. none of lifecycle methods called when drawer opened drawer rendered once when app loads. i have tried passing params trigger componentwillupdate() method. params sent on initial load - calling this.props.navigation.navigate('draweropen', {name: 'alex'}) nothing params never arrive (they undefined). why can't pass params other navigate() actions? it seems should possible? otherwise drawers static content never updates? thanks help.

deep linking - How to start my Android application when a link clicked from external app like whatsapp or facebook? -

i have used deep linking concept using following intent filter in manifest file. <activity android:name=".myactivity" android:screenorientation="portrait" android:windowsoftinputmode="statealwayshidden" > <intent-filter android:label="@string/app_name"> <action android:name="android.intent.action.view" /> <category android:name="android.intent.category.default" /> <category android:name="android.intent.category.browsable" /> <data android:host="test.myapp.com" android:scheme="http" /> </intent-filter> </activity> this helps me show application when clicked on link in whats app, shows other applications in list chrome,internet etc. how can make access app directly after clicking link in other application w

csv - CSVHelper: No properties are mapped for type 'class name' -

i getting exception while run time mapping. see code below: namespace csvtest { class program { static void main(string[] args) { streamreader textreader = new streamreader("book1.csv"); var csv = new csvreader(textreader, new csvhelper.configuration.csvconfiguration() { willthrowonmissingfield = false }); string[] csvfieldnames = { "name" }; string[] modelproperties = { "name" }; var manufacturermap = new defaultcsvclassmap<manufacturer>(); (int = 0; < csvfieldnames.length; i++) { var propertyinfo = typeof(manufacturer).gettype().getproperty(modelproperties[i]); var newmap = new csvpropertymap(propertyinfo); newmap.name(csvfieldnames[i]); manufacturermap.propertymaps.add(newmap); } csv.configuration.registerclassmap(manufacturermap); var test = csv.getrecords<manufacturer>().tolist(); } } public class manufactur

c# - Disabling cache in Excel / PowerBI for OData -

in project, i'm using microsoft.aspnet.odata create odata webapi service. i've noticed data returned odata webapi service cached inside excel and/or powerbi. avoid situation. ideally, i'd turn off caching data service. is there easy way achieve this? attribute, response header? in past have tried cache-control header no luck. there no way disable cache. following works fine. after loading data in powerbi or powerquery need follow following steps 1: go file 2: go option , settings 3: go query options 4: clear cache this way this, , reduce cache 5mb. might upto extent.

Why shouldn't we extend JavaScript prototypes? -

this question has answer here: extending native elements in javascript via prototype? 1 answer why extending native objects bad practice? 5 answers i've seen lots of stack overflow javascript questions answers include modifying prototypes of primitive types (such this ). many times highest upvoted answer not use prototype mod. this made me wonder, other possibly few lost milliseconds efficiency, pros , cons of prototype modification?

java - Kotlin Back-Tick escaping in method names: How does it work? -

i found out, in kotlin it's possible name method this: fun `i test method`(){ assert.assertequals("x", "x") } the compiler generates method underscores instead of blanks: "i_am_a_test_method", seems reasonable jvm not permit methods blanks afaik. how can junit and/or gradle report these tests back-ticked name though? in java method descriptor , several characters have special meaning, namely [ ( ) / , ; . space doesn't have special meaning, , therefore can used directly in method name; that's compiler does. spaces not converted underscores.

ios - Set badge for tab bar item embedded in navigation controller -

i trying set badge value tab bar item embedded in navigation controller tabbarcontroller.m (tab bar controller --> navigation bar --> view controller), used code it's not working: [[self.tabbarcontroller.tabbar.items objectatindex:0] setbadgevalue:eventcountstr]; use code change badge current tab [[self navigationcontroller] tabbaritem].badgevalue = @"badgevalue"; if need change value tab [[super.tabbarcontroller.viewcontrollers objectatindex:2] tabbaritem].badgevalue = @"1"; if need remove badge use badgevalue nil .

amazon web services - Passing multiple parameters from external file to cloudformation template and using values with ref -

i getting following error when trying create cloudformation stack using below cli command. aws cloudformation create-stack --stack-name subodh-local-stack --template-url s3url/template.json --parameters s3url/params.json error: awscli.argprocess.paramerror: error parsing parameter '--parameters': unable retrieve https://s3.amazonaws.com/ //params.json: received non 200 status code of 403 2017-08-18 01:32:31,309 - mainthread - awscli.clidriver - debug - exiting rc 255 my template.json looks - { "awstemplateformatversion": "2010-09-09", "resources": { "type": "aws::lambda::function", "properties": { "functionname": { "ref": "lambdafunctionname" }, "handler": { "ref": "lambdahandler" }, "role": { "ref"

laravel - How to get the data read from excel file and display in my view? -

in controller, load excel file when click on button. excel::load(input::file('import_file')->getrealpath(), function ($reader) use($arr){ // how can $reader data , pass view? }); return redirect()->back()->with('reader',...); in view, display data excel file @if(!empty(session::get('reader'))) $(function() { @foreach(session()->get('reader') $key=>$row) alert('{{$row['id']}}'); @endforeach }); @endif can guide me how can make pass data view? you directly store result array. code should like $reader= \excel::load(input::file('import_file'))->toarray(); return redirect()->back()->with('reader', $reader);

java - Is there a better pattern instead of decorating a data class with DAO? -

i have pojo on project maps dynamodb object, decorated dynamodb annotations. problem see couples data specific persistence. in practice don't think problem, smell imo. there other recommended pattern use-case? typically, alternative annotating class in manner specify mapping in external configuration such xml. however, has other issues: it's typically more verbose, prone typos, , requires in more places, example. you'll need decide trade-off prefer.

python 2.7 - How do I update the values in a pandas dataframe column until first occurance of a value in the same column? -

i have following dataframe - 50d-200d regime date 2017-02-22 nan 0 2017-02-23 nan 0 2017-02-24 nan 0 2017-02-27 0.52 1 2017-02-28 0.92 1 ... 2017-04-04 0.39 1 2017-04-05 0.16 1 2017-04-06 -0.08 -1 2017-04-07 -0.30 -1 2017-04-10 -0.51 -1 ... 2017-08-09 -1.15 -1 2017-08-10 -0.52 -1 2017-08-11 0.07 1 2017-08-17 2.67 1 i want modify dataframe such "regime" column values set 0 until first occurance of "-1". after that, leave dataframe unmodified. how achieve this? tia use idxmax index value of first -1 , set 0 : idx = df['regime'].eq(-1).idxmax() df.iloc[:df.index.get_loc(idx), df.columns.get_loc('regime')] = 0 print (df) 50d-200d regime date 2017-02-22 nan 0 2017-02-23

Excel add-in in Visual Studio - View XML as a GUI -

Image
in this end-to-end walkthrough (at 1:20:17), michael can double-click officeapp2manifest file view manifest gui in visual studio. but, reason, visual studio won't allow me that. instead, double-clicking manifest show xml document: how can view gui edit it? thanks! edit : in case it's relevant, i'm using resharper extension visual studio.

c++ - Warning C4267 'argument': conversion from 'size_t' to 'DWORD', possible loss of data -

i migrating code 32bit vs2012 64bit vs2015. i encountered following function call in program: crypthashdata(hhash, (byte*)auth_encryption_key, wcslen(auth_encryption_key) * sizeof(wchar_t), 0u)) whose declaration in wincrypt.h located in c:\program files (x86)\windows kits\8.0\include\um\wincrypt.h (looks not edited). the declaration is: winadvapi bool winapi crypthashdata( _in_ hcrypthash hhash, _in_reads_bytes_(dwdatalen) const byte *pbdata, _in_ dword dwdatalen, _in_ dword dwflags ); dword dwflags: problem here 0u unsigned int , function needs dword . to solve error did: c-style casting (dword)(0u) in function call(tried size_t, unsigned int) static_cast tried creating new variable , casted it but warning still persists looks have change in function call can suggest me how solve issue. please ask if more details required.

constraint programming - Error gecode: cumulative: Number out of limits -

i using minizinc solve constraint programming model. model uses cumulative.mzn global constraint. smaller models, runs fine. when size of model increased, below error when running on terminal: error: gecode: cumulative: number out of limits is there limit on number of variables/constraints minizinc can handle? pointers on how resolve of great help.

php - How to display XML nodes that have the same name? -

i have xml blog feed displaying on wordpress. here simple representation of xml nodes: <item> <title> title </title> <description> description </description> <category> category 1 </category> <category> category 2 </category> <category> category 3 </category> </item> so you'll notice above category node displayed 3 times has same name. when i'm using below php display xml nodes in loop can 1 of category nodes rest aren't unique. does know how can display of category nodes please??? <?php $rss = new domdocument(); $rss->load('http://blog.com/rss.xml'); $feed = array(); foreach ($rss->getelementsbytagname('item') $node) { $item = array ( 'title' => $node->getelementsbytagname('title')->item(0)->nodevalue, 'desc' => $node-&g

asp.net - Is there a web server or application level setting that indicates to the browser that the page has been modified? -

we have issue when upgrade our asp .net web application, customers still see old pages (old code) instead of new code. would know if there server or application level setting indicates browser page has been modified , forces download instead of loading cache, without having make code change? thanks, sunil

c# - Inherited ViewModel passed to UserControl is treated as child ViewModel -

i have view mainwindow.xaml contains 2 buttons defined in button.xaml. button binds property isvisible defines whether button visible. mainwindow.xaml: <local:button datacontext="{binding buttonviewmodel1}" /> <local:button datacontext="{binding buttonviewmodel2}" /> button.xaml: <stackpanel> <button name="mybutton" visibility="{binding isvisible}"> <textblock>my button</textblock> </button> </stackpanel> for button have 2 viewmodels: buttonviewmodel , buttonviewmodelchild . buttonviewmodelchild inherits buttonviewmodel . both provide isvisible property: buttonviewmodel: public visibility isvisible { { return visibility.hidden; } } buttonviewmodelchild: public new visibility isvisible { { return visibility.visible; } } the viewmodel of mainwindow.xaml contains property buttonviewmodel1 , buttonviewmodel2 . these p

python - scrapyd-client command not found -

i'd installed scrapyd-client(1.1.0) in virtualenv, , run command 'scrapyd-deploy' successfully, when run 'scrapyd-client', terminal said: command not found: scrapyd-client. according readme file( https://github.com/scrapy/scrapyd-client ), there should 'scrapyd-client' command. i had checked path '/lib/python2.7/site-packages/scrapyd-client', 'scrapyd-deploy' in folder. is command 'scrapyd-client' being removed now? create fresh environment , install scrapyd-client first using below pip install git+https://github.com/scrapy/scrapyd-client and should work. able it $ scrapyd-client /users/tarun.lalwani/.virtualenvs/sclient/bin/scrapyd-client the package on pip may not latest one

sql server - How should I connect my ms sql database with my maven project -

<bean id="datasource" class="org.springframework.jdbc.datasource.drivermanagerdatasource"> <property name="driverclassname" value="com.mysql.jdbc.driver" /> <property name="url" value="" /> <property name="username" value="" /> <property name="password" value="" /> </bean> mssql screen this code , screen shot of database .i want use orderinfo database. can please me should url username , password should be? try : <bean name="datasource" class="org.springframework.jdbc.datasource.drivermanagerdatasource"> <property name="driverclassname" value="com.mysql.jdbc.driver" /> <property name="url" value="jdbc:mysql://localhost:3306/orderinfo" /> <property name="username" value="" />

using jquery, how can i select all images inside of a div to change its source -

i have following div , know selector id of div. <div class="event"> <img src="/content/images/icons/calendar1.png"> <img src="/content/images/icons/calendar2.png"> <img src="/content/images/icons/calendar3.png"> <img src="/content/images/icons/calendar4.png"> <img src="/content/images/icons/calendar5.png"> <img src="/content/images/icons/calendar6.png"> </div> i need find images selector inside div have can go change source of each image new image. use code retrieve image url: $('.event img').each(function(){ alert($(this).attr('src')); }); if want change image url use this: var inc = 1; $('.event img').each(function(){ $(this).attr('src','path of image/imagename'+inc+'.imageextension'); inc++; });

Dynamic inheritance in Scala -

i have abstract grandparent class named grandparent , , parent class named parentone , , several children classes named childone , childtwo , childthree , ... , on. they written following: abstract class grandparent { val value: int def print(): unit = println(value) } class parentone extends grandparent { override val value: int = 1 } class childone extends parentone class childtwo extends parentone class childthree extends parentone what aiming provide method changing value printed in child classes to, example, 2 . want method simple can. the result creating class parenttwo following , making child classes inherit instead of parentone . class parenttwo extends grandparent { override val value: int = 2 } but know impossible, since can't dynamically change superclass. want make structure of library better, achieve task above. simplest way make it? you wrote what aiming provide method changing the which i'll take method sho

Convert JAVA program to PHP code -

i have below program in java. private static int frogjump(int[] arrel,int postion) { /** marker array leaf found on way. */ boolean[] leafarray = new boolean[postion+1]; /** total step needed frog. */ int steps = postion; for(int = 0; i<arrel.length; i++) { /** if leaf needed frog , not exist earlier. **/ if(postion>=arrel[i] && !leafarray[arrel[i]]) { /* mark leaf found */ leafarray[arrel[i]] = true; /** reduce step one(coz 1 jump found). */ steps--; } if(steps == 0 && arrel[i]==postion) { return i; } } return -1; } which want convert in php. till have done function solution ($a = [], $position) { $stonesarray = array(); $stonesarray[true] = $position + 1; $steps = $position; for($i = 0; $i< count($a); $i++) { echo &qu

javascript - How can I play an audio file while converting it with ffmpeg in Node.js? -

i created simple video-to-audio converter ffmpeg discord.js bot: let stream = //an mp4 stream ffmpeg(stream) .toformat("mp3") .stream(fs.createwritestream("./audio.mp3")) .on("end", () => { connection.playstream(fs.createreadstream("./audio.mp3")) }); this works fine, using .on() play file - after finishes converting - can take while. is there efficient way use connection.playstream play audio file or stream ffmpeg conversion still happening? i ended seeing this question , used growing-file module stream file being converted. here's general idea: const writestream = fs.createwritestream("./audio.mp3"); const stream = //mp4 stream ffmpeg(stream) .toformat("mp3") .pipe(writestream); const file = growingfile.open("./audio.mp3"); connection.playstream(file); the downside still forced download stream mp3 file, while prefer skip step , use connection.playstream play ffmpeg&#