Posts

Showing posts from January, 2015

python - Django ValueError: ModelForm has no model class specified -

i have following code complains following error: valueerror: modelform has no model class specified. from django import forms straightred.models import straightredteam straightred.models import userselection class selecttwoteams1(forms.form): campaignnoquery = userselection.objects.filter(user=349).order_by('-campaignno')[:1] currentcampaignno = campaignnoquery[0].campaignno cantselectteams = userselection.objects.filter(campaignno=currentcampaignno) currentteams = straightredteam.objects.filter(currentteam = 1).exclude(teamid__in=cantselectteams.values_list('teamselectionid', flat=true)) team_one = forms.modelchoicefield(queryset = currentteams) team_two = forms.modelchoicefield(queryset = currentteams) class selecttwoteams(forms.modelform): used_his = forms.modelmultiplechoicefield(queryset=userselection.objects.filter(user__id=1)) def __init__(self, user, *args, **kwargs): super(selecttwoteams, self).__init__(*...

javascript - Controller functions not being called from ng-click link in Angular -

i'm using angular bootstrap calendar custom cell template , cell modifier . in controller, i"m building bunch of tables inside each day cell. of cells have link that, when clicked on, should run function in controller add or delete record on end , change content of cell. here's ui-router definition: $stateprovider .state('home', { url: '/', templateurl: 'views/home.html', }) .state ('calendar', { url : '/calendar', templateurl: 'views/calendar/index.html', controller: 'calendarcontroller', controlleras: 'vm' }); here's relevant controller code: (function() { angular.module('formioappbasic') .controller('calendarcontroller', function($scope, moment, calendarconfig, $http, formio, shiftservice, appconfig, $q) { var vm = this; calendarconfig.templates.calendarmonthcell = 'views/calendar/daytemplate.html'...

ios - Call method in another View Controller, but not segue to it? -

i have tabbed application. tab : download button. tab b : tableview what want when click button in a, want download function in b called. now have several scenarios after click button: stay in a if click b now, can see download process, or if finished, can see file there. +----------------+ +-----------------+ | | |downloaded files | | | +-----------------+ | +------------+ | | | | | download | | +-----------------+ | +------------+ | | | | | | | +-------+--------+ +--------+--------+ |now in | b | | | in | | | | | | b | +-------+--------+ +--------+--------+ now write download function in a, , save files in directory, whenever click tab b, viewwillappear function load downloaded files directory, problem want show download process in case file large. ...

gwt 2.5 - JS functions in GWT -

how use simple js functions in gwt? (picture animation script example) <script type="text/javascript"> var cspeed=4; var cwidth=64; var cheight=64; var ctotalframes=8; var cframewidth=64; var cimagesrc='images/sprites.gif'; var cimagetimeout=false; var cindex=0; var cxpos=0; var cpreloadertimeout=false; var seconds_between_frames=0; function startanimation(){ document.getelementbyid('loaderimage').style.backgroundimage='url('+cimagesrc+')'; document.getelementbyid('loaderimage').style.width=cwidth+'px'; document.getelementbyid('loaderimage').style.height=cheight+'px'; //fps = math.round(100/(maxspeed+2-speed)); fps = math.round(100/cspeed); seconds_between_frames = 1 / fps; cpreloadertimeout=settimeout('continueanimation()', seconds_between_frames/1000); } function continueanimation(){ cxpos += cframewidth; //increase index know frame of our animatio...

Insert text when new related field added filemaker 11 -

i have been tasked adding functionality old filemaker 11 database. i have table portal related field. whenever entry added portal insert text description field prompt users record specific information related portal field. i have set global variables hold required text , in case of normal field quite easy trigger text insert based on value in field. having trouble figuring out how trigger insert text based on values in portal. suggestions? in general, can insert default value field using field's auto-enter options . if want happen upon record's creation, leave do not replace existing value (if any) option checked. i did not understand part: how trigger insert text based on values in portal. you need explain how inserted text should " based on values in portal ".

jquery - turn a curl call into a javascript ajax call -

how turn curl request ajax call in javascript? (an answer in raw js or library fine) curl: curl -h "content-type: application/json" -d '{"foo":0, "bar": 0, "baz":"test"}' -x http://localhost:8080/public/v1/state/helloworld the url tried in ajax call (it gives 404 error): get http://192.168.56.101:8080/public/v1/state/helloworld?foo=0&bar=0&baz=test code return axios.get(switchdomain + '/public/v1/state/helloworld', { params: { foo: 0, bar: 0, baz: "ber", } }) .then(function(response){ console.log('perf response', response); }); seems -d turn curl request post regardless of -x option, so: var req = new xmlhttprequest(); req.open( "post", "http://localhost:8080/public/v1/state/helloworld", true); req.send("foo=0&bar=0&baz=test"); eventually may need add content-type header after req.open , b...

What html tags are not affected by same origin policy? -

i have read this page same origin policy regarding script tag. situation is: have 2 domain manage (host differently) , need share (actually lot) resources (particularly js, css , media). ask whether following tags affected or not affected if source domain: <script> <img> <audio> <link rel="stylesheet"> (possibly <video>) from page linked above, seems can wrote html domain b can have <script> tags directly link domain a, cannot css. correct? must copy css file of domain domain b if want use them? you can include external css same way include js ! do in head section: <link rel="stylesheet" type="text/css" href="your_file_name.css">

node.js - I am new to Node js; and am having trouble using starting using it -

i have installed node.js website, when type in install npm after directions in command line; states "unexpected token: illegal". how fix this? there specific step step way install node.js , package.json? it depends on want do: if want create new application scratch: md myapp npm init then answer questions npm asks you. npm init creates package.json you. now can install other packages express using npm installl --save express if have been cloning node.js app or module github, change directory, run: npm install

ios - UITableView Animate Height without ReloadData, Updates, or Edits -

i have tableview buttons can increase , decrease contentview's height of individual cells. individual cells have lot of configurations aren't persisted.(the end solution includes persisting data, there other issues follow) want able click button in cell, have cell expand pushing other cells down, , have cells keep configured data. if use reloaddata, have persist everything, , lot of unnecessary reprocessing when editing 1 cell. lastly, there isn't free animation expand or shrink. this leads table view updates , cell reloads come animations , less overhead. can call uitableview.beginupdates , uitableview.endupdates. or more ideally, call reloadrowsatindexpaths visible cells after editing cell. in case, animate height change while keep current cells data current. doesn't work. finally, here problem. uitableview.beginupdates, uitableview.endupdates, , reloadrowsatindexpaths cause table view scroll. means if cell trying change height of has indexpath high enough, ...

javascript - Check for a GET variable in URL -

so i'm making simple log in form in site using jade , expressjs. it's working, problem i'm having when user enters incorrect log in details. when enter wrong details redirect them log in page parameter in url ( /admin?falselogin ). question is: how can check if variable exists in jade view? this code: log-in.jade form(action="/log-in" method="post") label username input(type="text" class="form-control" name="username" placeholder="username") label password input(type="text" class="form-control" name="password" placeholder="password") input(type="submit" class="btn btn-info pull-right" style="margin-top: 15px;" value="log in") app.js app.get("/admin",function(req, res){ if(req.session.username){ res.render("admin", {session_name: req.session.username}); }else{ ...

Subquery returned more than 1 value. when the subquery is used as an expression.in SQL Server -

can tell me how solve problem? here's code subquery : select a.storeno, c.[date], a.productbarcode, a.productqty ##inv1 #calender c outer apply (select top 100 percent * ##temp i.date < c.date , storeno in (select storeno ##storelist) order i.date) option (maxrecursion 0) i used top 100 percent because have more 1000 productbarcode each storeno, if choose top 1 showing 1 productbarcode duplicate value next day. declare @pheader nvarchar(max), @sql_pivot nvarchar(max) begin select @pheader = stuff((select distinct ',' + quotename([storeno]) ##storelist xml path(''), type).value('.', 'nvarchar(max)'), 1, 1, '') --set @pheader = left(@pheader, len(@pheader) - 1) set @sql_pivot = 'select * ...

SQLite strftime() weekday -

i have been trying no success to count how many values created in specific week day: select count(*) count packets strftime("%w", timein) = '1'; i have values in timein 1472434822.60033 1472434829.12632 1472434962.34593 i don't know doing wrong here. furthermore, if use this: select count(*) count packets strftime("%w", timein) = '6'; i get 2 which makes no sense. thank in advance. you appear storing date number of seconds since 1970 (the unix epoch) - common representation. time strings accepted sqlite date functions (see time strings section) default interpreting numeric time strings julian day numbers: similarly, format 12 shown 10 significant digits, date/time functions accept many or few digits necessary represent julian day number. you can see following select : select strftime('%y-%m-%d', 1472428800.6) t the result of is: 4026-48-26 for date representation interpreted unix epoch, nee...

actionscript 3 - How to make if chains -

i making game assignment in as3.0 , isn't working. variables , buttons defined, no error dose not function : frame 2 layer 1 function checkscene():void { p_hp = 5 e_hp = 1 a_d = 1 if(p_hp == 5) if(e_hp == 2) if(a_d == 1) q = 1 if(p_hp == 5) if(e_hp == 1) if(a_d == 1) q = 2 } frame 2 layer 2 stop(); but.addeventlistener(mouseevent.click, fl_clicktogotoandstopatframe); function fl_clicktogotoandstopatframe(event:mouseevent):void { gotoandstop(5); } frame 3 layer 2 button_2.addeventlistener(mouseevent.click, fl_clicktogotoandstopatframe_2); function fl_clicktogotoandstopatframe_2(event:mouseevent):void { if(q == 1) gotoandstop(5) if(q == 2) gotoandstop(4) } basically goes frame 4 if works, or 5 if doesn't. if chain isn't working. have no clue how because sort of thing works in excel (for checking multiple variables before execution). s...

php - How to get data from 3 mysql tables? -

i have 3 mysql tables a) contact_details b) history , c) company. now getting family_name contact_details table based on last 5 view_id history table . my current query working fine :) now want company_name data company table company.cid match contact_details.cid . how can following working query ? working query : $getviewid2 = mysqli_query($link, "select cd.family_name, t.* contact_details cd inner join ( select history.* history inner join ( select view_id, max(view_date) max_view_date history is_save in (0,1) , mark_as = 1 group view_id order max_view_date desc limit 5 ) latesthistory on history.view_id = latesthistory.view_id , history.view_date = latesthistory.max_view_date ) t on cd.cdid = t.view_id order cd.family_name asc"); well bombs if companyid doesn't exist contact details after cd.cdid = t.view_id add , company cy company.cid ...

logging - What is the structure or format of the logs generated by GlassFish Server? Is it configurable? -

the glassfish server generates logs can error logs or debug logs or whatever, visible in console. wanted know if configurable. knowledge log-format , fields contains helpful. i got answer location of log files. found here: " c:\program files\glassfish-4.1.1\glassfish\domains\domain1\logs\server.log " but still unclear formats. if can clarify fields logged in it. , whether configurable or not.

php - How to read two or more attributes from the node in XPath? -

foe example : html: <div id="1" class="op" style='display: none;'> <h4>a</h4> <h4 >b</h4> </div> query: $elements = $xpath->query("//div[@id='1']@style='display:none;']/@id/@style"); echo @id echo @style but not work! you have typo missing [ on query , use normalize-space : $elements = $xpath->query("//div[@id='1'][normalize-space(@style = 'display: none;')]"); if($elements->length > 0) { echo $elements->item(0)->getattribute('class'); // foreach($elements $e) { // } }

ios - NSMutableArray changing old stored data issue -

i parsing json , storing data nsmutablearray on homepage. want access data on other page not after another, using singleton pattern sharing common data in homepage. storing nsmutablearray data singleton file common access. in second page showing data in tableview . there 1 button modifies data not change original data i.e homepage arraydata . storing data clonearray , updating clonearray . when return homepage , in viewdidappear after placing breakpoint observing original data changed. please have on issue , correct me doing wrong code. for more reference added project link please download , check this: [project link][1] in project have created 2 view controllers , 1 model class, , 1 singleton common data across file. view controller: in file parsing json , storing in nsmutablearray , setting same array data singleton file array common access across file. secondviewcontroller: in file getting array data singleton file , storing in local array. there 1 button mod...

c# - How to create a ListView with a static image size Xamarin Forms -

Image
i have list works fine, when bind large image not fill's entire image box size set 100x100, how create image size able adapt resolution ? xaml code : <listview backgroundcolor="white" grid.row="2" separatorvisibility="default" hasunevenrows="true" itemselected="item" x:name="listview"> <listview.itemtemplate> <datatemplate> <viewcell> <stacklayout orientation="horizontal"> <image widthrequest="100" heightrequest="100" source="{binding image}"/> <stacklayout orientation="vertical"> <label text="{binding title}" /> <label text="{binding subtitle}" /> </stacklayout> </stacklayout> </viewcell> </datatemplate> </listview.itemtemplate> </listview> the result : even i...

Date set in tab Layout android -

i getting trouble setting dates in tab, have set days names monday friday , want set date below text . calendar mcal = calendar.getinstance(); int myear = mcal.get(calendar.year); int mmonth = mcal.get(calendar.month); int mday = mcal.get(calendar.day_of_month); tablayout.gettabat(0).settext("monday\n" +mday+"/"+mmonth); tablayout.gettabat(1).settext("tuesday\n"); tablayout.gettabat(2).settext("wednesday\n"); tablayout.gettabat(3).settext("thursday\n"); tablayout.gettabat(4).settext("friday\n"); tablayout.tab tab; int today = mcal.get(calendar.day_of_week); if(today == calendar.monday || today == calendar.saturday || today == calendar.sunday){ tab = tablayout.gettabat(0); tab.select(); }else if(today == calendar.tuesday){ tab = tablayout.gettabat(1); tab.select(); tab.settext("today's"); }els...

.net - Do i need ASP.Net core if I have no plans to host my app anywhere other than IIS -

i going start asp.net project tomorrow. asp.net web api, angular 2 in plans, concerned .net core project life time 3 years. here's view of situation if not have future plans migrate windows platform. i not have experience .net core, think .net framework can offer more .net core point. it's more tested, it's older means more stable , not prone changes younger libraries. example for, entity framework core still missing features offered in standard entity framework. i'm not saying not change, trying describe current situation. for more detailed help, guess should post more information project.

Mule: How to print the file name in logger? -

i want print mule configuration file name, in logger in flow, how can it? suppose configuration file name in test.xml, inside flow having logger, prints test.xml , how can this? <flow name="filenameflow"> <http:listener config-ref="http_listener_configuration" path="/hello" doc:name="http"/> <logger message="#[app.name.tostring()]" level="info" doc:name="logger"/> </flow> [name.flow] not correct one. you should go #[flow.name] correct form. don't mislead answers. thanks,

php - Global Variables with jQuery -

just got footable responsive table plugin work. trying setup php script pull postgresql , return json encoded array. everything working fine far. close making jquery script work, i'm not sure why variables not passing along. here script: var columns_json; var rows_json; jquery(function($){ $.ajax( { type: "post", datatype:"json", url: "a.php", data: {action: 'test'}, success: function(data) { columns_json = data[0]; rows_json = data[1]; console.log(columns_json); console.log(rows_json); }, failure: function(data) { alert("something went wrong"); } }); $('.table').footable( { "paging": {"enabled": true}, "filtering": {"enabled": true}, "sorting": {"enabled": true}, "columns"...

linux - How executable binaries works after unmounting root file system in single user mode? -

my root filesystem got corrupted , fix went in single user mode , ran fsck on unmounted root filesystem.my question how /sbin/fsck command works after unmounting root file system , located? os: redhat linux in linux source, if ask umount root file system, doesn't happen - source makes clear comment , tricksy code: if (mnt == current->fs->root.mnt && !(flags & mnt_detach)) { /* * special case "unmounting" root ... * try remount readonly. */ down_write(&sb->s_umount); if (!(sb->s_flags & ms_rdonly)) retval = do_remount_sb(sb, ms_rdonly, null, 0); up_write(&sb->s_umount); return retval; } this why binaries on root file system still present; they've not gone away.

scala - Is there any way to use Inject directly from model or other class without controller? -

i start using playframework 2.5 scala. the example usage of inject found controller.like: class sampcontroller @inject()(service:service) extends controller{ def index = action{implict request => .. sample.exec(service) .. } } class sample{ def exec(service:service) = { ... } } but, i'd injected object directly "sample". there way? class sampcontroller extends controller{ def index = action{implict request => ... sample.exec() ... } } class sample{ def exec = { val service:service = #any way injected object here? ... } } thank you. you can use guice dependency injection on sample , inject service it, inject sample controller. @singleton class sampcontroller @inject() (sample: sample) extends controller { def index = action { implict request => ... sample.exec() ... } } @singleton class sample @inject() (service: service) { def exec = { service.dosomething()...

automatic ref counting - WatchKit without ARC causes crash when dealloc -

the watch app developing not using arc. , releases properties of objects in each interface in dealloc below. -(void)dealloc { [obj1 release]; [obj2 release]; ... [super dealloc]; } this causes crash when close interface (for example go main interface). why so? retains , releases need balanced in context of class. didn't retain when assigned 1 of instance variables, , it's over-release. can try enabling zombies catch message deallocated instance if that's case.

Implementing php validation form into front-page.php wordpress -

i got form here trying validate on front page php file wordpress site, whenever click submit takes me post "page not found", why leaving page? not sure wrong code, thinking submit button must not right, shouldn't leave page. maybe i'm not implementing php code right way. html form @ beginning , php code @ end. <form id="contact-form" method="post"> <ul> <li class="desc">email</li> <li><input placeholder="i.e.email@email.com" type="" name="email" id="form_email"> <span><?php echo $email_error ?></span></li> <li class="desc">first name</li> <li><input type="text" name="firstname" id="form_firstname" ><span><...

ios - Avoid adding subview on cellforrowatindexpath -

func tableview(tableview: uitableview, cellforrowatindexpath indexpath: nsindexpath) -> uitableviewcell { let cellframe = cgrectmake(0, 0, tableview.frame.width, 100) var retcell = uitableviewcell(frame: cellframe) var textview = uitextview(frame: cgrectmake(8,30,tableview.frame.width-8-8,65)) textview.layer.bordercolor = uicolor.bluecolor().cgcolor textview.layer.borderwidth = 1 retcell.addsubview(textview) if(reqgrpindex == 0){ reqgrpindex = reqgrpindex + 1 } } why shouldn't add subview on function?? how can change code practice doing same purpose? you using function in wrong way.this function used initiate tableview cell , load data initiated table view cell.and it's practice reusable cells , load related information cell. way question has accepted answer , answer understand tableview concept well.and there nice tutorial explain tableview ...

html - resizing the image within the table in mobile query doesn't work -

i have image inside table's <td> want resize if screen size in mobile size. added viewport. mobile query works fine in other's purpose except img. here html: <table class="table borderless"> <tr> <td align="center" width="10%"> <img width="55%" class="img" src="images/save energy.png"></td> <td><h4>save on energy costs</h4> <p class="pindent">test test test test test test test test test</p> </td> </tr> <tr> <td align="center" width="10%"> <img width="55%" class="img" src="images/save environment.png"></td> <td><h4>save environment</h4> <p class="pindent">test test test test test test</p> </td> </tr> </table> h...

c# - Parameter is not valid while try to save image -

i have method in fileutility class save images. public static void saveimage(system.io.stream file, string savepath, size size, bool enforceratio, bool testreverse = false) { var image = image.fromstream(file); var imageencoders = imagecodecinfo.getimageencoders(); int enc = path.getextension(savepath).tolower().contains("png") ? 4 : 1; encoderparameters encoderparameters = new encoderparameters(1); encoderparameters.param[0] = new encoderparameter(system.drawing.imaging.encoder.quality, 90l); size s = new size(size.width, size.height); if (testreverse) { if (image.width <= image.height) { if (size.width <= size.height) { s.width = size.width; s.height = size.height; } else { s.width = size.height; s.height = size....

web parts - Find The correct process Id in visual studio for debugging sharepoint? -

when want attache process id w3wp.exe solution in visual studio , debug web part in sharepoint have more 1 w3wp.exe process . how can find correct process id of sitecollection , attach solution that. open command prompt , run following command "appcmd list wps" it wil gives app pool id. (appcmd.exe can found in %windir%\system32\inetsrv)

Vbscript saving pdf from Internet Explorer -

i wrote script open excel file contains hyperlinks. vbscript opens hyperlink internet explorer, , save page pdf pdf creator default printer.it in loop. issue script fails each , every time in different step. not know how rewrite script make stable one. dim wshshell dim lastrow dim objfso '#### cleanup left-over excel processes ####' dim objprocess, colprocess, strcomputer, objwmiservice dim strprocesskill strcomputer = "." strprocesskill = "'excel.exe'" set objwmiservice = getobject("winmgmts:" _ & "{impersonationlevel=impersonate}!\\" _ & strcomputer & "\root\cimv2") set colprocess = objwmiservice.execquery _ ("select * win32_process name = " & strprocesskill ) each objprocess in colprocess objprocess.terminate() next '#### end of cleanup left-over excel processes ####' 'open excel file , start macro code dim ws_path ws_path= replace(wscript.scriptfullname, wscript.s...

magento - How to filter orders collection by customer phone? -

how can filter orders collection customer phone number? here try: $orders = mage::getmodel('sales/order')->getcollection() ->addattributetofilter('customer_phone', array('like' => '%' . $_post['filter_client_phone'] . '%'))->load(); also how can filter orders collection attribute shipping information of order? you may filter orders collection using below query $addresstable=mage::getsingleton("core/resource")->gettablename("sales/order_address"); $orders = mage::getmodel('sales/order')->getcollection(); $select=$orders->getselect()->joinleft(array('oa'=>$addresstable),'oa.parent_id=main_table.entity_id') ->where('oa.address_type=?','shipping') ->where('oa.telephone ?','%' . $_post['filter_client_phone'] . '%');

php number compare Array -

i have student examiner language level example: (8,8,9,8,7) repeat number "8" "8" (7,7,8,9,10) repeat number "7" "7" (7,8,9,10,9) no repeat number last "9" (7,7,8,8,9) forget "7" > last repeat number "8" (7,7,8,9,9) forget "7" >get last repeat number "9" code here //get duplicate function getarraydups($array) { $counts = array_count_values($array); return array_filter( $counts, create_function( '$val', 'return($val > 1);' ) ); } // usage test: $test = array('8','8','7','7','7'); $result = getarraydups($test); if(count($result)) { echo "<p>you had 1 or more duplicate entries:</p>\n<ul>\n"; foreach($result $entry => $count) { if ($count >= 3){ echo "<li> level $e...

How do mobile phone companies detect if you are sharing your 3G/4G internet connection? -

i spoke phone company in denmark, offer "free 3g/4g", on phone, have limitation if create hotspot , share connection, limitation on 50gb. how detect if mobile device sharing connection? intercept special headers computer/other phones send on connection? mac addresses used @ lower layer ip , relate each hop or leg of end end communication don't issue. detecting tethered devices quite complicated task , there special solutions this. tend @ multiple things try determine if other devices using mobiles connection, if devices spoofing or manipulating headers etc. examples of things solution at: number of simultaneous sessions http user-agent headers device type device screen size tcp timestamp tcp source port tcp sequence number application-based correlation tcp flows node-pair correlation tcp flows see here example solution , more details of above (this 1 example solution): https://www.sandvine.com/downloads/general/sandvine-technology-showc...

identityserver3 - IdentityServer handling timeouts and subsequent redirects -

i've implemented identityserver3 in application , has been working good. came across behaviour can't quite figure out hoping tell me i'm either doing wrong or how should doing following: i have asp.net mvc application uses identityserver authentication. user authenticates , opens specific page within application. moves away pc, comes little later , clicks link within application (e.g. controller/action/38). application redirects user to: http://localhost/myidentityserver/identity/connect/authorize?client_id=myapp&redirect_uri=http://localhost/myapp/controller/action/38&response_mode=form_post&response_type=id_token&scope=openid+profile+roles etc. since root url of app ( http://localhost/myapp ) registered redirecturl in identityserver shows following message: the client application not known or not authorized. rightfully so, since controller + action aren't valid redirecturls. however, cannot image i'd have add controllers , actions red...

node.js - Unexpected Identifier in Node js beginner program -

this simple code in main.js /* hello, world! program in node.js */ console.log("hello, world!") when execute $ node main.js error unexpected identifier ? you trying execute program within node repl itself, wrong. have execute node program name terminal/command prompt/shell not within node itself. starting node alone run repl, can execute javascript commands directly. can type console.log("hello, world"); inside repl.

c++ - Should return 0; be avoided in main()? -

i know current c++ standard special cases main falling off end has same effect return 0; rather undefined behavior. i surprised see an example @ codereview responses not pointed out including final return 0; optional, went far remove original code. thus prompts question — considered bad style make return 0; explicit @ end of main? rationale or against? i'll take wild stab in dark here , people fall 2 camps: those remove line think redundant , such code should removed brevity those add line think makes return value clear , unambiguous lesser coders. personally, tend write meaningful return statement in main in production code (if because production main s tend contain code paths end returning other 0 , in exception handlers), although wouldn't bother trivial main never returns else; example, don't think i've ever done in, say, coliru post stack overflow demonstration. some it's absurd alter codebase flip between these 2 states, ...

windows - When installing a .msi using powershell - is there a way of pasting in the authentication code for the software within the script? -

the key same. have saved in text document in same folder msi. a pseudo outline be: start-process -filepath "h:\software\software_x64.msi" "authenticationcode" key.txt paste "authenticationcode" softwarewindow nextnextnext finish cheers assistance i didn't tried buti think 1 way use msiexec.exe , pass serial argument. $mycode = get-content key.txt msiexec /i "yourmsi.msi" "serialnumber=$mycode" i found link also have @ m$ greets eldo.ob

javascript - Setting object property with bracket notation inside object literal -

so have lengthy object literal many properties , methods, in simple following form no explicit instantiation: var my_object = { prop1:"a", method1:function() {console.log("foo");} }; one of these object methods receives data internet in form xml http request , runs following bit of code: $.each(xmlobj,function(k,v) { this["to_"+k] = v; this["to_"+k+"_color"] = func1(v); this["to_"+k+"_symbols"] = func2(v); }); i've checked , returned data exists , in format expect, problem i'm having bracket notation not work here assign new properties this (my_object). console.log(my_object) confirms these new properties not assigned. so there way work around bracket notation's failure assign new properties here, or going stuck writing out dozens of dot notation assignments?

icon right with preference-headers Android -

i used wizard android créate settings activity app. have added custom layout, nothing unusual, background , border. <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:background="@mipmap/fondo_01"> <listview android:id="@android:id/list" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/corners_main_layout" android:layout_marginleft="16dp" android:layout_marginright="16dp" android:layout_margintop="16dp" android:paddingleft="16dp" /> </relativelayout> in method onbuildheaders add setcontentview, ok...: @override @targetapi(build.version_codes.honeycomb) public void onbuildheaders(list<header> target) { lo...

vb.net - Reference to control of TableLayoutPanel inside split container -

how can reference datagridview control inside tablelayoutpanel inside splitcontainer panel1 of form ? need hide datagrid in code form. so, design : form -->split container--> tablelayoutpanel --> datagridview any appreciated! if adding datagridview designer can call formreference.datagridviewname . you have make sure generatemember attribute in designer set true , default value , modifier ist set allows public access.

iphone - How to Implement an Attended Transfer with pjsip 2.3 in ios -

in voip application need implement call transfer functionality. it's working pjsua_call_xfer(*call_id, &pj_uri, null) , blind transfer. but according requirement need implement attended transfer pjsua_call_xfer_replaces(call, dst_call, pjsua_xfer_no_require_replaces, null) . attended call transfer: during call, press “transfer” button (the active call placed on hold). after speaking second party, press “transfer” button again complete transfer. transfer may canceled during establishment pressing cancel soft key. original call resumed. place call number want transfer call. for i'm doing below, during call i'm holding current call , dialing new party, after successful connecting new party i'm refering below. pjsua_call_xfer_replaces(<first call id>, <second call id>, pjsua_xfer_no_require_replaces, null) is correct way!!! or missing thing??? what procedure achieve attended transfer in pjsip 2.3 in ios. can 1 help!!! in advance. ...

java - Apache Ignite mongo configuration using spring -

i introducing apache ignite in our application cache system computation. have configured spring application using following configuration class. @configuration @enablecaching public class igniteconfig { @value("${ignite.config.path}") private string ignitepath; @bean(name="cachemanager") public springcachemanager cachemanager(){ springcachemanager springcachemanager = new springcachemanager(); springcachemanager.setconfigurationpath(ignitepath); return springcachemanager; } } using like @override @cacheable("cache1") public list<channel> getallchannels(){ list<channel> list = new arraylist<channel>(); channel c1 = new channel("1",1); channel c2 = new channel("2",2); channel c3 = new channel("3",3); channel c4 = new channel("4",4); list.add(c1); list.add(c2); list.add(c3); list.add(c4); return list; } n...

date - dealing with the Lables using the function of scale_x_datetime in ggolot2 in R -

Image
i have problems looks simple, not figure out, when used function of scale_x_datetime. please the graphs below: what want in graph: 1) x label time (for example: 00:00:00) 2) first value of x label should 00:00:00 for first point, used scale_x_datetime(date_labels = "%x") time date_time. got graph below: the line looks correct first graph, responding x-axis value wrong. for second point want get, tried use function limits in scale_x_datetime , not work @ someone has tips it? thanks lot note: to generate data table: dd <- data.table(date = c("2015-07-01 00:15:00", "2015-07-01 00:30:00", "2015-07-01 00:45:00","2015-07-01 01:00:00", "2015-07-01 01:15:00","2015-07-01 01:30:00","2015-07-01 01:45:00","2015-07-01 02:00:00","2015-07-01 02:15:00", "2015-07-01 02:30:00"),value = c(1.83,1.68,1.29,14.23,0.96, 1.29,10.4,8.25,6.77,7.66)) dd$date<-as.posixct...

Web based Business Rules for non technical users -

for 1 of requirement looking product or service provide web based rules creation , hosted on ibm cloud. tried business rules , odm, both has rule creation in eclipse. do have product or service can provide business analyst web based ui,so can create , update rules , when require without technical knowledge. check out codeeffects rules engine. has best web-based rules editor , can host evaluation engine anywhere

graph algorithm - Minimum number of changes that we need to make so that there will be only one island in matrix -

a matrix containing 0s , 1s provided, 0s water , 1s land. group of connected 1s forms island. if 1 change can convert 1 0 1 find out minimum number of changes need make there 1 island in matrix. for example: matrix-> 1 0 1 0 0 0 1 0 1 minimum number of changes convert single island 1. convert (2,2) 1. i asked question in interview. used dfs find out number of islands. can't approach solve further.

node.js - AWS Lambda function - convert PDF to Image -

i developing application user can upload drawings in pdf format. uploaded files stored on s3. after uploading, files has converted images. purpose have created lambda function downloads file s3 /tmp folder in lambda execution environment , call ‘convert’ command imagemagick. convert sourcefile.pdf targetfile.png lambda runtime environment nodejs 4.3. memory set 128mb, timeout 30 sec. now problem files converted while others failing following error: { [error: command failed: /bin/sh -c convert /tmp/sourcefile.pdf /tmp/targetfile.png convert: %s' (%d) "gs" -q -dquiet -dsafer -dbatch -dnopause -dnoprompt -dmaxbitmap=500000000 -daligntopixels=0 -dgridfittt=2 "-sdevice=pngalpha" -dtextalphabits=4 -dgraphicsalphabits=4 "-r72x72" "-soutputfile=/tmp/magick-qrh6nvlv--0000001" "-f/tmp/magick-b610l5uo" "-f/tmp/magick-tie1mjer" @ error/utility.c/systemcommand/1890. convert: postscript delegate failed /tmp/source...

javascript - Script works on xampp but not on host server -

the script supposed display posts , images user. works on xampp on host server see posts not images user has posted. blank. on network tab cannot seen either. here script part: var post = function(url){ $('#apost').show(); $('#apost').html('<i class="fa fa-circle-o-notch fa-spin afo"></i>'); $.ajax({ type: 'get', url: url, success: function(data){ var template = $("#itemtemplate").html(); var result101 = mustache.render(template, jquery.parsejson(data)); $(".post-content").html(result101); $('#apost').hide(); }, complete: function(){ setinterval(post('ajax/post?page='+pagenum), 30000); }, error:function(){ $('.don').html('error loading post'); } }); }; here html part: <div class="media-content"> <div>{{post}}</div> {{...

algorithm - What is the fastest way to get k smallest (or largest) elements of array in Java? -

i have array of elements (in example, these integers), compared using custom comparator. in example, simulate comparator defining i smaller j if , if scores[i] <= scores[j] . i have 2 approaches: using heap of current k candidates using array of current k candidates i update upper 2 structures in following way: heap: methods priorityqueue.poll , priorityqueue.offer , array: index top of worst among top k candidates in array of candidates stored. if newly seen example better element @ index top , latter replaced former , top updated iterating through k elements of array. however, when have tested, of approaches faster, found out second. questions are: is use of priorityqueue suboptimal? what fastest way compute k smallest elements? i interested in case, when number of examples can large, number of neighbours relatively small (between 10 , 20). here code: public static void main(string[] args) { long kopica, navadno, sortiranje; i...