Posts

Showing posts from May, 2013

amazon web services - Retrieving Username from CloudTrail logs for RunInstances event -

we have large number of ec2 instances running in aws 1 year. trying perform clean activity unused instances , based on username using have launched instances. i have tried downloading cloudtrail logs s3 bucket , tried filtering username , 'runinstances' event may find user launched instance , instance details. the following script used download cloudtrail logs single folder, unzip them , filter instances 'runinstances' event , give count of instances. i need on retrieving usernames each log wiht 'runinstances' event , stopping instances. my script: #!bin/sh s3url="s3://s3bucket/awscloudtraillogs/<accountno>/cloudtrail/region/2016/" (( i=1; i<=12; i++ )) (( j=1; j<=31; j++ )) if [[ $i -le 9 && $j -le 9 ]] aws s3 cp $s3url/0$i/0$j/ ~/test/ --recursive elif [[ $i -le 9 && $j -ge 10 ]] aws s3 cp $s3url/0$i/$j/ ~/test/ --recursive elif [[ $i -ge ...

excel - If function for cell contents -

i'm trying check if content range true, perform function. sheets(1).[a1:a95] if .cells.value = "text" 'perform function end if end but i'm getting type mismatch error. please. if trying check each cell in range whatever testing then, try way. dim ccell range each ccell in sheets(1).range("$a$1:$a$95") 'to test ensure ccell.value expect(can remove once working) debug.print ccell.value if ccell.value ="whateveryouwanttotestfor" 'call function here call myfunction end if next ccell to test multiple values of ccell use select case for each ccell in sheets(1).range("$a$1:$a$95") select case ccell.value case "text1" call text1function case "text2" call text2function 'do rest need end select next ccell

java - integrating email with Oracle Database -

i'm trying integrate oracle xe (11g) email (on linux). includes sending , receiving complete email, receiving attachments , loading them oracle. specifically, i'm looking linux command line email client read emails regularly pop3 or imap mailbox, load email , attachment table tables in oracle xe database. i've seen solution using database java, oracle xe not have java subsystem enabled (and doesn't handle attachments). the alternative using fetchmail, , procmail along sql*loader load emails database, have worked out how monitor email address , extract individual attachments received email, can't work out how extract email body single file, if can correct .procmailrc configuration. thanks

java - How can I fix the column width? -

Image
now width of each row changing depending on size of text. fixed size each column excel. should changed? shouldn't match_parent since parent has large width.. <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="horizontal"> <textview android:id="@+id/name" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margin="@dimen/text_margin" android:textappearance="?attr/textappearancelistitem" /> <textview android:id="@+id/email" android:layout_width="wrap_content" android:layout_height="wrap_conte...

php - Removing duplicated values from two-dimensional array -

i want remove duplicated values two-dimensional array. i have used array_unique function two-dimensional array. , seems function not work two-dimensional array. any suggestion or appreciated. thank in advance. here array output below: array ( [0] => array ( [is_hide] => 0 [key] => lho0vtlsfci7wwq2ewqy1nup5u13pxwlxt8s0775 ) [1] => array ( [is_hide] => 0 [key] => gisklozxrhxtmhklaeempuwojms08ftweencmrpk ) [2] => array ( [is_hide] => 0 [key] => lho0vtlsfci7wwq2ewqy1nup5u13pxwlxt8s0775 ) ) you can use php's array_map() function: $input = array_map("unserialize", array_unique(array_map("serialize", $input))); see this example .

How to set a specific destination directory when install a package using installpkg tool of slackware -

i trying make package , install in slackware os. package has binary executable file. have created package .tgz file using makepkg tool. when tried install package using installpkg tool binary file extracted root directory. how can change destination directory other location (like /usr/bin). what use of doinst.sh script in package.can write own script in it? thanks make temporary directory make tree structure of installed files make install/ directory 'slack-desc' file , (optional) 'doinst.sh' run makepkg /tmp/package-name-version-arch-build_tag.txz # mkdir /tmp/pkg; cd /tmp/pkg # mkdir -p usr/bin # cp /path/to/your/file usr/bin/ # chmod a+x usr/bin/file # mkdir install # cat <<eof >install/slack-desc appname: appname (short description of app) appname: appname: long description of appname, wrapped @ 71 characters *after* appname: colon following "appname" (and 'handy ruler' should start @ appname: colon , 71 characters ...

javascript - jQuery text() inside .getJSON() -

this question has answer here: $getjson , loop issue 4 answers i'm trying names pokemon api , putting div field in html, .text() function jquery doesn't seem place text html when put inside .getjson function. curious problem be? thanks. <div class="container"> <div class="row"> <div class="col-sm-3" id="1"> <div id="name1"></div> </div> <div class="col-sm-3" id="2"> <div id="name2"></div> </div> <div class="col-sm-3" id="3"> <div id="name3"></div> </div> <div class="col-sm-3" id="4"> <div id="name4"></div> ...

vba - Excel is freezing when importing large CSV -

Image
i have large csv file, 60 columns , 50k rows. (i can't show because in intranet.) i wrote vba code this: columns("d:bf").select selection.clearcontents *code import csv file d1* lastrow = cells(rows.count, "d").end(xlup).row range("a1:c1").select selection.copy range("a2:c" & lastrow).select selection.pastespecial paste:=xlpasteformulas, operation:=xlnone, _ skipblanks:=false, transpose:=false it working, has stopped working. when run macro excel freezes. need press "esc" , macro stops, debugger says pastespecial wrong. not, if run macro import, , press "esc", imports well, run second macro paste formulas until last row , runs too. the workbook in manual calculation http://i.stack.imgur.com/hkzje.jpg read csv file line line array 10,000 rows 100 columns. when array full write excel, redim array , continue until end of file. i tried use dynamic array excel freeze up. using static array mo...

r - ggplot2 graph and overriding -

i have started using ggplot2 so, once again apologize posting basic question. i read code in 1 of pages. code nicely plots line graph , average red dot: ggplot(mpg, aes(trans, cty)) + geom_point() + stat_summary(geom = "point", fun.y = "mean", colour = "red", size = 4) i thought of simplifying bit overriding contents of geom_point() , using stat="summary" ggplot(mpg, aes(trans, cty)) + geom_point(stat = "summary", fun.y = "mean", colour = "red", size = 4) + however, above code doesn't work. can please me why above code doesn't work? specifically, plots red dot (mean point). don't see scatterplot although have used geom_point() because ggplot() defines aes() , overriding them using geom layer. in first case, geom_point() completes plotting of points, , stat_summary() did part of adding summary statistics layer graph. but, when define stat = "summary" , tell...

php - Adding a 'other, please specify' option to my ChoiceType form field in Symfony -

i'm trying create form field set of choices text input needs filled out if choose 'other': how exercise? (*) not exercise @ moment ( ) once month ( ) once week ( ) once day ( ) other, please specify: [ ] currently, i'm using choicetype have set choices this: $form->add('exercise', type\choicetype::class, array( 'label' => 'how exercise?', 'choices' => [ 'i not excerise @ moment' => 'not', ... ], 'expanded' => true, 'multiple' => false, 'required' => true, 'constraints' => [ new assert\notblank() ], )); how 'other, please specify' option work expected? in case need create custom form type combination of choicetype , texttype . nice intro custom form types can find id doc: http://symfony.com/doc/master/form/create_custom_field_type.html this should similar to: class choicewithothertype extends abst...

csproj - TFS: How to validate if every file is checked-in? -

we working on several asp.net mvc c# projects within visual studio 2015 , team foundation server 2013. nuget upgrade process mess , of replaced files (mostly *.png, *.gif, *.ttf) have not been checked-in properly. have figured out far: check-in process gets trouble, if directories should removed , created in 1 step. have check-in twice. problem is, if don’t know , 1 of our developers retrieves latest source, there missing files. visual studio indicates warning icon in solution explorer. my question is: possible validate, if every file present during gated-checkin or nightly-build on tfs linked in csproj file? @ least there should warning during build. hint: problem files, not compiled (*.cs files) or not have setting “copy during build output directory”. happens e.g. js-files, bundled. final solution: write-host "check availability referenced files in projects ..." function check-files($directory, $files){ if (!$directory.endswith("/")) { $directo...

javascript - How to add values to array in jquery? -

i have below array appending values string strorderarr. var strorderarr = ''; $.each(uploaddata, function (i, item) { strorderarr = strorderarr + "{"; strorderarr = strorderarr + "'upld_contentlabel':" + "'" + item.label + "'" + ","; strorderarr = strorderarr + "'upld_documentname':" + "'" + item.docname + "'" + ","; strorderarr = strorderarr + "'upld_docid':" + "'" + item.docid + "'" + ","; strorderarr = strorderarr + "'upld_contentvalue':" + "'" + item.value + "'"; strorderarr = strorderarr + "'upld_contentid':" + "'" + item.doc_contentid + "'"; //strorderarr = strorderarr + "...

rest - SprintBoot returning a PNG from a Controller's RequestMapping -

Image
i've been scouring internet resources , feel have answer, can't quite seem bufferedimage returned browser window. the project generates maze can create bufferedimage . here code controller. @requestmapping(method = requestmethod.get, path = "/image", params = {"rows", "columns"}) public responseentity<byte[]> image(@requestparam(name = "rows") int rows, @requestparam(name = "columns") int columns) throws ioexception, interruptedexception { try { basiccartesiangrid requestedmaze = new basiccartesiangrid(rows, columns); requestedmaze.foreach(cellalgorithms.binary_tree); bufferedimage bufferedimage = requestedmaze.todisplayimage(); { // dumping file debugging <- works expected file outputfile = new file("save.png"); imageio.write(bufferedimage, "png", outputfile); } bytear...

linux - How to allow the root user to write files into HDFS -

i have installed hadoop on cent os 7. daemon service written in python trying make directory in hdfs , getting below permission error. mkdir: permission denied: user=root, access=write, inode="/rep_data/store/data/":hadoop:supergroup:drwxr-xr-x looks service running under root account. know how give permission root user make directory , write files. if trying create directory under hdfs root i.e / , may face type of issue. can create directories in home, without issues to create directory in root, execute command follows sudo hdfs hdfs dfs -mkdir /directory/name to create directory in hdfs home execute below command hdfs dfs -mkdir /user/user_home/directory/name

php - Can't track, count logins of a user in Laravel -

i count how many times user has been logged in using events in laravel. i have event defined: <?php namespace app\handlers\events; use illuminate\queue\interactswithqueue; use illuminate\contracts\queue\shouldbequeued; use app\user; use illuminate\support\facades\log; class authlogineventhandler { /** * create event handler. * * @return void */ public function __construct() { // } /** * handle event. * * @param user $user * @param $remember * @return void */ public function handle(user $user, $remember) { log::info('logged in'); $user->login_counter = 1; $user->save(); $user->increment('login_counter'); } } and in eventserviceprovider have following: <?php namespace app\providers; use illuminate\contracts\events\dispatcher dispatchercontract; use illuminate\foundation\support\providers\eventserviceprovider servicep...

mysql - Joining name in SQl -

i new sql , tasked joining first name , last name of actors in mysql. select first_name ||''|| last_name name actor order actor_id; i did not working. string of zeros. like 0 0 0 0 0 0 0 0 0 if me solve problem. wonderful. try use concat function select concat(first_name, last_name) name actor order actor_id; further details here

elasticsearch - Elastic Search (COUNT*) with group by and where condition -

dear elastic serach users, i newbie in elasticsearch. i confused how convert following sql command elasticsearch dsl query ? can assist me. select ip, count(*) c elastic date between '2016-08-20 00:00:00' , '2016-08-22 13:41:09' , service='http' , destination='10.17.102.1' group ip order c desc; thank you the following query achieve want, i.e. select documents within desired date range , required service , destination , run terms aggregation (=group by) on ip field , order latter in decreasing count order. { "size": 0, "query": { "bool": { "filter": [ { "range": { "date": { "gt": "2016-08-22t00:00:00.000z", "lt": "2016-08-22t13:41:09.000z" } } }, { "term": { "service": ...

javascript - Bootstrap Modal from PHP generated table list - Pass in values from list -

i have simple html table generated php call database: <?php foreach($records $record){ $staffname = $availability->getfield('fullname') ; $staffmobile = $availability->getfield('cell') ; } i display table link on name bootstrap modal: <tr> <td><a href="#" data-toggle="modal" data-target="#mymodal"><?php echo $staffname; ?></td> <td><?php echo $staffmobile ;?>mobile number</td> </tr> i modal appears have button able call , sms staff member in list. modal @ moment appears: <div class="modal" id="mymodal"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="...

ios - NSKeyedArchiver Custom Object Array -

note: xcode 8 beta 6 i not sure missing reason getting following error on nskeyedarchiver.archiveddata line. 'nsinvalidargumentexception', reason: '-[_swiftvalue encodewithcoder:]: unrecognized selector sent instance 0x60000024c690' *** first throw call stack: here class conforms nscoding protocol: enum phrasetype { case create case item } class phrase: nsobject, nscoding { var englishphrase :string! var translatedphrase :string! var phrasetype :phrasetype! = phrasetype.item required init?(coder decoder: nscoder) { self.englishphrase = decoder.decodeobject(forkey: "englishphrase") as! string self.translatedphrase = decoder.decodeobject(forkey: "translatedphrase") as! string self.phrasetype = decoder.decodeobject(forkey: "phrasetype") as! phrasetype } func encode(with coder: nscoder) { coder.encode(self.englishphrase, forkey: "englishphrase") ...

sqoop incremental lastmodified with merge-key -

i trying import updated records in hdfs. earlier had 3 part file in hdfs.when run below tool gave error merge key required. sqoop import --table employee --username training --password training --connect jdbc:mysql://localhost/loudacre --incremental lastmodified --check-column modified --last-value '2016-08-22 19:02:41' however, when used merge-key option can see part file records in it. this expected guess. generally, merge tool run after incremental import --incremental lastmodified mode. when merging datasets, assumed there unique primary key value in each record ( mentioned --merge-key ). the merge tool run mapreduce job merge datasets one, taking newest available rows each --merge-key . check sqoop docs more details.

facebook - Permissions to Read Likes via Graph API -

since rest api has gone, need find way read likes pages of our webapp. according graph api docs, following should return likes object (such page): https://graph.facebook.com/v2.6/{page-id}/likes?summary=true oops, an access token required request resource . turns out, instead of real token, can build ad-hoc token witht app id , secret: https://graph.facebook.com/v2.6/{page-id}/likes?summary=true&access_token={id}|{secret} the above returns json payload, however, it's empty though i'm trying page having 200 likes: { "data": [ ], "summary": { "total_count": 0, "can_like": false, "has_liked": false } } maybe permissions problem? app domain , page url domain identical. big hints solve riddle! it work simple app access token too, assume wrong idea endpoint. there no way "page fans", can "other pages current page likes" it. try app access token: ...

c# - Storing a file in an existing/ created folder keep saying access denied -

trying upload file created folder error keeps coming access path 'c:\users\joe\documents\visual studio 2015\projects\training\site1\site1\content\productimages' denied. and below this exception details: system.unauthorizedaccessexception: access path 'c:\users\joe\documents\visual studio 2015\projects\training\site1\site1\content\productimages' denied. asp.net not authorized access requested resource. consider granting access rights resource asp.net request identity. asp.net has base process identity (typically {machine}\aspnet on iis 5 or network service on iis 6 , iis 7, , configured application pool identity on iis 7.5) used if application not impersonating. if application impersonating via , identity anonymous user (typically iusr_machinename) or authenticated request user. to grant asp.net access file, right-click file in file explorer, choose "properties" , select security tab. click "add" ...

php - .htaccess not read on localhost xampp -

i have problem .htaccess file not being read apache. i'm using on local machine, port 81. i'm using windows 10. i created .htaccess file in root directory of .php files. when enter rubbish inside .htaccess file nothing happens (website loads normally). i've checked many tutorials, threads , unable find viable solution. what have done far: entered in .htaccess file check or 500 error (didn't work) checked httpd.conf file allowoverride all (for directory well) re-installed xampp this how settings in httpd.conf now: # # allowoverride controls directives may placed in .htaccess files. # can "all", "none", or combination of keywords: # allowoverride fileinfo authconfig limit # allowoverride # # controls can stuff server. # <directory /> allowoverride # require denied </directory> i've got no idea next. ideas? is section in httpd.con this, or looking other file name? # # accessfilename: name of file in eac...

android - Even after removing an erroneous line of code, an error still persists -

i'm working on app keep score card game, , working fine until now. have several places check make sure number put in won't cause errors, is, don't break rules of game. if such input encountered, app opens alertdialog telling user of problem. however, had tried call getdialog().setcanceledontouchoutside(false) , threw nullpointerexception since creating alertdialog alertdialog.builder . removed statement, every time try run app , intentionally make alertdialog pop up, nullpointerexception message shows , app crashes. here's method creates alertdialog : @override public dialog oncreatedialog(bundle savedinstancestate) { alertdialog.builder builder = new alertdialog.builder(getactivity()); builder.settitle(getstring(r.string.title_error)) .setmessage(errortext) .setcancelable(false); switch (errortype) { case 1: builder.setpositivebutton(getstring(r.string.text_ok), new dialoginterface.onclicklisten...

c# - ASP.NET MVC. Code First Parent navigational property not populated automatically -

given these poco classes class mainclass{ [key] int id {get;set;} public string name {get;set;} [required] public virtual icollection<subitem> subitems {get;set} // unique sub items } and class subitem{ [key] int id {get; set;} public string name {get;set;} [required] // required nedded. subitem cannot exist it's self public mainclass parent {get; set;} } when posting , binding controller, set, , set subitems state to: public virtual actionresult edit([bind()] mainclass entity) { foreach(var subitem in entity.subitems) db.entry(subitem).state = system.data.entity.entitystate.modified; if (modelstate.isvalid) { // fails here db.entry(entity).state = system.data.entity.entitystate.modified; db.savechanges(); return redirecttoaction("edit", new { edited = "true" }); } } however modelstate contains "parent cannot null" error each item. , validations ...

How do you create a dropdownlist from an enum in ASP.NET MVC? -

i'm trying use html.dropdownlist extension method can't figure out how use enumeration. let's have enumeration this: public enum itemtypes { movie = 1, game = 2, book = 3 } how go creating dropdown these values using html.dropdownlist extension method? or best bet create loop , create html elements manually? for mvc v5.1 use html.enumdropdownlistfor @html.enumdropdownlistfor( x => x.yourenumfield, "select type", new { @class = "form-control" }) for mvc v5 use enumhelper @html.dropdownlist("mytype", enumhelper.getselectlist(typeof(mytype)) , "select type", new { @class = "form-control" }) for mvc 5 , lower i rolled rune's answer extension method: namespace myapp.common { public static class myextensions{ public static selectlist toselectlist<tenum>(this tenum enumobj) tenum : struct, icomparable, iformattable, icon...

javascript - Multitenant configuration data for the SDK Library -

this question builds on answer previous question , looking solution share configuration data between actors (nodejs modules) of system (sdk) without using factory pattern. this time need make sdk multi-tenant providing different configuration data distinct sdk instances. app.js var sdkaccta = require("./sdk"); sdkaccta.config = {key: "key", secret: "secret"}; var sdkacctb = require("./sdk"); sdkacctb.config = {key: "key2", secret: "secret2"}; // use both of them concurrently without each 1 overriding config data of other var ma = new sdkaccta.m1(); ma.dosomething(); var mb = new sdkacctb.m1(); mb.dosomething(); sdk.js var sdk = function(){}; sdk.config = {key: null, secret: null}; module.exports = sdk; require("./m1"); //executing other modules make work m1.js var sdk = require("./sdk"); var m1 = function(){}; m1.prototype.dosomething = function(){ var config = sdk.config //g...

javascript - Accesing session variables during ajax call -

i have created session variable during ajax call. session variables available once refresh page. using ajax call whole page not refreshed. part of div refreshed. please refer below: //during ajax call request.getsession().setattribute("hi","hilist"); so want list using request.getsession().getattribute("hi"); how that? thanks in advance.

sorting - Sort an item in a list of tuples in the values of a dictionary with Python -

i'm trying sort first item in list of tuples in value of dictionary. here dictionary: d = {'key_': (('2', 'a'), ('3', 'b'), ('4', 'c'), ('1', 'd'))} i want sorted output this: d2 = {'key_': (('1', 'd'), ('2', 'a'), ('3', 'b'), ('4', 'c'))} i tried sorting values new dictionary, doesn't work: d2 = sorted(d.values(), key=lambda x: x[0]) d.values() return list of values present within dictionary. here want sort list present value corresponding key_ key. so, have call sorted function as: # using tuple example having tuple instead of list >>> d['key_'] = tuple(sorted(d['key_'], key=lambda x: x[0])) >>> d {'key_': (('1', 'd'), ('2', 'a'), ('3', 'b'), ('4', 'c'))} alternatively (not suggested), may directly s...

javascript - Does setting image's source also load the source? -

say have following code: var img = document.createelement('img'); img.src = 'https://somepicture.png'; does image loaded source's data if don't append image dom? in other words, can make callback using img.onload() run if don't show image user? yes, setting source attribute load image. you can attach load event image, , setting source attribute if not on page common approach used when preloading images prevent tearing on page during image swap. 4.7.1 img element in browsing context scripting disabled, user agents may obtain images or on demand. in browsing context scripting enabled, user agents must obtain images immediately. a user agent obtains images must synchronously update image data of img element whenever element created src attribute. user agent obtains images must synchronously update image data of img element whenever element has src or crossorigin attribute set, changed, or removed. https://www.w3.org/...

java - HTTPS Requests with ClientResource -

when create requests http works this: clientresource resource = new clientresource(protocol + "://localhost:" + port + path); however when create https requests error: starting internal [https/1.1] server on port 8081 starting internal http client recoverable error detected (1001), attempting again in 2000 ms. recoverable error detected (1001), attempting again in 2000 ms. stopping internal server i know when use client object should set that: client client = new client(protocol.https); so, suspicious setting clientresource . tried didn't solve: resource.setprotocol(protocol.https); also tried that: client client = new client(protocol.https); resource.setprotocol(protocol.https); resource.setnext(client); however got same logs. can see logs, first creates https server http client. any ideas? problem related certificates. i've set trust keystore , used example.

c++ - Using SFINAE to select the interface to implement -

i'm trying select interface concrete class implements based on template parameter. in simplified example below there 2 interfaces methods of different names - implementation class needs provide method implementations, depending on template parameter. if use inttype - should implement intinterface ( getint() , setint(int) ). if use doubletype - should implement doubleinterface ( getdouble() , setdouble(double) ). in order achieve this, created traits class determines interface should used ( interfacetype ), has parameter used sfinae. the idea if use e.g. mytypetrait<type>::mytypeint relevant trait class has no mytypeint definition, compiler throw possible overload (for e.g. setint() ), , use one. that's dummys should kick in - have different arguments , they're not virtual. however, doesn't work. see below compiler errors. i'm using visual studio 2013 (vc12). struct intinterface { virtual int getint() const = 0; virtual void set...

sharing - How to share an html page -

i working on simple text adventure game , finished beta version on website using, super psyched website didn't have easy publish link instead download html saved on computer. kinda disappointed figured can share html file in file sharing service tried end codes , not open html, mean want avoid users having download game because i'm gonna keep updating , saves lost, , google drive , dropbox have stopped html static whatever called hosting, i'm searching google solution in meantime, if guys know please help https://jsfiddle.net/ work pretty want.

firebase - Azure Notification Hubs populating the "Notifications" area on a mobile device -

Image
can azure notification hubs used populate notifications area on mobile device when "application" not running? we creating cloud-based mechanism notify sets of mobile devices when events occur server-side. mobile devices have our apps (ios , android) installed , register our back-end service. we want leverage features of apn / firebase such can send notifications area directly. in other words, need able send notifications devices regardless of whether mobile user has started our app or not. i've been going through azure notification hub documentation , tutorials see how azure notification hubs might of examples have code in mobile application listens directly specific azurenotificationhub. is there way application can register azure notification hub at install time such it's listening though mobile application not running? in sense using notification hubs no different using native push notification services (pns) directly. azure notification ...

Why am I getting error with this c++ code? -

#include <iostream> using namespace std; int volume(int l, int w, int h); int main() { int y, x, z; cout << "enter length, width , height respectively " << endl; cin >> y >> x >> z; volume(y, x, z); cout << "the volume " << volume(); return 0; } int volume() { return l*w*h; } i getting 3 errors follows:- error 'l' not declared in scope. error 'h' not declared in scope. error 'w' not declared in scope. please me rectify error. your definition of volume doesn't match prototype. needs have 3 parameters l , w , , h defined in function prototype. int volume (int l, int w, int h){ return l*w*h; }

Matlab: Run Matlab apps programmatically -

i want launch 1 of apps included in matlab version called classification learner programmatically. how can done? i tried following not work: matlab.apputil.run('classificationlearner') a quick google search 'classification learner app matlab' tells me following do: >>classificationlearner

javascript - include in document.referrer in "else if" -

i have script displays modal if no cookie. first if, if cookie exists hides modal, , "else" if there no cookie, display it. i need add document.referer condition below. besides verifying cookie if not exist check referer (the same function below), , display modal. the code: jquery(document).ready(function() { if (jquery.cookie('visits') > 0.5) { jquery('#active-popup').hide(); jquery('#popup-container').hide(); jquery('html, body').removeattr('style'); } else { var pageheight = jquery(document).height(); jquery('<div id="active-popup"></div>').insertbefore('body'); jquery('#active-popup').css("height", pageheight); jquery('#popup-container').show(); jquery('html, body', window.parent.document).css({ 'overflow': 'hidden', 'height': '100%' }); } ...

RegEx: Match string but only if of certain minimum length -

i have huge number of text documents , try extract specific part each of them. starts "item 7" @ beginning of row , ends "item 8" @ beginning of row. can find part regex : (^( *)item 7(.+?)^( *)item 8) my 2 questions are: there potentially 2 parts fit description in each of documents. want make sure match second one, substantially longer. how can extract part using regex in "search , replace" query using notepad++? i'm not sure if using right tool this. thanks! supplement: of answers far did following in notepad++. search for .*(^( *)item *7(?! a)(?!. ^item *7(?! *a))(.+?)^( *)(?=^item 8)). raplce with $1 thanks far. works great 1 excepction. i'm afraid have go more detail: most, not all, documents want extract text have table of content. that's why want extract second case of "item 7 item 8", in case there two. there item 7a, in case wonder code. as realized, there number of documents, have "item 7...

Reading data from excel table and outputting it to xml using vba macro? -

i have data in excel table in format similar 1 below. colum1_heading column2_heading 1 b 2 c 3 i trying convert data in table xml, have same number of columns indeterminate number of rows. the xml format this <?xml version="1.0" encoding="utf-8"?> <root> <tag1> <tag2> - 1, b - 2, c - 3 </tag2> </tag1> </root> so think should simple. far i've started writing code creates writeable string write new xml file, i'm pretty new vba i'm still researching bunch on internet. i've inputted header , beginning , end tags since same. question how read rows of table , write them xml in format shown above. appreciated. please let me know if need additional info. this should started. add reference msxml2: sub test() new msxml2.domdocum...

arrays - trouble calling a method in the same class java -

i've been asked following problem: implement method accepts array of integers input , returns sum of of elements in array output. this have(the entire program): import java.util.*; public class sumarray{ public static void main(string[] args){ int sum1; int sum2; scanner num = new scanner(system.in); int array[]=new int[5]; // intilized array of size 5 (int i=0;i<5;i++) // used loop user input { system.out.println("please enter integer: "); array[i]=num.nextint(); // assigned users value array } system.out.print("the integers are: "); (int i=0;i<5;i++) // loop display values { system.out.print(array[i]+","); } } public static int sum(int array[]) { int sum1 = 0; (int i=0; < array.length; i++) sum1 = sum1 + array[i]; return sum1; } } every time try call method "sum" ...

python - How can I make this code quicker? -

i have lot of 750x750 images. want take geometric mean of non-overlapping 5x5 patches each image, , each image, average geometric means create 1 feature per image. wrote code below, , seems work fine. but, know it's not efficient. running on 300 or images takes around 60 seconds. have 3000 images. so, while works purpose, it's not efficient. how can improve code? #each sublist of gmeans contain list of 22500 geometric means #corresponding non-overlapping 5x5 patches given image. gmeans = [[],[],[],[],[],[],[],[],[],[],[],[]] #the loop here populates gmeans. folder in range(len(subfolders)): just_thefilename, colorsourceimages, graycroppedfiles = get_all_images(folder) items in graycroppedfiles: myarray = misc.imread(items) area_of_big_matrix=750*750 area_of_small_matrix= 5*5 how_many = area_of_big_matrix / area_of_small_matrix n = 0 p = 0 mylist=[] while len(mylist) < how_many: myl...

python - How do I assign series or sequences to dask dataframe column? -

my dask dataframe follwing: in [65]: df.head() out[65]: id_orig id_cliente id_cartao inicio_processo fim_processo score \ 0 1.0 1.0 1.0 1.0 1.0 1.0 1 1.0 1.0 1.0 1.0 1.0 1.0 2 1.0 1.0 1.0 1.0 1.0 1.0 3 1.0 1.0 1.0 1.0 1.0 1.0 4 1.0 1.0 1.0 1.0 1.0 1.0 automatico canal aceito motivo_recusa variante 0 1.0 1.0 1.0 1.0 1.0 1 1.0 1.0 1.0 1.0 1.0 2 1.0 1.0 1.0 1.0 1.0 3 1.0 1.0 1.0 1.0 1.0 4 1.0 1.0 1.0 1.0 1.0 assigning integer works: in [92]: df = df.assign(id_cliente=999) in [93]: df.head() out[93]: id_orig id_cliente id_cartao inicio_processo fim_processo score \ 0 ...

scikit learn - Adding New Text to Sklearn TFIDIF Vectorizer (Python) -

is there function add existing corpus? i've generated matrix, i'm looking periodically add table without re-crunching whole sha-bang e.g; articlelist = ['here text blah blah','another text object', 'more foo bar right now'] tfidf_vectorizer = tfidfvectorizer( max_df=.8, max_features=2000, min_df=.05, preprocessor=prep_text, use_idf=true, tokenizer=tokenize_text ) tfidf_matrix = tfidf_vectorizer.fit_transform(articlelist) #### adding new article existing set? bigger_tfidf_matrix = tfidf_vectorizer.fit_transform(['the last article wanted add']) you can access vocabulary_ attribute of vectoriser directly, , can access idf_ vector via _tfidf._idf_diag , possible monkey-patch this: import re scipy.sparse.dia import dia_matrix def partial_fit(self, x): max_idx = m...

javascript - Ajax Click different of move mouse but there is a click -

i'm playing google map api , use ajax update sql qith code: $(document).ready(function() { $('#map').click(function() { var request = $.ajax({ url: "php/clic.php", data: { label: "value" }, method: "post" }); request.done(function() { // after done. }); }); }); map si div of google map. the problem code clic.php executed when user clicking on div if user clicking move map. don't know ajax lot, want else condition detect if s move/clic instead of simple clic! thx! check event.target see if it's #map element. $("#map".click(function() { if (event.target != this) { return; } // rest of function });

c# - convert InstanceContextMode.Single to InstanceContextMode.PerCall -

i have wcf service takes 5 min load database. want best performance out of wcf , found article http://theburningmonk.com/2010/05/wcf-improve-performance-with-greater-concurrency/ states better performance using percall. have anywhere between 2000 , 4000 hits per second. my problem takes long time load data. per article it's saying create wrapper real service using static variable. not sure how looks , have no idea _container is. chance can give me full example of below? in cases initialization steps lengthy , unavoidable, or class require number of parameters in constructor (for instance, when programmatically host service retrieve ioc container) parameterless constructor can become problem. around this, create wrapper class , expose wrapper service instead hold static instance of underlying service requests passed on to: [servicebehavior(instancecontextmode = instancecontextmode.percall)] public class myservicewrapper : imyservicewrapper { // underlying service ...

html - Call a JavaScript function with parameters when click on href -

i trying come code create href tag javascript functions gets parameters. parameters string , object converted json string. attempt this: return '<a style="text-decoration:underline;cursor:pointer" target="_blank"' + ' href="javascript:gotostatenewwindow(\'trending\', \'' + json.stringify(params) + '\')">' + value + '</a>'; the error was: uncaught syntaxerror: invalid or unexpected token in inspect window looked this: <a style="text-decoration:underline;cursor:pointer" target="_blank" href="javascript:gotostatenewwindow('trending', '{" projectid":2313,"alarmsonly":"true"}')"="">test</a> can please explain doing wrong? firstly, shouldn't <a> element, <button> . can use css make <a> if want. secondly, should rather create en elemen...