Posts

Showing posts from April, 2015

mysql - Find number of "active" rows each month for multiple months in one query -

i have mysql database each row containing activate , deactivate date. refers period of time when object row represents active. activate deactivate id 2015-03-01 2015-05-10 1 2013-02-04 2014-08-23 2 i want find number of rows active @ time during each month. ex. jan: 4 feb: 2 mar: 1 etc... i figured out how single month, i'm struggling how 12 months in year in single query. reason in single query performance, information used , caching wouldn't make sense in scenario. here's code have month @ time. checks if activate date comes before end of month in question , deactivate date not before beginning of period in question. select * tblname activate <= date_sub(now(), interval 1 month) , deactivate >= date_sub(now(), interval 2 month) if has idea how change , grouping such can indefinite number of months i'd appreciate it. i'm @ loss how group. if have table of months care about, can do: select m.*, (select cou...

javascript - How to make html div with text over image downloadable/savable for users? -

i have div takes user image , places user text on it. goal users to, after seeing preview , customizing image/text like, able download or save image click of button. possible? here's code: (i'm new html/css please forgive ugly formatting/methods) html: <script `src="https://cdnjs.cloudflare.com/ajax/libs/html2canvas/0.4.1/html2canvas.min.js"></script>` <p>dom-rendered</p> <p>&nbsp;</p> <div id="imagewrap" class="wrap" style="border-style: solid;"> <img src="../images/environment.gif" id="img_prev" width="640" height="640" /> <h3 class="desc">something inspirational</h3> </div> <div id="canvaswrapper" class="outer"> <p>canvas-rendered (try right-click, save image as!)</p> <p>or, <a id="downloadlink" download="cat.png">click here down...

wordpress - Issue in Updating the IP in DB -

we encountered below listed issue while migrating our company site new site following steps below: we have launched new amazon rds instance , imported data old db new rds. we pointed website newly launched rds assigned new elastic ip address wordpress site , ip of instance got change. ran query update new ip in database level but after executing query prod site still pointed old ip. fix: we have taken db dump in .sql format , analysed. found old url still hard coded in db so have edited .sql dump replacing old url new url. , imported edited dump db. after import , restarting, application started working fine. could please let me know (1) whether such hard coding ip common practice in wp , (2) there better way avoid hard coding? thanks in advance! wordpress not store server ip address in database, does store full url site in many places. it sounds must using ip address access website, meaning people visit site going http://xxx.xxx.xxx.xxx , not http:...

javascript - ViewBag value returning wrong number -

i trying insert values viewbag input through javascript , dynamically creating value. i call value of employeeid made controller public string getemployeeid(out string idmethod) { string ee_id = string.empty; clientemployeesetupdefaults ee_setup = this.dbcontext.clientemployeesetupdefaults.firstordefault(c => c.clientid == globalvariables.client); string nextidsuffix = string.empty; idmethod = ee_setup.employeeidmethod; switch (idmethod) { case idmethod.sequence: ee_id = nextemployeeid(ee_setup.employeeidnext, "", out nextidsuffix); break; case idmethod.prefixplusseq: ee_id = nextemployeeid(ee_setup.employeeidnext, ee_setup.employeeidprefix, out nextidsuffix); break; } if (nextidsuffix != string.empty) { ee_setup.employeeidnext = nextidsuffix; this.dbcontext.savechanges(); }...

Zero coverage with IntelliJ IDEA: Grails with Spock unit tests -

i trying configure code coverage reporting our grails application when running spock-based unit tests. able generate reports, coverage 0. i have tried playing various options (e.g. sampling vs. tracing ), results same: total number of classes/methods/lines shown correct, coverage 0, e.g.: class,%: 0%(0/2) method,%: 0%(0/4) line,%: 0%(0/16) which bogus, since relevant code can modified in such way tests fail. the setup: os x yosemite 10.10.2 intellij idea ultimate 14.1.3 grails 2.4.4 spock 0.7 groovy 2.4.3 java 1.8.0-31 i wrote jetbrains support , pointed me following issue: https://youtrack.jetbrains.com/issue/idea-137285 in short, resolution specify grails.project.fork = [ test: false ] in buildconfig.groovy . also, see intellij idea debugger isn't working on grails project - there useful info there on when/how/why use fork mode.

javascript - End a .each and a setTimeout() -

i'm trying figure out stop/start buttons using javascript , jquery. have jsfiddle set try understand can't work: http://jsfiddle.net/kkx7m88c/ the start button should turn each box red 1 @ time. stop button should revert boxes blue , stop more turning red until start button pressed again. currently, stop button turn boxes blue doesn't stop play function, meaning boxes hadn't been turned red yet don't stop. turn red. here js: // new class turns boxes red css function goclasses(item, container) { $(container).removeclass('stopped'); $(item).addclass('new'); } function stopclasses(item, container) { $(item).removeclass('new'); $(container).addclass('stopped'); } $('#go').mousedown(function () { $('.box').each(function(i){ var item = $(this); var container = $('.selection'); settimeout(function () { goclasses(item, container); }, 500 * i)...

java - Is setting Android MediaPlayer player to null when releasing necessary? -

looking @ example on how release android mediaplayer instance on official document, says should nullify object after releasing it: here's how should release , nullify mediaplayer: mediaplayer.release(); mediaplayer = null; // <-- instruction asking about. is necessary? if so, why? source: https://developer.android.com/guide/topics/media/mediaplayer.html#releaseplayer the null mark gc can 'collect' object.

R - Connecting R and java using Rserve -

i have build application connecting r , java using rserve package. in that, getting error "evaluation successful object big transport". have tried increasing send buffer size value in rconnection class also. doesn't seem work. object size being transported 4 mb here code r connection file public void setsendbuffersize(long sbs) throws rserveexception { if (!connected || rt == null) { throw new rserveexception(this, "not connected"); } try { rpacket rp = rt.request(rtalk.cmd_setbuffersize, (int) sbs); system.out.println("rp send buffer "+rp); if (rp != null && rp.isok()) { system.out.println("in if " + rp); return; } } catch (exception e) { e.printstacktrace(); logout.log.error("exception caught" + e); } //throw new rserveexception(this,"setsendbuffersize failed",rp); } the full java class av...

angularjs - How do I add dynamically created select lists that are unique for each item and respond to their changes in Angular -

i'm new angular , still learning proper way things (and realize isn't it!). presently, have array of objects (in case ingredients). each ingredient has different nutrients, , each nutrient has different array of measurements assigned them (some tsp, oz, etc , others slice, 1 cube, etc) . each of these measurements have multiplier associated them use calculations. when click on individual ingredient, it's added array of ingredients objects. new list of ingredients populates ingredient list (recipe) have each ingredients measurements in select/option along input accept quantity. need able dynamically quantity entered , measurement of each ingredient can calculate various nutrients of each ingredient calculate recipe whole. i'm saving combined nutritional value in array , not worried saving individual calculation. i'll want save quantity, measurement , ingredient separate array (a recipe). i can work single items multiple items has been challenge. this...

objective c - Offline rendering with The Amazing Audio Engine -

this post posted on the amazing audio engine forum . hi everyone, new amazing audio engine , ios dev, , have been trying figure out how bpm of track. so far have found 2 articles on offline rendering on forum: http://forum.theamazingaudioengine.com/discussion/comment/1743/#comment_1743 http://forum.theamazingaudioengine.com/discussion/comment/649#comment_649 as far know aeaudiocontrollerrendermainoutput function correctly implemented in this fork. i trying offline rendering process track , use algorithm described here (javascript) , implemented here . so far i'm loading fork, , using swift (i part of make school summer academy @ moment, teaches swift). when playing track code works me (no offline rendering!) let file = nsbundle.mainbundle().urlforresource("track", withextension: "m4a") let channel: anyobject! = aeaudiofileplayer.audiofileplayerwithurl(file, audiocontroller: audiocontroller, error: nil) audiocontroller = aeaudiocont...

php - MYSQL query using a set of values (values stored from a session array) not working -

i'm beginner , i'm doing project (a shopping cart). user can add product cart , id of product stores in session. when use ids echo out price db it's not working. i'm using php & mysql. here code if(count($_session['cart_items'])>0){ // getting product ids $nos = ""; foreach($_session['cart_items'] $no=>$value){ $nos = $nos . $no . ","; } // removing last comma $nos = rtrim($nos, ','); //echo $nos; (will display int values 1,2,3,4) $nos=mysql_real_escape_string($nos); $site4->dblogin(); $qry = "select * vendorproducts product_no in('.implode(',',$nos).')"; $result = mysql_query($qry); $row = mysql_fetch_assoc($result); echo $row['price']; } php not recursively embeddable: $qry = "select * vendorproducts product_no in('.implode(',',$nos).')"; ^---start of string ...

java - “LinearLayout or its RelativeLayout parent is useless” warning -

i need use layout_below property of relativelayout , weightsum property of linearlayout. the code works disappointing warning. i'm doing wrong? tyvm! code attached: <relativelayout android:id="@+id/filtro" android:layout_width="fill_parent" android:layout_height="42dp" android:background="@color/grisoscuro" android:layout_below="@+id/header_separator_filtro" > <linearlayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:weightsum="1.0"> <button android:id="@+id/btfiltrocategoriasnoticias" android:layout_height="wrap_content" android:layout_weight=".5" android:layout_width="0dp" android:textcolor="@color/blanco" android:gravity="cent...

java - Lombok post @Builder build event -

i using lombok builder. want following: once user create object using build() function. want fire following methods defined in class. validate initialize internal object. what way achieve this? there's no such feature, there's related feature request , applies constructors , setters, rather builder. guess, should work you, however, it's not implemented yet.

Mule ESB - Specify JMS Queue Name as a property -

i want set queuename property key in mulesoft esb jms connector. queue names different based on environment. have different property files environment specific. want set queue name, environment specific, based on property value. currently have this: <jms:inbound-endpoint queue="q_test" connector-ref="active_mq" doc:name="q_test"/> however need functionality similar below: <jms:inbound-endpoint queue=<property-key> connector-ref="active_mq" doc:name="q_test"/> and want use value properties file. any appreciated. queue names specified part of jms inbound endpoint, , there no restriction on use of property placeholder there, may do: <jms:inbound-endpoint queue="${your.property}" /> and use 1 various techniques load different property placeholder configurers different environments.

asp.net mvc 3 - ReCaptcha - null entry for parameter 'captchaValid' -

i have old site on mvc 3 wich working fine, our server crashed last week, i've recovered recaptcha in forms started giving problems didn't have before. on local machine works fine on production server, set in same way, yells system.argumentexception: parameters dictionary contains null entry parameter 'captchavalid' of non-nullable type 'system.boolean' i believe should ok [web.config] <appsettings> <add key="webpages:version" value="1.0.0.0"/> <add key="clientvalidationenabled" value="true"/> <add key="unobtrusivejavascriptenabled" value="true"/> <add key="recaptchaprivatekey" value="myprivatekey" /> <add key="recaptchapublickey" value="mypublickey" /> </appsettings> (...) <namespaces> <add namespace="system.web.mvc" /> <add namespace="system.web.mvc.aj...

mysql - HAVING clause and performance -

i've got performance problem sql (mysql) query. have table similar this: id price id object ----------------------------- 1 500.00 1 1 2 300.00 1 1 3 400.00 1 1 4 100.00 1 1 5 100.00 1 1 6 100.00 2 3 and need maximum amount of lines given amount. for example, given amount 1000.00 query must returns these ids (order price asc) , total price. id price total_price --------------------------------- 4 100 100.00 5 100 200.00 2 300 500.00 3 400 900.00 atm i'm using query similar below one: set @total=0; select a.id, a.price , @total:=@total + a.price total_price , a.id_user shares a.`id_user` != 0 , a.id_object = 1 having @total < 1000.00 order a.price asc; it works fine it's not efficient. takes around 1.5 seconds extract data (the table has around 1m lines). the problem related having clause. do have suggestions? is there way perform type of query without using clause having ? ...

javascript - Express Router not picking pages from app.js -

i started basic sample of express , node. able set mongodb well.now problem comes in when try refactor code different modules i.e index,login , register.i have put different mechanisms different files , added routing same.but not pick files ( apart index page). i attaching source code app.js . var config = require('./config'); var express = require('express'); var path = require('path'); var favicon = require('serve-favicon'); var logger = require('morgan'); var cookieparser = require('cookie-parser'); var bodyparser = require('body-parser'); var mongoose = require('mongoose'); var passport = require('passport'); var localstrategy = require('passport-local').strategy; var routes = require('./routes/index'); var session=require('express-session'); var login = require('./routes/login'); var register = require('./routes/register'); var app = express(); // view engine ...

javascript - Whats the diff between cdnjs vs npmjs -

what difference between cdnjs vs npmjs? im new javascript , programming in general real newb question , there's real big difference. but it, difference? , npm type of cdn (content delivery network)? npmjs(node package manager) repository consisting node modules/packages. can search , download node modules there. cdnjs content delivery network javascript library files. can add reference of javascript libraries cdnjs without requiring them on server.

Android - Localization by Country only -

can localize android assets based on country, not language? seeing online tells me it's not possible doesn't seem answer. know can /res/layout-language or /res/layout-language-rcountry. layout folder based on country, regardless of language... the reason want in app, english has 1 layout particular screen, , totally different layout canada same screen. canada has english , french, duplicate layout files /res/layout-fr-rca , /res/layout-en-rca doesn't seem idea. you can make sub folders under layout folder , use accordingly in gradle build system. refer answer make subfolers: can android layout folder contain subfolders?

c# - How to Get comboBox value from a datagridview cell -

i want value of combobox cell in datagridview put in update method record. values combobox displayed displaymember , stored in database id . this combobox in datagridview in form load method combobox cell @ index 15 ............. dgv_cust.columns[14].name="web"; dgv_cust.columns[14].datapropertyname = "web"; datagridviewcomboboxcolumn cbcol = new datagridviewcomboboxcolumn(); cbcol.name = "accstatus"; cbcol.datapropertyname = "cbcol"; // datatable column name cbcol.items.add(new comborecord(0, "")); cbcol.items.add(new comborecord(1, "active")); cbcol.items.add(new comborecord(2, "notactive")); cbcol.items.add(new comborecord(3, "other")); cbcol.displaymember = "status"; cbcol.valuemember = "idx"; cbcol.displayindex = 15; dgv_cust.columns.add(cbcol); dgv_cust....

How to publish Google apps script add-on with Picker API? -

i started learn google picker api , read file-open dialogs in google apps guide. tested sample code , worked fine, don't understand whether can publish google apps script add-on including feature. concern there 'developer_key' on code. don't know how 'developer_key' publishing, please help. edit : question follows: correct way write down browser key on script, publishing google apps script add-on? isn't dangerous publish browser key value? can add-on users see code.gs and/or page.html? you can publish add-on picker. have publish add-ons using picker myself(private domain or else share them you). find key, editor open resources menu , select developers console project. click link open project script associated with. developers console project, assuming have enabled picker api, open credentials menu. if have created browser key listed here. if havent, click create new key under public api access, select browser key. referers need add ...

vb.net - Multi-Threading IP Address Pings Causing Application Crash -

boy, learning new can real headache if can't find solid source. have been designing applications in linear fashion time , want step more powerful approach. have been reading on threading, , perhaps have gone larger level should. however, 1 steps when application calls , no better time present learn new. my program designed seems rather simple, has become extremely difficult create in smooth running manor. original design created object of each device on network wished ping, in real world environment kindles. goal ensure still connected network pining them. used for loop , obj array set on timer . had unexpected results causing listview flicker , load after listview1.items.clear . evolved updating list items rather clearing them , flicker remained. i assumed due slow process of array , pings started hunting solutions , came across multi-threading . have known time, have yet dive practice. program seemed need more speed , smoother operation took stab @ it. below code in c...

xaml - Why LongListSelector ItemTemplate Doesn't Show Anything? -

i need pivot page in every pivot page there longlistselector list data... this code write when create simple pivot page <phone:pivotitem header="all"> <phone:longlistselector name="allnotes" background="black" margin="0,0,0,0"> <phone:longlistselector.itemtemplate> <datatemplate> <stackpanel background="white" margin="0,17,0,0"> <textblock text="aaaa"> </textblock> </stackpanel> </datatemplate> </phone:longlistselector.itemtemplate> </phone:longlistselector> </phone:pivotitem> but there isn't in pivot item i mean defini...

perl - Makefile.PL check if source directory found -

i using extutils::makemaker create makefile.pl added following function makefile.pl check if source directory exist sub check_directory { ($argv) = @_; unless (defined $argv->{'source'} , -d $argv->{'source'}) { die 'directory not found '; } } now when run perl makefile.pl --source=/opt/src ok but after whe run make/dmake compiles ok "directory not found " message , "error code 255" idea why , if there different way check if directory found when writting makefile.pl worth mention if remove above code compliation finish success.

actionscript 3 - Adding object within another -

i have main stage 550x400. header area stats bar. have element underneath named gamestage 550x350. i creating circles on 1 second interval , trying randomly place them within gamestage. not appear working. seems they're being added 550x350 element, starts @ top of main stage -- not within gamestage. also if addchild(circle) creates 25 radius circle. gamestage.addchild(circle), circle gets skewed slightly. what doing wrong? private function createcircle():void { var stagesafex:number = math.random()*gamestage.width; var stagesafey:number = math.random()*gamestage.height; var circle:sprite = new sprite(); circle.graphics.clear(); circle.graphics.beginfill(math.random()*0xffffff, 1); circle.graphics.drawcircle(0, 0, circleradius); circle.graphics.endfill(); circle.x = stagesafex; circle.y = stagesafey; circle.name = string(circlecount); gamestage.addchild(circle); } oka...

javascript - How to display images in Froala Editor after ajax respond with a good link in Codeigniter? -

i'm using codeigniter3 , froala editor posting content in website , i'm create image upload when click on insert images in froala editor , after respond ajax link of images don't show in froala editor issue images don't show in froala editor has upload server(localhost). here froala editor <script> $(function () { $('#edit').editable({ inlinemode: false, mediamanager: false, showinsertimage:true, imageuploadparam: 'up_img', sethtml:true, imageuploadurl: 'http://localhost/site/gotoadmin/image/edit_img', imageerrorcallback: function (data) { if (data.errorcode == 1) { console.log ('bad link') } else if (data.errorcode == 2) { console.log ('bad response') } else if (data.errorcode == 3) { console....

ios - addObject in NSMutableArray error -

i trying show or hide buttons actions can take contact depending on whether data present, i.e. there phone number or facebookid. following code compiles crashes on buttonstohide line. nsmutablearray *buttonstoshow = [nsmutablearray arraywithobjects:self.facebookbutton,self.callbutton, self.smsbutton, self.emailbutton, self.deletebutton, nil]; nsmutablearray *buttonstohide = [nsmutablearray array]; nslog(@"facbook id is:%@",self.contact.facebookid); if (self.contact.facebookid == nil) { [buttonstoshow removeobject:self.facebookbutton]; //following line crashes , shows in green [buttonstohide addobject:self.facebookbutton]; } would appreciate suggestions on causing crash. it's isn't crashing on second array allocation, on first, , crash caused 1 elements in initialization being nil. nsmutablearray *buttonstoshow; if (self.facebookbutton && self.callbutton && self.smsbutton && self.emailbutton && self.d...

javascript - Show HTML5 validation message -

Image
i'm using html5 constraint validation , i'd show validation message after each blur. html <input id="texinput" type="text" onblur="validation()" required> js var el = document.getelementbyid('texinput'); if (!el.checkvalidity()) { //here show message } is possible similar? it possible. this: html: <input id="texinput42" type="text" onblur="function(){validation('texinput42');}" required> js: function validation(_id){ var isvalid= false; //check validity here: var el = document.getelementbyid(_id); if(el.innerhtml == '') isvalid=false; if(el.innerhtml.length > 0) isvalid=true; if (isvalid) { //here show message alert('debug: it's ok'); //or change css color el in green, e.g. } }

samsung mobile - check spen hardware feature availability in android programmatically -

i developing app lists hardware features wifi, bluetooth,nfc etc... i using packagemanager.hassystemfeature() check. similarly there anyway check whether android device has spen hardware support or not? need check progrmmatically. i'm pretty sure covered in developer guide http://developer.samsung.com/ : boolean isspenfeatureenabled = false; spen spenpackage = new spen(); try { spenpackage.initialize(this); isspenfeatureenabled = spenpackage.isfeatureenabled(spen.device_pen); } catch (ssdkunsupportedexception e) { toast.maketext(this, "this device not support spen.", toast.length_short).show(); e.printstacktrace(); finish(); } catch (exception e1) { toast.maketext(this, "cannot initialize pen.", toast.length_short).show(); e1.printstacktrace(); finish(); }

java - How to display data from a Loader using Toast -

i've simple activity ( class mainactivity extends activity implements loadermanager.loadercallbacks<cursor> ) also i've simple layout text box , button. just keep simple, lets i've loader loads data hashmap<string> (which populated) , i've intialized/configured loadermanager , cursorloader appropriately. now i'd display content of hashmap using toast upon clicking on button, (which bound onclickretrievedata(){} in activity ) any hint on how that? update: understand how display data on toast (once have data), question more of line of retrieving data loader inside onclicretrievedata(). it's hard tell whether you're asking how kickstart loader loading or when done. if assume mean want start loading data when button clicked , calls onclickretrievedata() , you'll this: @override void onclickretrievedata(view v) { getloadermanager().initloader(my_loader_id, null, this); } then, implementation of loadercallbacks...

regex - powershell complicated regular expression -

i've been stuck trying write regular expression matches following condition. basically, have text file contains several text lines (composed of words , digits). example: some_text number 45 some_text ptrn: anchor some_text number 22 some_text what need return “45” (or other digits after word “number”), in case in line found “ptrn: anchor”. again, if pattern “ptrn: anchor” has been found in line, script should look back along line until gets first word “number” , output digits beside it. i'm not @ regular expressions , appreciate help. this should do: "number\s*(\d+).*ptrn: anchor" note if there multiple numbers before ptrn: anchor in single line, first 1 returned.

how to make android app density independence? -

i developing photo editor in android studio . have images , icons on screen not fit other screens(different sizes). have included following support screen code in manifest.xml file <supports-screens android:anydensity="true" android:largescreens="true" android:normalscreens="true" android:resizeable="true" android:smallscreens="true" android:xlargescreens="true" /> i came know density independence way rid of this. don't know how proceed further .please me steps make app density independence? activity_main.xml android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:gravity="center_vertical|center" android:background="#403e3e"> <linearlayout android:layout_margintop="30px" android:layout_width="fill_parent" android:layout_h...

javascript - CasperJS doesn't evaluate jQuery method -

i injected jquery casperjs: phantom.injectjs('./utils/jquery/jquery-2.1.4.js'); but when try evaluate jquery code, ignored: example: function dragndropalerttoactivity() { var tt = casper.evaluate(function() { $('div[id^="scheduler-alert-grid"] table:contains(blue alert)')[0].simulate("drag-n-drop", { dragtarget: { dx: 71, dy: 71, interpolation: { stepcount: 2 } } }); return "done"; }); casper.echo(tt); }; calling method like: casper.test.begin(function(){...}) . test executed using: casperjs test tests the output says $ cannot found. why ignore jquery, when write simple selector? the phantom.injectjs() documentation says (emphasis mine): injects external script code specified file phantom outer space. which means jquery not injected page context try use it. you ...

Autohotkey: Get debugging window (floating mode) of PhpStorm? -

woraround autohotkey (scripting language in windows, here win7). how debugging window (floating mode) of phpstorm again? once switch in floating mode (phpstorm version 9) window no longer visible , non-existent (titles , class names known me load attempt autohotkey). debugging window seems not exist (says autohotkey). here code i've been trying find window: detecthiddenwindows,on settitlematchmode , 1 ;~ if(winexist("ahk_class" . classname)) ; w=sl5_preg_contentfinder ; woks w=debug if(winexist(w)) ; case insensitive { wingettitle , title, %w% wingetclass,class,a msgbox,yeah `n found: `n %class% = class `n %title% = title `n %debug_ahk_class% = debug_ahk_class } btw produced video of problem , if need more information. please let me know! thanks!

cucumber - Switching Capybara drivers with environment variables -

i running cucumber tests capybara , want able run sets of tests different drivers selenium or poltergeist. i've registered drivers , can switch between them environment variables in following fashion: if env['default_driver'] == ":poltergeist" capybara.default_driver = :poltergeist end my question is, there way pass driver in environment variable without use of if blocks? ideally, i'd capybara.default_driver = env['default_driver'] || :selenium produces errors. you should use to_sym convert env variable symbol, remove colon variable. right using ":poltergeist", string, instead of :poltergeist , symbol. capybara.default_driver = env['default_driver'].to_sym work if env['default_driver'] "poltergeist".

ruby on rails - how to validate the filsize? -

please solve problem. i use gem paperclip , documentation: https://github.com/thoughtbot/paperclip/tree/master#validations i implemented upload files. works. need add validation rules. following: model: class video < activerecord::base validates :title, presence: true validates :video, presence: true belongs_to :user has_attached_file :video, :styles => { :medium => "300x300>", :thumb => "100x100>" }, :default_url => "/images/:style/missing.png" validates_attachment :video, :presence => true, :content_type => { :content_type => "image/jpeg" }, :size => { :in => 0..200.kilobytes } end controller: def create @video = video.new(video_params) if @video.save flash[:success] = :video_created redirect_to @video else flash.now[:error] = :user_not_created render 'new' end end def video_params params.require(:video).permit(:title, :video) end as r...

How to get a column value based on criteria like where clause in Hbase shell -

i new hbase. i have scenario need pull filename based on status , current date. so have created 3 columns; filename , status , date in hbase table. how can filename based on condition status=true , date today? this query needs executed on hbase shell. achieving in concise way difficult. here did. hbase shell jruby shell, enables following example. import org.apache.hadoop.hbase.filter.singlecolumnvaluefilter import org.apache.hadoop.hbase.filter.comparefilter import org.apache.hadoop.hbase.filter.substringcomparator import org.apache.hadoop.hbase.filter.filterlist filter1 = singlecolumnvaluefilter.new(bytes.tobytes('cf'), bytes.tobytes('qualifier'), comparefilter::compareop.valueof('equal'), substringcomparator.new('valuetosearch')); filter2 = singlecolumnvaluefilter.new(bytes.tobytes('cf'), bytes.tobytes('qualifier2'), comparefilter::compareop.valueof('equal'), substringcomparator.new('valuetosea...

android - Product state is always "invalid" (using Cordova Plugin Purchase) -

i'm using cordova plugin purchase use in-app billing in android app. however, using alert json-stringified product, product's state "invalid". here sample of code around issue: store.register({ id: 'test_walker_01', alias: 'walker', type: store.consumable }); item_walker = store.get("test_walker_01"); store.when("product").updated(function (product) { alert(json.stringify(product)); }); store.refresh(); my problem: cannot access product's information google play. after searching on google , stack overflow, here steps did/verified find solution: i triple checked id same on developer console, , type "managed". the product activated in developer console. i uploaded exact same apk on test phone uploaded in developer console, in alpha testing. i'm using different google account 1 in developer console. i have added (different) account in list of authorized test gmail accounts. ...

arrays - Splitting a Delimited String Variable in SAS into Individual Variables -

i'm hoping can me out issue. trying take string variable contains series of delimited pick list responses. there can no response, 1 response (e.g., 1234), or several responses (e.g., 1234;9876) in single variable. different options delimited semicolon (;). i'd split single variable multiple variables based on delimiter. for example, reasons=1234;9876 -> reason1=1234, reason2=9876 traditionally have done manual way using scan function. problem have (in case) 10 pick list items concatenated in single string. data want; set got; length reason1-reason10 $10; if reasons ne ' ' reason1=scan(reasons, 1, ';'); if reasons ne ' ' reason2=scan(reasons, 2, ';'); if reasons ne ' ' reason3=scan(reasons, 3, ';'); ... run; and on... i feel array simplify process. however, learning how use arrays. advice on how split string variable more efficient code appreciated. thanks! the best way solve varies bas...

Using the same WSO2 ESB proxy service for two or more SOAP requests... is it possible? -

i have deployed proxy services in wso2 esb because have ask endpoint several responses (dataset), according different soap action. every response must set in file, set appropriate sequence in outsequence of proxy service, , sequence writes soap answer file. in way have deploy proxy service , sequence every soapaction, ask: there way deploying single proxy service given web service , using several sequences according soapaction perform? question born need implement several scheduled tasks take dataset endpoint (webservice) , write file, don't want deploy proxy service every kind of dataset have request web service! hope question clear. you not create diffrent proxies each , every soapaction. can utilize filter mediator in outsequence of single proxy , header base routing relevant vfs endpoint.

c# - Why can't I create Shared Project in Visual Studio 2015? -

Image
i downloaded visual studio community 2015. tried create shared project , getting error: content microsoft.windows.ui.xaml.csharp.targets <project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <propertygroup condition="'$(targetplatformversion)'==''"> <targetplatformversion>8.0</targetplatformversion> </propertygroup> <propertygroup condition="'$(targetplatformidentifier)' == 'uap'"> <redirectiontarget>8.2</redirectiontarget> </propertygroup> <propertygroup condition="'$(redirectiontarget)' == ''"> <redirectiontarget>$(targetplatformversion)</redirectiontarget> </propertygroup> <!-- direct 8.0 projects 8.1 targets enable retargeting --> <propertygroup condition="'$(redirectiontarget)' == '8.0'"> ...