Posts

Showing posts from May, 2014

git - Initial Commit: "fatal: could not create leading directories of ..." -

i trying make initial commit git repository on github unity project. followed along this guide am. note: reason or another, couldn't set unity's asset serialization mode force text, settled on mixed (which believe should work). when call git clone --bare . , error. note not creator of repository , contributor (though making initial commit). here's in terminal (i'm using git bash): welcome git (version 1.8.4-preview20130916) run 'git git' display index. run 'git <command>' display specific commands. cheddar@cheddar-pc ~ $ cd documents/ics168swarch/ cheddar@cheddar-pc ~/documents/ics168swarch $ git init initialized empty git repository in c:/users/cheddar/documents/ics168swarch/.git / cheddar@cheddar-pc ~/documents/ics168swarch (master) $ git add . warning: lf replaced crlf in assets/prefabs.meta. file have original line endings in working directory. warning: lf replaced crlf in assets/prefabs/pellet.prefab.meta. file have original

Can't understand C program output -

Image
i making basic programs , made program #include<stdio.> int main() { printf("%d\n",-1>>4); return 0; } output = -1 i not understand how happens ? is -1 2's complemented first , shift operation done .and again 2's complement done produce result. i want know how output comes int main() { unsigned int a=4; printf("%d\n",-a>>4); return 0; } result = 268435455 for start, you're doing non-portable. iso c11 states, in 6.5.7 bitwise shift operators : the result of e1 >> e2 e1 right-shifted e2 bit positions. if e1 has unsigned type or if e1 has signed type , nonnegative value, value of result integral part of quotient of e1 / 2^e2 . if e1 has signed type , negative value, resulting value implementation-defined. so it's not wise that. what's possibly happening have implementation preserves sign on negative values. whereas >> may shift in 0 bits on left hand side (an

python - attribute error: when trying to write in form xml -

i trying update form view xml. here code: def update_column(self,cr,uid,ids,context=none): id in ids: temp=self.pool.get('deg.form').browse(cr,uid,id) fields={'myname':temp.name,'mytype':temp.data_type} self._columns.update(fields) print (self._columns) result = super(deg_form, self).create(cr,uid,{},context=none) return result def fields_view_get(self, cr, uid, view_id=none, view_type='form', context=none, toolbar=false, submenu=false): res = super(deg_form,self).fields_view_get(cr, uid, view_id, view_type, context, toolbar, submenu) objn = self.pool.get('deg.form').browse(cr, uid, 145) if view_type=='form': str_fields=str(res['fields']) str_fields=str_fields[:len(str_fields)-1]+ ", 'father_name' :{'selectable': true, 'views': {},'type':'char', 'string': &#

struts2 - UrlRewriteFilter skipping i18n Interceptor in Struts 2 -

i managed have struts 2 i18n interceptor working change session locale. it's working if call directly action, example: https://localhost:8443/loadclientlogin.action?request_locale=fr but if use urlrewritefilter map rule, calls action, seems 18n interceptor skipped, since locale not changed. this url rewriter's rule wrote action: <rule> <from>^/client/login(\??)(.*)$</from> <to type="forward">/loadclientlogin.action$1$2</to> </rule> and url use change locale: https://localhost:8443/client/login?request_locale=fr by other side, if change type of rule "redirect" works, browser address show "ugly" forwarded url. it's strange other custom interceptor use manage user session it's called always. update: i put log trace in action write locale session: public string loadclientlogin() { logger.debug("locale: " + actioncontext.getcontext().getlocale()); return acti

csv - CKAN : Upload to datastore failed; Resource too large to download -

Image
when try upload large csv file ckan datastore fails , shows following message error: resource large download: 5158278929 > max (10485760). i changed maximum in megabytes resources upload ckan.max_resource_size = 5120 in /etc/ckan/production.ini what else need change upload large csv ckan. screenshot: that error message comes datapusher, not ckan itself: https://github.com/ckan/datapusher/blob/master/datapusher/jobs.py#l250 . unfortunately looks datapusher's maximum file size hard-coded 10mb: https://github.com/ckan/datapusher/blob/master/datapusher/jobs.py#l28 . pushing larger files datastore not supported. two possible workarounds might be: use datastore api add data yourself. change max_content_length on line in datapusher source code linked above, bigger.

php - PDO Insert Query Not Working For Integer -

i have code insert new row mysql db using pdo: $query = insert asset_positions (pos_asset_id, pos_latitude, pos_longitude, pos_timestamp) values (:pos_asset_id, :pos_latitude, :pos_longitude, :pos_timestamp) $statement = $pdo->prepare($query); $array = [':pos_asset_id' => 1, ':pos_latitude' => -8.5, ':pos_longitude' => 125.5, ':pos_timestamp' => 1398160487]; $statement->execute($array); echo $pdo->lastinsertid(); the query runs without error shown. newly inserted row id echoed. however, when in db, insert latitude, longitude , timestamp. pos_asset_id field in newly inserted row empty. could point out problem? there no error message displayed. i've been trying solve hours without avail. ps. first time using pdo, please bear me. thanks. edit solved! didn't notice there's fk relation between asset_positions.pos_asset_id , asset.asset_id . once remove relationship constrains, insert works now, pos_asset_id v

mysql - How to search ignoring spaces between words? -

i want search names using search module ignoring white spaces . ex: if want search name "a b zilva" i want disply results on dropdown if type name "ab zilva". currently search without space not working $db = jfactory::getdbo(); $searchp=$_get["term"]; $searchp = str_replace(' ','%%', trim($searchp)); //$searchp= preg_split('/ /', $searchp); $query = $db -> getquery(true); $query="select * content title '%".$searchp."%'and categories_id=82 order title asc "; $db -> setquery($query); // load results list of associated arrays. $results = $db -> loadassoclist(); $json=array(); foreach ($results $json_result) { $json[] = array('value' => $json_result["title"], 'label' => $json_result["title"]); } please advice . update : jquery.extend( jquery.ui.autocomplete.prototype, { _renderitem: function( ul, item ) {

android - Can't handle with Handler -

i playing music form sd card , want seekbar getprogress every 2 sec when music playing. trying handler. dont know how use handler coretly here code: @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); seekbar1 = (seekbar) findviewbyid(r.id.seekbar1); button1 = (button) findviewbyid(r.id.button1); button2 = (button) findviewbyid(r.id.button2); textview1 = (textview) findviewbyid(r.id.textview1); button1.setonclicklistener(new onclicklistener() { @override public void onclick(view v) { mediaplayer mediaplayer = new mediaplayer(); try { mediaplayer.setdatasource(environment.getexternalstoragedirectory()+"/myimages/.audio2.wav"); mediaplayer.prepare(); mediaplayer.start(); } catch (illegalargumentexception e) { // todo auto-g

I want to compare a text of red color background of two different web pages using selenium webdriver -

i want compare text of red color background of 2 different web pages using selenium webdriver. if both same should display true else false. please me out this. you can use method .getcssvalue("background-color"); can called webelement, , use assert statement check value equal "red".

codeigniter - Pyrocms: display an image in a page -

in pyrocms admin, have created image field under default.i pull field in page. currently code looks this {{ if page:slug == "contact" }} <img src="{{ template:contact_main_image:img}}"> //the field name contact_main_image {{ endif }} but can't see image.

android - Bug AutocompleteTextView width in dual pane Fragment UI -

Image
i'm facing problem custom autocompletetextview, dropdown filling totally screen want fill 1 of fragment width. how can solve ? here "beautiful" sketch of view: thanks in advance :)

.net - Object not set to the instance of an Object ERROR Excel 2013 Automation VB.NET -

trying create small report program in vb.net. works in excel 2003 , 2010, throws error in excel 2013 when trying create second worksheet. procedure listed below, point out line errors. doesn't catch in try , catch added comes across "unhandled exception". the target framework 3.5 have tried x86, x64, , cpu target cpu i used 2003 , 2010 .dlls reference. imports microsoft.office.interop.excel private sub drpts() try dim strfiledirname string = "" me.cursor = cursors.waitcursor 'morning report sheet 1 dim mornrpt string = "select datecreated, reportclass, sum(qtyordered), sum(extendedprice) " & _ "from tmp_dailyreport group datecreated, reportclass" dim oexcel object dim obook object dim osheet1 object dim osheet2 object oexcel = createobject("excel.application") obook = oexcel.workbooks.add osheet1 = ob

math - Mathematical Formula for working out font size -

can me i'm not having luck want try workout ideal fontsize text based on width of image it's overlaying , amount of characters in text string. me formula this. i got semi-working due infinite monkey theorem! // gets text1 count $charcount = strlen($line1); // gets text1 size count $newsize = ($width / floor($charcount)); $add = ( 20 % $newsize ); $newsize = ($newsize + $add); // changes font size $text1->setfontsize( $newsize ); i use based on width or height of image: resize_font = function () { // play around denominator until font size want var fontsize = parseint($("#your_image_div").width()) / 2 + "%"; //then apply css text div element $(".your_text_class").css('font-size', fontsize); }; // hook whatever event want $(document).ready(resize); hope helps. trick handy making elements resize in relation veiwport too. hope helps.

java - How to tell if Android screen lock setting is set to None -

i need check if screen lock setting set "none" (or not). i deploying app being sent out users on pre-configured tablets. this pre-configuration done manually tablet supplier. one of settings pre-configure set screen lock none (it bad thing if tablet reached end user screen lock still enabled). the last thing person configuring device start app, able see check list confirm settings have been set accordingly in order avoid missed/incorrect settings. the screen lock setting have been unable find way either read or set programmatically. the tablets rooted , running 4.2.2. assume end user incapable of interacting in way tablet - other powering on , reading display.

javascript - Keep sticky nav sticky when divs are deleted -

morning, i have onepage website using sticky navigation. delete couple of divs when do, sticky navigation no longer sticks when scroll down. can add spacers add extra/empty space. how can delete menu card div , faq div , still make navigation stick top , not jump way now? link: mktminc.com/ecraftinc/new/onepage.html any appreciateed.

php - keep radio button values and set default checked -

i have form radio button group. want set 'checked' default second radio button, , keep value after submitting form if user clicks on first one. note i'm using <span class="custom-radiobutton"></span> style radiobuttons, lower z-index real <input type="radio" , has opacity:0 . this snippet of code: <div class="group-wrapper"> <div class="radiobutton-wrapper boolean"> <span class="custom-radiobutton"></span> <input type="radio" id="hosting-1" name="hosting[]" value="1" class="w100" <?php if ((isset($_post['hosting'])) && ((isset($_post['hosting'])) == 1)) {echo 'checked="checked"';}; ?> /> <label for="hosting-1">sí</span> </div> <div class="radiobutton-wrapper boolean"> <span class="custom-radiobutton

wpf - Close Application to System Tray -

i have wpf app exit "x" button only. system tray icon launched when application starts up. either "hide" or close main window system tray when "x" clicked. how can achieve this? the main thing need change shutdownmode application onexplicitshutdown . can set in app.xaml , app stay alive until call application.shutdown() code (probably based on explicit user command). how handle reopening window tray icon dependent on specific implementation should @ least started.

javascript - Hide more than one json d3 group -

i have json file more 1 group: input.json: { "nodes": [ { "name": "q1", "group": 2 }, { "name": "aliens", "group": 1 }, { "name": "government", "group": 1 }, { "name":"corporate", "group": 1 }, { "name":"creatures", "group": 1 }, { "name":"religion", "group": 1 }, { "name": "q2", "group": 4 }, { "name": "q2", "group": 3 } ], "links": [ { "source": 0, "target": 1, "value": 2 }, { "source": 0, "target": 2, "value": 2

ember.js - Concurrent states with Ember.router -

i'd implement statechart in ember.js v1.5.x using ember.router, have problems concurrency , history mechanism. basically when activate summary route/state i'd transition no changes made , transient state in same time. how can achieve this? p.s. know e.g. stativus have these capabilities don't know how use ember.js routing. example bee good. (image source: ian horrocks: constructing user interface statecharts p.153). :) yeah statecharts lovely , all, ember affords sub-states through computed properties. i'm not overly familiar state charts, , i'd need consume resources (horrocks) mentioned here ( https://github.com/emberjs/ember.js/issues/4767#issuecomment-41458710 ) before i'd conversant in nomenclature of particular example (which can if you'd like). to end, , having said that, please take answer grain of salt, because may not understand context. hope help. so in ember have routes. routes explain interface of application. t

windows phone 8 - VS 2013 The name “LocalizedStrings” does not exist in the namespace -

my question looks 1 : the name "localizedstrings" not exist in namespace except answers tried didn't work me. i'm using visual studio 2013 , windows 8.1 enterprise (fresh install). any other suggestions? close visual studio. than, delete sub folders 10.0 , 11.0 "%localappdata%\microsoft\phone tools\corecon\" open visual studio , rebuild solution.

asp.net - Authenticating a .NET web service using PHP -

i'm working .net server solution provides authentication web service, along several other service urls. access process involves initial call authentication service url, , using 'authenticate' soap call, supposed return access token. token used make calls other service urls retrieve data server. the issue i'm having provided username , password authentication process, there's no indication of how credentials meant sent server. additionally, i'm trying access web service (.net based) using php. so far, i've managed use wsdl2php generate classes authentication service url, classes don't provide indication of how username , password meant sent. i've tried adding credentials soap headers: $headercontent = "<o:username xmlns:o=\"$namespace\"> <o:username>$uname</o:username> <o:password>$pword</o:password> </o:username>"; $headerv

jquery - Can not disable checkbox by value -

here code not working.checkboxes created dynamically.i want disable checkboxes values "undefined" var val = "undefined"; $('#dynamiccapability').on('input:checkbox[value="' + val + '"]').attr('disabled', true); it says undefined when value empty,try this: $('input:checkbox[value=""]').prop('disabled', true);

shell - Modify permissions of a directory in linux -

how can modify write/read/execution permissions of already-made directory in linux shell? need install libsnd library installation gives error failed create directory during process. chmod u+rwx,g=rx,o-rwx /the/directory/already/existing would give user owning ' existing ' basic permissions (the plus sign says "additionally ones user has now"), including write permission, needed creating directories, too. members's of group owning directory have (=) rights read , enter directory while rights read, write , enter directory revoked every other user if existed far. (see man chmod details). but description of problem assume different problem. let me guess, compiled , trying install system wide? make sure either switch root user prior issuing make install using su command (see man su details) or - better - execute sudo make install if sudo installed (and should be). chmod command above not in case, either, presumably not have write permissions di

java - error on infinispan config xml -

14:02:45,997 info modeshape version 3.1.1.final javax.jcr.repositoryexception: error while starting 'persisted-repository' repository: javax.xml.stream.xmlstreamexception: parseerror @ [row,col]:[6,43] message: unexpected element '{urn:infinispan:config:6.0}infinispan' encountered at org.modeshape.jcr.jcrrepository.login(jcrrepository.java:613) @ org.modeshape.jcr.jcrrepository.login(jcrrepository.java:580) @ org.modeshape.jcr.jcrrepository.login(jcrrepository.java:149) @ org.modeshape.example.sequencing.modeshapeexample.main(modeshapeexample.java:76) caused by: org.infinispan.config.configurationexception: javax.xml.stream.xmlstreamexception: parseerror @ [row,col]:[6,43] message: unexpected element '{urn:infinispan:config:6.0}infinispan' encountered at org.infinispan.configuration.parsing.parser.parse(parser.java:116) @ org.infinispan.configuration.parsing.parser.parse(parser.java:94) @ org.infinispan.manager.defaultcachemanager.<init&

java - How does memory allocation of an ArrayList work? -

as far know, when creating arraylist : arraylist<string> list = new arraylist<string>(size); the jvm reserves a contiguous part of memory . when adding new elements our list, when number of elements reaches 75% of size reserves new, contiguous part of memory , copies of elements. our list getting bigger , bigger. adding new objects , list has rebuilt once again. what happens now? the jvm looking contiguous segment of memory, not find enough space. the garbage collector can try remove unused references , defragment memory. happens, if jvm not able reserve space new instance of list after process? does create new one, using maximal possible segment? exception thrown? i read question java: how arraylist manages memory , 1 of answers is: reference doesn't consume space. anyhow, of space used. when array getting bigger, problem. cannot forget have got things use memory space. if jvm not able allocate requested amount of memory it'll

math - Get the next higher integer value in java -

i know can use math.java functions floor, ceil or round value double or float, question -- possible higher integer value if decimal point comes in value for example int chunksize = 91 / 8 ; which equal 11.375 if apply floor, ceil or round number return 11 want 12. simply if have 11.xxx need 12 , if have 50.xxx want 51 sorry chunksize should int how can achieve this? math.ceil() work. but, assumption 91 / 8 11.375 wrong. in java, integer division returns integer value of division (11 in case). in order float value, need cast (or add .0) 1 of arguments: float chunksize = 91 / 8.0 ; math.ceil(chunksize); // return 12!

ios - ScaleToFit does not work -

i have problems scaletofit method. have uipageviewcontroller uiimagesview , want show different pictures in it, not work should. with these 2 lines initialize picture. self.screenpicture.image = [uiimage imagenamed:@"1.png"]; self.screenpicture.contentmode = uiviewcontentmodescaleaspectfit; it's build in case structure, decides picture user can see. switch(self.index) { case zero: { self.screennumber.text = [nsstring stringwithformat:@"1.", nil]; self.screenpicture.image = [uiimage imagenamed:@"1.png"]; self.screenpicture.contentmode = uiviewcontentmodescaleaspectfit; nslog(@"%d",self.index); break; } case one: { self.screennumber.text = [nsstring stringwithformat:@"2.", nil]; self.screenpicture.image = [uiimage imagenamed:@"2.png"]; self.screenpicture.contentmode = uiviewcontentmodesca

quantlib - "end must be large than start" in Uniform1dMesher -

i try build pyd-file quantlib , boost want calculate npv barrier option. quantlib pyd throws: runtimeerror: end must large start the error originates following quantlib class in uniform1dmesher.hpp : class uniform1dmesher : public fdm1dmesher { public: uniform1dmesher(real start, real end, size size) : fdm1dmesher(size) { ql_require(end > start, "end must large start"); const real dx = (end-start)/(size-1); (size i=0; < size-1; ++i) { locations_[i] = start + i*dx; dplus_[i] = dminus_[i+1] = dx; } locations_.back() = end; dplus_.back() = dminus_.front() = null<real>(); } }; my c++-code following: struct optioninputs { quantlib::real s; quantlib::real k; quantlib::spread f; quantlib::rate r; quantlib::volatility vol; quantlib::date maturity; quantlib::daycounter daycounter; }; double fxoptex(const optioninputs &in, const quantlib::date &a

sql server - SQL How can I return a specific position from a string? -

i have following string: declare @request varchar(255) set @request= '**urgent** apple / iphone/ test/future resolution/approved' using sql query, how return word 'apple'? i've tried not work: select substring(@request,charindex('** ',@request),charindex(' / ',@request)) thank input, lori you adjust have correct: declare @request varchar(255) set @request= '**urgent** apple / iphone/ test/future resolution/approved' select substring(@request,charindex('** ',@request) + 3,charindex(' / ',@request)-charindex('** ',@request) -3) basically substring needs start , length need adjust parameters. i feel noting here 1 might naturally try make more generic parameterizing delimiters in someway , using len(first_delim) instead of hardcoding 3 , -3. gotcha here len() ignores trailing space have in both of these delimiters. if delims varchar can instead use datalength, if nvarchar have divide res

How to put image on top of image in HTML/CSS? Nothing's working -

i trying take 1 image, place on screen background, , put company logo on top of looks 1 image. have looked @ other people's examples, , give me background want it, company logo want on top of background displayed beside background instead of on top. nothing try seems working. can please help? html: <div id="background"> <img src="images/background/background.png"> </div> css: div#background { background-image:url('images/background/background.png') background-repeat:no-repeat; } here's how i'd it. you'll need give surrounding div dimentions of background image: html <div class="background"> <img class="logo" src="http://placehold.it/150x75/ff0000/fff&text=logo" alt="company name" /> </div> css .background { position:relative; /*any child elements can positioned relative element*/ background-image:url(http://placehold.it/

Animation not playing after dismissViewController iOS -

i have " aviewcontroller " root viewcontroller , have image playing animation infinite loop. - (void)rotateimageview { [uiview animatewithduration:1 delay:0 options:uiviewanimationoptioncurvelinear animations:^{ [self.imageviewspin settransform:cgaffinetransformrotate(self.imageviewspin.transform, m_pi_2)]; }completion:^(bool finished){ if (finished) { [self rotateimageview]; } }]; } in viewwillappear -(void)viewwillappear:(bool)animated{ [super viewwillappear:animated]; [[nsnotificationcenter defaultcenter] addobserver:self selector:@selector(rotateimageview) name:uiapplicationwillenterforegroundnotification object:nil]; [self rotateimageview]; } this work great if application become active. when i'm try presentviewcontroller " cviewcontroller " [self.navigationcontroller presentviewcontroller: animated: completion:] , have button on " cviewcontroller " [self dismissviewcont

String in Python 3.4 -

i have question of how return true strings. can me on how prompt user input in python 3.4 , answer question write class/function return true if 2 input strings anagram each other. string1 anagram of string2 if string2 can obtained rearranging characters in string1. example: string1 = 'smart' string2 = 'marts' result: true string1 = 'secure' string2 = 'rescue' result: true perhaps along lines of ( warning untested code ): def isanagram(string1, string2): if sorted(list(string1)) == sorted(list(string2)): return true else: return false admittedly there more concise ways of doing particularly easy understand in view.

perl - Custom 404 route not matching website root -

i have few routes defined mojolicious app , catch-all 404 route: $r->any('*')->to(cb => sub { $self = shift; $self->render(text => '404 not found'); $self->rendered(404); }); the 404 route works fine: $ ./bin/myapp.pl -m production /no_such_url 404 not found but want 404 route match website root, , default mojolicious 404 instead, in production mode: $ ./bin/myapp.pl -m production / <!doctype html> <html> <head><title>page not found</title></head> … what need serve plain 404 callback on / ? you correct any '*' not catch main index / . appears 1 exception. there 2 easy solutions: you can create alias route. note how set rendered code before set rendered text: use mojolicious::lite; sub my404 { $self = shift; $self->rendered(404); $self->render(text => '404 *'); } '*' => \&my404; '/' => \&my404; app->

MATLAB : How to crop an object from a binary image by identifying some features? -

Image
i have image shown here: ultimate aim extract vein pattern in finger. trying extraction of finger object alone. purpose, tried otsu thresholding step first, erosion , dilation. using binary image mask multiplied element wise original image obtain finger alone (not accurate though). the code below: i = imread('3.5.bmp'); [level] = graythresh(i); bw = im2bw(i,level); [bwm] = imerode(bw,strel('disk',10)); figure, imshow(bwm) [bwmm] = imdilate(bwm,strel('disk',15)); figure, imshow(bwmm) b = i.*uint8(bwmm); % bwmm mask imshow(b) now want crop finger part alone using mask created before. how achieve that? for clarity uploading image area cropped: (and don't want manually or using imcrop() utility pixel coordinates input. pixel coordinate using algorithms.) you can find pixel coordinates mask bwmm , use coordinates imcrop . to find extermal points of bwmm use projx = any( bwmm, 1 ); % projection of mask along x direction projy = any( bw

jQuery unterminated string literal -

i getting unterminated string literal error, understand php code in script cannot understand what.. here have: jquery('#update-<?php echo $row->id; ?>').live('click', function (){ var myname = "<?php $_post['name_two'] ?>"; var mystep = "<?php $_post['step_two'] ?>"; jquery.ajax({ type: "post", url: "postdata.php", data: {name_two:myname, step_two:mystep}, success: function(data) { alert(data); }, }); }); the error on line: var myname = "<?php $_post['name_two'] ?>"; thanks rick try use echo here removing double quotes if unnecessary here: var myname = <?php echo $_post['name_two'] ?>; var mystep = <?php echo $_post['step_two'] ?>;

c# - How to hide a property into a base class for XML serialization -

let i've base class public class myclass { private bool _success; public bool success { { return _success; } set { _success = value; } } } and derived class public class mysubclass : myclass { public string str { get; set; } } question: how can serialize mysubclass xml such there no <success> tag in serialization result? [xmlignore] public bool success { { return _success; } set { _success = value; } } the [xmlignore] attribute tells serialization process ignore attribute. never serialized there won't node in serialized xml http://msdn.microsoft.com/en-us/library/system.xml.serialization.xmlattributes.xmlignore.aspx to ignore field in subclass, can override property baseclass. in base class (note virtual keyword): public virtual bool success {get;set;} in subclass [xmlignore] public override bool success {get;set;}

ruby on rails - Method for finding the days when you need to send mail -

i can not write method send letters days used create company. the user created company created_at: "2014-04-24 11:39:35" , indicated how company ended ends_at: 4 , 4 days after creation of company end. also specify days in notify first_reminder_day: 3, second_reminder_day: 1 . i write method send notification users regarding completion of company. class campaign < activerecord::base def dispatch_emails @campaigns = campaign.where("ends_at < ?", time.now + first_reminder_day.day ) @campaigns.each |campaign| campaignends.notify(campaign, first_reminder_day).deliver end end end class campaignends < basemailer def notify(campaign, day) @title = campaign.title @day = day mail(to: 'to@example.com', subject: "the company #{@title} ends in #{@day} days") end end how use 2 values search first_reminder_day , second_reminder_day in search?

How to set up variables in multi-part cloud-init userdata scripts? -

i want able set variable in shell-script - part of multi-part cloud-init userdata configuration setup, , use variable in cloud-config script comes later in multi-part userdata. is possible do? example helpful. you use file. set "variable" echo "value" > /tmp/myvar , echo `cat /tmp/myvar` .

Pass a vbscript String list to a SQL "in"operator -

in vb script have select statement trying pass string value undetermined length sql in operator below code works allows sql injection. i looking way use ado createparameter method. believe different ways have tried getting caught in data type (advarchar, adlongchar, adlongwchar) dim studentid studentid = getrequestparam("studentid") dim rsgetdata, dbcommand set dbcommand = server.createobject("adodb.command") set rsgetdata = server.createobject("adodb.recordset") dbcommand.commandtype = adcmdtext dbcommand.activeconnection = dbconn dbcommand.commandtext = "select * students studentid in (" & studentid & ")" set rsgetdata = dbcommand.execute() i have tried call addparameter(dbcommand, "studentid", advarchar, adparaminput, nothing, studentid) which gives me error adodb.parameters error '800a0e7c' problems adding parameter (studentid)=('sid0001','sid0010') :para

Can my php output be seen by the client side in this Jquery script? -

i have page contact form. email message email address. allow client modify email address message sent to, have created custom field (acf) recalled using: <?php the_field('email_address'); ?> i have used in following jquery code, posts php file. $("#submit").click(function(){ var address = <?php echo '"'; the_field('email_address'); echo '"'; ?>; var name = $("#name").val(); var gender = $("#gender").val(); var email = $("#email").val(); var subject = $("#subject").val(); var message = $("#message").val(); $.ajax({ type: "post", url: "php/contact.php", data: { address: address, name: name, gender: gender, email: email, subject: subject, message: message } }); return false; }); the reason do

android - How to align buttons below textview in linear layout -

i have table , each cell have text , 3 buttons. i want buttons aligned right below text view can't them align that. this layout: <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal" android:descendantfocusability="blocksdescendants"> <textview android:id="@+id/name" android:layout_width="wrap_content" android:layout_height="wrap_content" android:paddingbottom="15dip" android:paddingleft="5dip" android:textstyle="bold" android:paddingtop="5dip" android:textcolor="#000000" android:textsize="16dip" android:layout_torightof="@+id/track_no"/> <linearlayout android:id="@+id/c

java - JOptionPane displaying some HTML tags literally -

i'm getting inconsistent html display in swing message dialog. first example call below fine, second 1 displays 1 of break tags literal text. what's going on here? import javax.swing.*; class test { public static void main(string... args) { swingutilities.invokelater(() -> { joptionpane.showmessagedialog(null, "<html>line 1<br>line 2<br>line 3"); joptionpane.showmessagedialog(null, "<html>line 1<br>\nline 2<br>\nline 3"); }); } } don't know problem looks jlabel renders html correctly: jlabel label = new jlabel("<html>line 1<br>\nline 2<br>\nline 3"); joptionpane.showmessagedialog(null, label); which doesn't make sense because thought joptionpane jlabel render text?

jquery - clone the element not the data -

edit: decided not use cloning seems way past level of knowledge. advised not delete question question gonna here. i have 2 tables, 1 being populated data , empty. using draggable , droppable jquery ui can move data first table other. , working perfectly. now, trying clone "tr" element of second table data being copied when data dropped using .clone() , cloning works except clones data dont want want clone tr element. this html. <div id="contact-list"> <table class="contact-list-table"> <thead> <th>name</th> </thead> <tbody> <tr id="1"><td>nora marzuki</td></tr> <tr id="2"><td>tunku imran</td></tr> <tr id="3"><td>iman nong</td></tr> </tbody> </table> </div> <div id="guest-list"> <table class="guest-list

postgresql - Ignoring seconds from timestamp postgres -

i running cron job every 1 minute notifying users events select * events event_start = now() - interval '30 minutes' so can send users notification prior 30 mins of event problem event start timestamp field if there difference in seconds wll not work ,so how can ignore seconds part . you can use date_trunc() remove seconds: select * events event_start = date_trunc('second', now()) - interval '30' minutes more details in manual: http://www.postgresql.org/docs/current/static/functions-datetime.html#functions-datetime-trunc

php - One domain working on different servers -

i have wordpress site on share-hosting server , want use php script cannot run on share-hosting one. so thinking if can have on share-hosting (server1) wordpess site (http:// mysite dot com) , when types url path (http:// mysite dot com/php-script) directed vps server (server2) php-script run. is possible? , how can it? if not have on mind can do? thanks time :) this possible when create different subdomains. if set subdomain in dns-settings 'server2.address.lol', can redirect subdomain ip-address , server. you have create a-record. after set up, can redirect php-file on subdomain. example: http://server2.example.lol/script.php

mysql - PHP Date from Database as Timestamp - add X hours -

i have googled , give up, here goes... i have had issues dealing times/timestamps etc, trying pull date database in sql timestamp format, have far... $db = $row_rssearch['created_date']; $newdate = date("d/m/y h:i:s", strtotime('+3 hours', $db)); what wrong it? getting return of "31/12/1969 20:33:34" when database providing... 2014-04-25 02:19:53 thanks in advance. if got right want add 3 hours each date? why don't within query? example: select `date` + interval 3 hour created_date `table`

android - Difficulty in hint display for edit text -

hi used hint edit text shows perfect when not used gravity of edit text center but once when used android:gravity="center" doesnot showing hint know why? here code <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_alignparentleft="true" android:layout_alignparenttop="true" > <linearlayout android:id="@+id/linearlayout" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignparentleft="true" android:layout_alignparentright="true" android:orientation="vertical" > <include layout="@layout/header" /> </linearlayout> <relativelay

php - htaccess redirects on apache -

i new .htaccess . i working on project in need display different url after every 15 days. for e.g. "mysite.com/s1/folder1" when enter url in address bar can see index.html content resides inside "folder1" . now want display same "index.html" same "folder1" after 15 days url in address bar different e.g. "mysite.com/s1/any-other-name" . possible. appreciated. thanks, shailendra try .htaccess in mysite.com documentroot folder rewriteengine on rewritebase / rewritecond %{request_uri} !^/?(s1/folder1)/ rewriterule ^s1/(.*) s1/folder1/ if request begins s1/ redirect s1/folder1

android - Why am i getting the error, Table *tableTame* has no column named *columnName* -

tried updating database version per other posts on stackoverflow no avail essentially it's android application adds entry database , displays in in listview. when invoke inserta method following error in logcat believe cause of errors) 04-25 13:47:08.697: e/sqlitelog(1783): (1) table adb has no column named p 04-25 13:47:08.747: e/sqlitedatabase(1783): error inserting progress=aa mp=aa an=aa mc=aa wd=aa 04-25 13:47:08.747: e/sqlitedatabase(1783): android.database.sqlite.sqliteexception: table has no column named p (code 1): , while compiling: insert a(p,mp,an,mc,wd) values (?,?,?,?,?) the question is, why saying there there no column named p when able make others not p? public void oncreate(sqlitedatabase database) { string sqlitequery = "create table assignments ( " + "assignmentid integer primary key," + "modulecode text, " + "assignmentname text, " + "whendue text, &quo