Posts

Showing posts from May, 2013

arrays - C++ 2d Vector subscript out of range error -

currently in function, have method declares 2d vector. vector <vector<test> > path(int x, int y) //path function { vector <vector<test>> mazearray(column, vector<test>(row)); //declaring object (int = 0; < column; a++) { (int b = 0; b < row; b++) { mazearray[b][a].setx(b); mazearray[b][a].sety(a); } } } for example, when tried run function, path(10,10). the double loop works without error, if change path example, path(11,10) or path (11,13) or numbers not same both (int x , y), error vector subscript out of range present. why so? can me on this? there way fix such value type acceptable? thanks. the loop in function vector <vector<test> > path(int x, int y) //path function { vector <vector<test>> mazearray(column, vector<test>(row)); //declaring object (int = 0; < column; a++) { (int b = 0; b < row; b++) { ...

css - Bootstrap's "dropdown open" background color -

i'm trying change background color of li element when it's class changes "dropdown" "dropdown open" on click. i've managed change color of text (which a ). can't change parent li properties. i've copied code here: http://www.bootply.com/fk88owgjgl . @ end of css file you'll see i've managed code concerning background color of li , of it's child. can't understand why font color works , background doesn't. any appreciated. thanks time i think problem related floating elements inside form, adding clear fix help. .navbar-right .dropdown-menu form:after { content: ""; display: table; clear: both; } and there bit background @ bottom due parent margin, can rest. .navbar-right { margin-bottom: 0; } use below, if need change background of search item itself(with magnifying glass) when active. li.dropdown.open > a:focus { color: #000; background: red; } demo: http://...

PYTHON: Error in recognising numpy module -

i using python 3.4.0 . going assume numpy module should work, 1 of newer versions of python. however, numpy result in syntax error. forexample code here: import numpy list1=[1,3,2,6,9] list2=numpy.mean(list1) print(list2) and get: traceback (most recent call last): file "/home/yichen/desktop/python/numpy test.py", line 1, in <module> import numpy importerror: no module named 'numpy' is problem computer or what? it looks numpy not installed on system. assuming have pip script installed python, can perform following command install it: pip install numpy or pip3.4 install numpy or, depending on distribution, might come package named python-numpy package manager.

laravel - Optimize image loading iteration in php -

i have laravel application in user presented list of episodes, each screenshot. each screenshot loaded inside foreach loop in view per pseudo code: foreach $episodes $episode $episode->getscreenshot($episodeid); endforeach the getscreenshot() method resolves specific screenshotlocator class out of ioc container so: $screenshotlocator = app::make('\animekyun\images\screenshots\screenshotlocator'); (i'm reading things binding container singleton. consider? it's not bound @ all) the screenshotlocator class designed build path actual screenshots folder (source below) using episode model. screenshots (there multiple per episode) stored in folder structure , necessary files loaded , stored in collection . the loading of screenshots takes 40 ms out of 135 ms entire page load on digital ocean droplet. (10x run benchmark) so question ways optimize this? source screenshotlocator class: http://laravel.io/bin/6l19r

Python 3.x read text file without ignoring blank line at the end -

i've tried read text file that: line 1 line 3 using following code: with open('textfile.txt', 'r') f_in: line in f_in: print("~ " + line) f_in.closed but loop runs 3 times instead of 4, ignoring blank line. the output is: ~ line 1 ~ ~ line 3 how can fix it? when using file iterator, end of line marked \n . means though editor may show "blank line" after 3 , if there no data there, there no line there. for example, try this: with open('textfile.txt', 'wb') f_out: f_out.write(b'1\n\n3\n4') open('textfile.txt', 'r') f_in: line in f_in: print("~ " + line) by putting character 4 on last line, no terminating linefeed, python recognizes line. without 4 , have 3 lines.

How do I stop SQL Server converting 1900-01-01 to NULL -

there seems lots of posts on how convert 1900-01-01 null , problem opposite. have stored procedures processing smalldatetime (sql server 2008), keep converting 1900-01-01 null , when want remain 1900-01-01 . thoughts? thanks fundamentally, sql server can't differentiate. 1900-01-01 00:00:00.000 epoch (zero point) sql server's calendar. , if in sql server: select 'empty string',convert(datetime,'') it's conversion algorithm doesn't throw error, converts empty string sql server date/time value ... (you guessed it!) ... '1900-01-01 00.00.00.000'. what happens null values dependent on current setting of sql server set option set concat_null_yields_null . if off , null values treated identically empty strings. as far stored procedure problem goes (stored procedure turning date/time value of 1900-01-01 null ...that's problem stored procedures. sql server won't automatically convert non-null date/time value of 19...

python - Passing a bounded method in Cython as argument -

i trying wrap c++ code cython , came trouble trying pass method class argument function. i not know if makes more clear, class represents statistical model (so myamethod uses not arguments passed many instance variables) , b has different methods minimizing function passed. in c++ have of style: class { public: double myamethod(double*) }; class b { public: double mybmethod(a&, double (a::*f) (double*) } so trying use instances of both , b in cython code. had no trouble wrapping classes, when try use mybmethod, don't know how pass pointer of kind a::*myamethod if this: mybmethod(ptrtoaobj[0], &ptrtoaobj.myamethod) , cython compiles code [...] &ptrtoaobj->myamethod [...] , , message 1 expect g++: "iso c++ forbids taking address of bound member function form pointer member function." but if try point straight class method, , mybmethod(ptrtoaobj[0], a.myamethod) , cython won't compile , myamethod not static member a. a...

class - C++ warning [-Wunused-value] -

i have problem c++ code, there no errors warning preventing code work should. multiply screen size percentage , print it. this in .h file: smartwatch* multiply(smartwatch* second, double percentage); and in .cpp file: smartwatch* smartwatch::multiply(smartwatch* second, double percentage){ second->getscreen_size() * percentage; return second; } and in main: smartwatch *multiplied = &watch[0]; multiplied = multiplied ->multiply(&watch[1], 0.23); multiplied->print(); i warning: smartwatch.cpp:69:31: warning: expression result unused [-wunused-value] second->getscreen_size() * percentage; i new @ this, don't know doing wrong. you don't store value of multiplication in multiply method anywhere. compiler warning because line of code second->getscreen_size() * percentage; doesn't store result or change value. result of multiplication discarded. to fix warning, should store result smartwatch* second pointer somewhe...

Set custom referer -

just purpose of study, see sites offer services allow user change referrer custom links. services spoofr , hitleap example allow user define particular access such twiiter.com domain, facebook.com, pinterest or custom domain. again say, curiosity came me , not other purposes. question follows: how sites change referer make fake referer? i not need scripts or other information, want know how in textual form. how sites change referer make fake referer? by acting proxy. when request sent through website/service, service constructs new http request (with http request headers, include "fake" referer - sent browser) sent target website. response received , sent client. you can using program curl send http request. there no doubt browser extensions allow this. either suppress http referer altogether or set of choice.

sql server - SQL save data into XML column with grouping and nesting -

i having issue regarding saving data table below in xml id personid type name category value 1 1234 xtype john abc 200 2 1234 ytype john xyz 230 3 1234 ztype john ccc 220 4 2222 xtype jim abc 200 i need save above data in xml condition. data of personid 1234 having 3 rows of data 3 different types(x,yz) these 3 rows of data should saved in 1 xml datatype, > column different personid 2222 should store in next row, has 1 type(x) have once. required xml example <data> <personid>1234</personid> <specifiedtype> <type>xtype</type> <name>john</name> <category>abc</category> <value>200</value> </specifiedtype> <specifiedtype> <type>ytype</type> <name>john</name> <category>xyz</category> <value>230</value> </specifiedtype> <specifiedtype> <type>...

VxWorks issue Can't load boot file -

i have industrial robot arm has vxworks running in controller. new vxworks. when tried use ftp, there password issue. after going through vxworks boot procedure, can no longer system boot. following screen through hyperterminal. vxworks system boot copyright 1984-2002 wind river systems, inc. cpu: pc pentium version: vxworks5.5.1 bsp version: 1.2/2 creation date: nov 3 2006, 09:55:58 press 's' stop auto-boot... auto-booting... boot device : ata unit number : 0 processor number : 0 host name : nitt file name : /ata0/vxworks inet on ethernet (e) : 192.168.0.253:1947 host inet (h) : 192.168.0.255 user (u) : me ftp password (pw) : pw flags (f) : 0x00 other (o) : fei attaching usb disk device... usblink, usb stack driver, ver 2.02 (build 31/01/2006), staubli rev 1.10 copyright softconnex llc, 1999. rights reserved... uhci usb controller initialized ... ca...

c - Questions about Visual Studio project files -

what minimal set of files after creating project in visual studio (2010) have send uses different compiler ? (for example debug folder isn't necessary, .vcxproj.user file or other ?) .obj files? kind of information displayed in "watch" , "call stack" windows during debugging ? the files absolutely need send source files , project file. source files *.c or *.h files, include others, resources. as far other files go, each of them different. full list, of vs2013, found here . of them generated compiling , linking, or opening project in ide. quick way tell them apart clean solution, should delete , intermediate files. the obj files intermediate files use during linking, , don't need packaged. in fact, nothing in build or output folders needs included, they'll rebuilt. information that's used @ debugging pulled obj , pdb files, both created each time build.

java - HttpURLConnection to download file from Servlet not working, direct link works -

have list of 8,000+ http links pdf files download. reading in each link , calling method downloadfile() , saving local window$ pc. coming across 2 link formats: http://example.com/docs/pdfs/downloadable.pdf http://example.com/docs/download.do?attchmentid=2000 the first type (direct) works. second 1 not work. when saves file pdf, looks like: <div id="error"> <ul> </ul> </div> <form id="download" name="download" method="post" action="/caremanager/downloadformcontroller.do?attachmentid=2000"> <input type="hidden" name="attachid" value="2000" > </form> <script language="javascript" type="text/javascript"> document.forms[0].submit(); </script> </body> </div> when follow non-working links in browser's developer tools, getting redirected https site (changing protocol https) javascript files. wha...

Creating Prestashop back-office module with settings page -

i'm creating back-office module prestashop , have figured out except best way display admin page. i'm using renderview() method display content of view.tpl. i display table values , option add new row. should create in view.tpl or there better way? i've seen renderform() method haven't figured out how works yet. the biggest question have is, how submit content controller specific method? moduleadmincontroller meant managing kind of records, objectmodel s. defauly page controller list, can edit each record individually or view it's full data ( view ). if want have settings page, best way create getcontent() function module. besides helperoptions better helperform module configuration page because automatically laods values. define form in function , above add 1 if (tools::issubmit('submit'.$this->name)) - submit button name , save values configuration table. configuration::set(...) . of course possible create sort of settings ...

javascript - Preload tag IMG without specifying the name of the images -

i need script loads images of web page, , displays it. script preload tag , make web page visible. i have alrady tried script jpreloader or jquery plugin, want write in array name of image.jpg , preload img tags without specifying name of images! in css body {display: none;} in script tag $(window).load(function(){ $(body).show(); });

css - Calculating the number of weeks in a month for a calendar in Rails -

i have calendar shows public events month. responsive layout, need able calculate week_row height. therefore, need able calculate number of weeks in month, including partial weeks (weeks contain days current month , previous/next month). the following method calculates number of weeks in month: def weeks_in_month(date) @week_count = (0.5 + (date.end_of_month.day + date.beginning_of_month.wday).to_f / 7.0).round end and code add appropriate class(es) <div> is: def week_rows weeks.map {|week| content_tag :div, class: week_classes(week) week.map { |day| day_cell(day) }.join.html_safe end }.join.html_safe end def week_classes(date) classes = ['week'] classes << "wk_rows_4" if weeks_in_month(date) == 4 classes << "wk_rows_5" if weeks_in_month(date) == 5 classes << "wk_rows_6" if weeks_in_month(date) == 6 classes.empty? ? nil : classes.join(" ") end however, have misse...

ios - OSStatus error 2003334207 when using AVAudioPlayer -

i trying play mp3 file (works when played via vlc/itunes) when button pressed. here code: var audioplayer: avaudioplayer! @ibaction func playepisode(sender: anyobject) { println("now playing") let indexpath = nsindexpath(forrow: sender.tag, insection: 0) let data: cdepisode = fetchedresultscontroller.objectatindexpath(indexpath!) as! cdepisode var err: nserror? let url = nsurl(string: data.localpath) println("the url \(url)") audioplayer = avaudioplayer(contentsofurl: url, error: &err) if audioplayer == nil { if let e = err { println(e.localizeddescription) } } audioplayer.delegate = self audioplayer.preparetoplay() audioplayer.play() } here log: now playing url optional(file:///var/mobile/containers/data/application/4747a71e-a63f-4efc-b2df-8b361361080b/documents/serial-s01-e12.mp3) operation couldn’t completed. (osstatus error 2003334207.) fatal error: unexpectedly ...

ios - Can't select view controller or cells on iPad simulator -

i'll try keep short , sweet. have universal storyboard , application runs on iphone. i'm having issue though have view controller 2 containers, contain separate tableviewcontrollers. on ipad simulator top table view controller works fine yet bottom not scroll or select cells. again, works on iphone simulator. i cannot life of figure out whats causing this. run similar? thanks your view might covered view. make sure view stays in front, can use [self.view bringsubviewtofront:yourview];

javascript - Not getting forward for the page in Firefox -

i developing simple log in form using xml file values. have xml values last name , first name . accessing file , checking values against given values in order validate log in. works fine in chrome, ie , safari. but, in mozilla not getting forwarded next page. page stays in same page , shows loading url icon indefinite time. here code: <!doctype html> <html> <head> <script src="https://code.jquery.com/jquery-1.10.2.js"></script> <link href="css/stylemp3.css" rel="stylesheet" type="text/css" /> </head> <body> <form onsubmit="return myfunction()" action="action.html"> first name:<br/> <input type="text" required="required" name="firstname" id="firstname"/> <br> last name:<br> <input type="password" required="required" name="las...

mysql - How to update a database that has foreign keys constraints? -

i have 1 virtual machine (vm_a) runs 1 mysql database db_a schema 200 rows in tbl_1. in virtual machine (vm_b) runs copy of same db_a schema have 50 rows in tbl_1. i update db_b data db_a. the tbl_2 holds foreign key tbl_1. i've made mysql dump db_a run in db_b, updated. i not want use drop schema, before drop tbl_1. if try run code in db_b have error caused foreign key constarint in tbl_2. what best approach update db_b in scenario? have tested solution not worked https://dba.stackexchange.com/questions/40046/is-there-a-way-to-truncate-table-that-has-foreign-a-key https://dba.stackexchange.com/questions/40046/is-there-a-way-to-truncate-table-that-has-foreign-a-key ms sql-server. in mysql modify session variables set foreign_key_checks=0;

ios - Table view populated from NSMutableArray not showing anything -

i trying populate tableview objects received json request. this viewdidload method: - (void)viewdidload { [super viewdidload]; nslog (@"he entrado en historial vc"); myobject = [[nsmutablearray alloc] init]; nsurl *apiurl = [nsurl urlwithstring: [nsstring stringwithformat:@"http://.. hidden here.. /?client=%@&date=%@", @"1",@"2015-3-16"]]; nsurlrequest *request = [nsurlrequest requestwithurl:apiurl]; nslog (@"he mandado la request del historial"); [nsurlconnection sendasynchronousrequest:request queue:[nsoperationqueue mainqueue] completionhandler:^(nsurlresponse *response, nsdata *data, nserror *connectionerror) { if(data.length) { nsstring *responsestring = [[nsstring alloc] initwithdata:data encoding:nsutf8stringencoding]; ...

google chrome - jQuery show function does not work on options in select -

i experience following problem jquery , chrome. i have couple selects , function called on change of select. works ok, after traverse next select element , filter options. [select > option]. on options going filtered call jquery.hide() , if value ok call jquery.show() show elements. problem is, when call jquery.show(), see change in page source (developer console) on webpage, select still empty. i tried selected attribute on option, 1 option being added select , showed, one. everything works ok in firefox, using chrome 41.x. thnks not sure code looks like, appears work fine in chrome. https://jsfiddle.net/tdetnn4z/ $("#source").on("change", function(){ sourceval = parseint(this.value); $("#target > option").each(function(){ curr = parseint(this.value); if(curr%sourceval == 0){ $(this).show(); } else{ $(this).hide(); } }) });

android - Error with API Facebook -

i trying add library "facebook" android studio without success ... i saw official guide facebook, , saw videos on youtube, problem comes after me import module , pulls me below error: error:(15, 0) not find property 'android_build_sdk_version' on project ':facebook'. googling bit solve manually typing minimum version of sdk , else remain : android { compilesdkversion 19 buildtoolsversion "20.0.0" defaultconfig { minsdkversion 8 targetsdkversion 19 } now error pulling me below : error:(111, 0) cannot call getbootclasspath() before settargetinfo() called. and until there comes ... what matter? 's i'm doing wrong? i appreciate before hand . greetings , ! i'm pretty sure problem here using 1.1.0 gradle plugin version. that: dependencies { classpath 'com.android.tools.build:gradle:1.1.0' } as can read here: https://code.google.com/p/android/issues/detail?id=15281...

xml - Adding user to blackboard using ColdFusion -

i'm able create authentication session i'm receiving following [wsfw000]null error when attempting add user. this package i'm sending: <cfsavecontent variable="soappackage"> <?xml version='1.0' encoding='utf-8'?> <soapenv:envelope xmlns:soap-enc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope" xmlns:xsd="http://www.w3.org/2001/xmlschema" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance"> <soapenv:header> <wsse:security soapenv:mustunderstand="true" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"> <wsse:timestamp xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"> <wsse:created xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1....

node.js - Express.JS with my own HTTP listener? -

i have own http listener, serializes request, passes process deserializes, , handles i/o between, preserving node.js http req / res api. is possible me pass recreation of vanilla req , res objects express? , allowing express add handy functions (like res.send ), , take on routing, , add middleware? it looks straight-forward do. not yet tested. var express = require('express') var app = express() http_to_stdio.on('request', app.handle) i have make sure re-creating methods found in http 's implementation of req , res .

io - Reading different variables from text file in Java -

so have text this: 16783 bob arum 30.5 10.00 a lot of these on different lines in text file (long,string,string,double,double) want store these variables inside of array , far have: public class main { public static void main(string[] args){ arraylist<string> arremployee = new arraylist<string>(); // create array employees try { scanner txtin = new scanner(new file("payroll.txt")); } catch (filenotfoundexception e) { } }} the problem i'm having though can't figure out way store these values inside of arremployee array in way use them later. i've figured out far creating different class constructor help, i'm having hard time understanding how access objects in array. for example, if wanted double @ end of line, it's object stored inside array now, how access specific double? creating employee class helpful, lets make employee several instance variables. if store last double 1 of instance v...

objective c - I'm getting a sigabrt error when a certain collision is detected (iOS, SpriteKit) -

i building ios app in objective-c. idea of app have sort of rocket ship navigating through asteroid belt of sorts. played in portrait mode. there 2 different kinds of asteroids. normal ones make lose when crash them, , golden ones shoot @ coins. now, issue occurs when collision detected between bullet , gold asteroid. when collision detected between player , normal asteroid, well, , lose. when collision detected between bullet , gold asteroid, receive sigabrt error. the code code detects collision following: - (void)didbegincontact:(skphysicscontact *)contact { uint32_t collision = (contact.bodya.categorybitmask | contact.bodyb.categorybitmask); if (collision == (playercategory | asteroidcategory)) { [self player:(skspritenode *)self.player didcollidewithasteroid:(skspritenode *)self.asteroid]; } uint32_t collision2 = (contact.bodya.categorybitmask | contact.bodyb.categorybitmask); if (collision2 == (bulletcategory | goldasteroidcategory)) { [self bullet:(skspriten...

optimization - optimizing subarray max/min analysis in python -

i'm working on hackerrank problem (found here ). in problem have take given array , find subarray of length n smallest max-min value. page explains little better do. that being said, i've finished problem , have solution believe works in every case... keep on 'timing out' on select few of test cases provide. i've included code below: def maxmin(array, original, new): minimum = -1 in range(0, original-new-1): subarray = array[i:i+(new)] if minimum == -1: minimum = max(subarray)-min(subarray) else: if (max(subarray)-min(subarray)) < minimum: minimum = max(subarray)-min(subarray) return minimum n = input() k = input() candies = [input() _ in range(0,n)] candies.sort() print maxmin(candies, n, k) as said above, code works fine -- apparently it's not 'fast' enough. i'm still very new python (as quick review of previous questions suggest), i'm not sure how...

mysqli - PHP changing password and it's not working. There is no error with the syntax I believe, but the password won't change -

i'm making php file called changepassword.php , sole purpose of file allow user change password. however, when go through form change password box fields clear , receive echo warning echo "a password box left empty!". not want seem update user's password , have no clue do. new language don't expect much. appreciate constructive input me code php better. <?php session_start(); #error_reporting(e_all); ini_set('display_errors', 1); require_once('connect.php'); require_once "lib.php"; require_once "utils.php"; if(isset($_post['submit']) && $_session['active']===true) { if(!empty($_post['oldpassword'])&& !empty($_post['newpassword'])&& !empty($_post['newpassword1'])) { $oldpassword = mysqli_real_escape_string($link,htmlentities($_post['oldpassword'])); $newpassword = mysqli_real_escape_string($link,htmlentities(...

linux - Regex replace on specific column with SED/AWK -

i have data looks (tab delimited): organ k clustno analysis ln k200 c12 gene ontology ln k200 c116 gene ontology cn k200 c2 gene ontology what want remove c every row on 3rd column , except header row: organ k clustno analysis ln k200 12 gene ontology ln k200 116 gene ontology cn k200 2 gene ontology this won't because affect other columns , header row: sed 's/c//' what's right way it? using awk awk tool this: $ awk -f'\t' -v ofs='\t' 'nr>=2{sub(/^c/, "", $3)} 1' file organ k clustno analysis ln k200 12 gene ontology ln k200 116 gene ontology cn k200 2 gene ontology how works -f'\t' use tab field delimiter on input. -v ofs='\t' use tab field delimiter on output nr>=2 {sub(/^c/, "", $3)} remove initial c field 3 lines after first line. 1 this awk's cr...

javascript - empty params variable in ember -

so i've set router , routes, , works part. when load #/contacts/123 (or whatever) contactindexroute returns empty params object. i'm sure relatively simple, cannot figure out why. can point me in right direction? thanks. callmonitor.router.map(function(){ this.resource('contacts', function(){ this.resource('contact', {path: '/:contact_id'}, function(){ }) }); }); callmonitor.contactsroute = ember.route.extend({ model: function(){ return this.store.find('contact'); }, setupcontroller: function(controller, contacts) { var socket = callmonitor.socket; controller.set('socket', socket); controller.set('contact', contacts); }, rendertemplate: function(){ this._super(this, arguments); this.render('contacts', { into: 'application', outlet: 'contacts', controller: 'contac...

How to do HMAC-SHA1 in swift -

i trying take string , in php: $signature= base64_encode(hash_hmac('sha1', $data, $secretkey, true)); however, in swift ... see lot of posts other people trying things commoncrypto, module doesn't seem install. so 3 questions really: is commoncrypto correct way this? if so, how add framework? if commoncrypto isn't best way this, is? my current code looks this: var authstring:string = "put\ntest=blah\ntest2=blahblahblah" let hmacresult:string = authstring.sha1() ... extension string { func sha1() -> string { //do something... } }

javascript - Link Xml file to HTML -

i have created simple xml file , html file display xml file details not working..its in same folder all... here xml file : student.xml <?xml version="1.0" encoding="utf-8"?> <student> <name>student</name> <gender>boy</gender> <city>mumbai</city> <phonenumbers>42607700, 42607701</phonenumbers> <email>student@aurus.com</email> </student> html file : studentdetails.html <!doctype html> <html> <head> <script src="loadxmldoc.js"></script> </head> <body> <script> xmldoc=loadxmldoc("student.xml"); x=xmldoc.getelementsbytagname("student"); (i=0;i<x.length;i++) { document.write(x[i].childnodes[0].nodevalue); document.write("<br>"); } </script> </body> </html> and javascript file : loadxmldoc.js function loadxmldoc(student) { if (window...

python - Unable to automate crontab -

i have django project utilizes function notify_about_changes send email users history of objects last week in table format. works fine when happens manually through $python manage.py shell to automate job looked django-kronos , configuring crontab below:- $sudo crontab -e *1 * * * * pathto/venv/python3.4 pathto/manage.py notify_about_changes $sudo cron restart problem:- crontab doesnot work raising issues reponse failed ipaddress. it might typo crontab looks has errant initial asterisk. should be: 1 * * * * pathto/venv/python3.4 pathto/manage.py notify_about_changes that run script @ 1 minute past every hour, not want weekly task. instead might want try: 0 0 * * 0 pathto/venv/python3.4 pathto/manage.py notify_about_changes which run job every sunday @ midnight.

validation - rails how to validatie data params in method dose not updated, created -

i want validate 1 params in model method, can't found fit answers , please show me right way. class user < activerecord::base validate :username, presence: true, length: 4..5, unique: true validate :email, presence: true, unique: true, format: {with: /\a[a-z0-9\.]+@([a-z]{1,10}\.){1,2}[a-z]{2,4}\z/} def self.get_post(id) # how call validate id ??? validates :id, numericality: true if id.valid? # true code else # false code end end def change_profile # how check validate user , email username.valid? email.valid? # some_code.... end end thanks all. you cannot use validates there, can instead def self.get_post(id) if id.is_a? numeric # true code else # false code end end

ios - How to add cell to tableview's reuse queue before 'cellForRow:'? -

creating cell costs lot of time , make first scroll lagging, want create cell , add tableview's reuse queue before cellforrow: called. i use dequeuereusablecellwithidentifier: in viewdidload, when scroll table, cell being created again. in general drawing methods of scrollview should kept simple possible avoid lag. means should prepare data/model in viewdidload/viewwillappear or in previous viewcontroller. cellforrow should simple set image(s) , text(s) - no checks, no expensive operations such bluring, retrieving data coredata/network, etc. if not sure thing causes lag, should learn how use timeprofiler . if feel lost in documentation, have this(quite outdated though) tutorial . with said cannot able anymore until post code discuss.

java - Spring JMS listener receives empty messages causing CPU consumption -

i'm working on application uses couple of jms queues send/receive updates to/from external system. in order test application i'm using mockrunner , jms module. i'm facing strange behavior: when start application can see cpu skyrocketing @ 100% and, analyzing thread dumps, can see main reason related jms listeners have looks receiving empty messages causing messages like: consumer ... did not receive message now i'm trying understand if issue related bad interaction of app , mockrunner or configuration error. the relevant parts of configuration are: <bean id="destinationmanager" factory-bean="mockrunnerjmsobjectfactory" factory-method="getdestinationmanager" /> <bean id="mockjmsconnectionfactory" factory-bean="mockrunnerjmsobjectfactory" factory-method="createmockconnectionfactory" lazy-init="true"/> and listener cause cpu spin indefinitely are: <jms:...

apple watch - What is the difference between a UML node and a UML component? -

i designing uml diagram apple watch extension. how should represent host app using uml ? uml node or uml component ? please note there can inter app communication between extension app , iphone app (host app). uml nodes apparently used depict physical resources, watch node, whereas component understood software component. since want model software, go components (which nicely visualise plugging between extension , host).

UMD support throughout our JavaScript plugins means -

in bootstrap 4, going implement "umd support throughout our javascript plugins." umd stand for? umd stands universal module definition

javascript - $scope variable not update within $rootScope.$on -

Image
this show number 1 , change button. when click button, supposed trigger $state.go , within controller, should detect event in $rootscope.$on , update number 2 . however, reason cannot number ( data.id ) update using $digest or $apply. http://plnkr.co/edit/3qhnim?p=preview html <!doctype html> <html ng-app="myapp"> <head> <script data-require="angular.js@*" data-semver="1.4.0-beta.5" src="https://code.angularjs.org/1.4.0-beta.5/angular.js"></script> <script data-require="ui-router@*" data-semver="0.2.13" src="//rawgit.com/angular-ui/ui-router/0.2.13/release/angular-ui-router.js"></script> <meta charset="utf-8" /> <meta http-equiv="x-ua-compatible" content="ie=edge,chrome=1" /> <title></title> <meta name="description" content="" /> <meta name=...

asp.net - Convert Excel Cell Value From Number To Text Using C# -

i using below process open excel: if (dt != null) { foreach(datacolumn dc in dt.columns) { response.write(dc.columnname + "\t"); //sep = ";"; } response.write(system.environment.newline); foreach(datarow dr in dt.rows) { (int = 0; < dt.columns.count; i++) { response.write(dr[i].tostring() + "\t"); } response.write("\n"); } response.flush(); response.suppresscontent = true; httpcontext.current.applicationinstance.completerequest(); } in datatable have 1 numeric value align right when excel renders default property of excel align numeric values right. per requirement have align numeric value left side in excel. tried adding space back-end excel ignore space when renders. tried adding ' before column value when excel renders column value shows '2015 , '2016 . anybody can me figure out. in advance. you're exp...

c - sending ip packet down the wire throws "Invalid argument" -

i implementing trivial icmp ping in sending ip packet down wire giving me "invalid argument". here's code: /* create ip packet */ int packet_size = ipv4_hdrlen + (int)sizeof(icmpheader) + (int)[payload length]; char *packet = (char *) malloc (packet_size); if (!packet) { perror("out of memory"); return; } //zero out packet buffer memset (packet, 0, packet_size); //ip header struct ip *iphdr = (struct ip *) packet; iphdr->ip_v = 4; iphdr->ip_hl = 5; iphdr->ip_tos = 0; iphdr->ip_len = htons(packet_size); iphdr->ip_id = (ushort) rand(); iphdr->ip_off = 0; iphdr->ip_ttl = 255; iphdr->ip_p = ipproto_icmp; iphdr->ip_sum = in_cksum((uint16_t *)iphdr, ipv4_hdrlen); int status = 0; char *src_ip = (char *) [@"127.0.0.1" utf8string]; char *dst_ip = (char *) [@"2.3.4.5" utf8string]; // source ipv4 address (32 bits) if ((status = inet_pton (af_inet, src_ip, &(iphdr->ip_src))) != 1) { fprintf (std...

hadoop - How to run multiple map-reduce jobs in parallel -

i have four different map-reduce jobs operating on same data set. have hadoop cluster storage , processing of data. question , how can run 4 jobs in parallel without running them sequentially linux shell ? have read workflow-management systems apache oozie . in situation, whether need use oozie or there other easy way ? appreciated . !

unity3d - Move object in Unity 5.0 -

Image
using unity 5.0 . write these codes move prefab: gameobject policecarinstance = instantiate(policecar,enemyspawner.position, quaternion.identity) gameobject; rigidbody2d policecarrigidbody = policecarinstance.getcomponent<rigidbody2d>(); policecarrigidbody.velocity = new vector2 (0f, -10f); when animator component of prefab disabled, prefab moves correctly when it's enabled, prefab doesn't move. animation 5 sprites of different states of police car's lights. here's pic of animator of prefab: this code same properties , states works on unity 4.6 (even when animator component enabled) in unity 5 doesn't work! is there changes in unity 5 influence in rigidbody2d component?