Posts

Showing posts from July, 2014

visual studio - Azure : HOWTO/BEST-Practice : Publish WebApp with Webjob using blobs Q's to multiple destinations? -

i have webapp publish vs. have 3 publishing profiles (test, demo , production). each targets different server on azure, it's own sql behind it. added webjob using queue's , blob-storage. again test, demo , production create 3 different storage accounts. on publishing time set different connection strings sql-connection straightforward. change in publishing wizard. but connection string storage account ? how have them changed on publishing time correct environment ? if understand question : set key in app webconfig dummy values <appsettings> <add key="blobazure1" value="check azure" /> </appsettings> get connection string blob @ runtime this: cloudstorageaccount storageaccount = cloudstorageaccount.parse( cloudconfigurationmanager.getsetting("blobazure1")); inside azure panel go web app properties , set real keys inside app setting. redeploy projects , work fine. read article if have doubts windows a...

java - Jenkins execute shell on job's executor during CONFIGURATION time (and access workspace) -

i create simple jenkins plugin. basically custom build step (builder extension) dropdown list. trick want fill dropdown list result of shell script/command executed during configuration time. here method stub. public listboxmodel dofill...items(@ancestorinpath abstractproject project) { // determine workspace // project.getsomeworkspace() or project.getsomeworkspace().getremote() ... // invoke shell commands string[] results = ... listboxmodel items = new listboxmodel(); (string item : results) { items.add(item); } return items; } my questions following: if there slaves too, jenkins maintain 2 workspaces (so freshest source code exist both locations? understanding (after first build) there 2 workspaces: on master there meta informations (and source code too?), on slave there source code , build intermediates, information, artifacts. (unless extract artifacts or use copy-to-...

strategy pattern - How to access fields with StrategyPattern in Python? -

i'm trying use strategy pattern include different behaviours different sizes of simulation. i came across this implementation first example of book head first design patterns . however, don't understand , how should access data initialised in simulation. from abc import abcmeta, abstractmethod ########################################################################### ##### # abstract simulation class , concrete simulation type classes. ################################################################################ class simulation: def __init__(self, run, plot): self._run_behavior = run self._plot_behavior = plot def run(self): return self._run_behavior.run() def plot(self): return self._plot_behavior.plot() class smallsimulation(simulation): def __init__(self): simulation.__init__(self, run(), plot()) print "i'm small simulation" self.data = 'small data' ...

java - Adding a panel from a method to a frame -

i didn't know how else phrase essentially: -i have few separate "pieces" trying add onto master frame; keep code getting unwieldy have each "piece" own class. -i'm getting stuck on adding panells onto master frame, because classes aren't panels, rather method of class creates panel, creates issues don't know how solve. piece (works on own when have make dialog instead of panel): import java.awt.*; import java.awt.event.*; import javax.swing.*; public class piecething3 extends jpanel //<switched jdialog { //set variables here private actionlistener pieceaction = new actionlistener() { public void actionperformed (actionevent ae) { // action listener (this works) } }; private void createpiece() { //setdefaultcloseoperation(windowconstants.dispose_on_close); //setlocationbyplatform(true); // above commented out when switch dialog panel jpanel contentpane = new jpanel(); //something uses p...

css - Centering float:left thing vertically -

Image
i can't figure out how center float:left object vertically. imagine set position of menu bar vertically (the height of y-axis) think answer // html part <div class="menu_simple"> <ul> <li><a href="#">one</a></li> <li><a href="#">two</a></li> </ul> //css .menu_simple ul { float:left; margin: 0; padding: 0; width:100px; list-style-type: none; box-shadow: 5px 8px 5px #888888; } .menu_simple ul li { border: 1px solid #0066cc; text-decoration: none; color: white; padding: 10.5px 11px; background-color: #3b3b3b; display:block; } .menu_simple ul li a:visited { color: white; } .menu_simple ul li a:hover, .menu_simple ul li .current { ...

Adding a colored background with text/icon under swiped row when using Android's RecyclerView -

edit: real problem linearlayout wrapped in layout, caused incorrect behavior. accepted answer sanvywell has better, more complete example of how draw color under swiped view code snippet provided in question. now recyclerview widget has native support row swiping of itemtouchhelper class, i'm attempting use in app rows behave google's inbox app. is, swiping left side performs 1 action , swiping right another. implementing actions easy using itemtouchhelper.simplecallback 's onswiped method. however, unable find simple way set color , icon should appear under view that's being swiped (like in google's inbox app). to that, i'm trying override itemtouchhelper.simplecallback 's onchilddraw method this: @override public void onchilddraw(canvas c, recyclerview recyclerview, recyclerview.viewholder viewholder, float dx, float dy, int actionstate, boolean iscurrentlyactive) { recyclerviewadapter.vi...

javascript - Bootstrap Modal clickable div -

i'm trying make div clickable open modal. div has background image class on it. when click image modal pop gallery inside modal. i'm having hard time trying figure out. i'm not sure trigger goes. use bootstrap button trigger? each of "box's" has background image on them. code have far is: <div class="row no-side-padding"> <div class="col-sm-3 no-side-padding-2"> <div class="assistants-box"> <h2>assistants</h2> </div> </div> <div class="col-sm-3 five-padding-left no-padding-right"> <div class="chairs-box"> <h2>chairs</h2> </div> </div> <div class="col-sm-3 five-padding-left no-padding-right"> <div class="craft-fairs-box"> <h2>craft fairs</h2> </div> </div> <div class="col-sm-3 five-padding-left no-padding-right"> <div class="materials-box"> ...

Union of arrays over dimension names in R -

i have multiple arrays in r. each array has following structure: a. dimension names characters. b.the values in array frequency of each character. c k j d l n s 5 5 3 1 1 1 1 1 d j o h k q z r 4 4 4 3 2 2 2 1 1 1 i want combine these arrays 1 such frequency of each letter retained. desired output: c k j d l n s o h k q z r [1] 5 5 3 1 1 1 1 1 0 0 0 0 0 0 0 [2] 0 0 4 3 4 0 0 0 4 2 2 2 1 1 1 how can done? try un1 <- union(names(v1), names(v2)) res <- do.call(rbind,lapply(list(v1, v2), function(x) setnames(x[match(un1, names(x))], un1))) res[is.na(res)] <- 0 res # c k j d l n s o h q z r #[1,] 5 5 3 1 1 1 1 1 0 0 0 0 0 0 #[2,] 0 2 4 3 4 0 0 0 4 2 2 1 1 1 or res1 <- as.matrix(merge(as.data.frame.list(v2), as.data.frame.list(v1), all=true)[un1]) res1[is.na(res1)] <- 0 res1 # c k j d l n s o h q z r #[1,] 5 5 3 1 1 1 1 1 0 0 0 0 0 0 #[2,] 0 2 4 3 4 0 0 0 4 2 2 1 1 1 ...

Finding 2 highest value in a row using mysql -

i have numbers 5, 3, 1, 8, 7 in row in mysql table , each number belongs column. how find 2 highest number , find sum? assuming table name coltb , has following successive columns col1,col2,col3,col4,col5 you can issue following statement 2 highest numbers: select col1 coltb union select col2 coltb union select col3 coltb union select col4 coltb union select col5 coltb order col1 desc limit 2;

sql - How to insert CLOB more then 1 Mb (1kk characters) in Oracle by script -

how insert clob more 1 mb (1kk characters) in oracle script exmpl. using pl slq, maybe append parts less 32767 bytes(chars). bypass problem: "pls-00172: string literal long". here target table: create table qon (x clob); here code throws error: declare l_clob clob := '32769 chars+ '; begin in 1..2 loop insert qon (x) values (empty_clob()) --insert "empty clob" (not insert null) returning x l_clob; -- can append content clob (create 400,000 bytes clob) j in 1..3 loop dbms_lob.append(l_clob, rpad ('',4000,'')); --dbms_lob.append(l_clob, 'string chunk inserted (maximum 4000 characters @ time)'); end loop; end loop; end; sorry, tomorow correct. idea - somehow insert string more 32767 urls i'm searched: oralce clob can't insert beyond 4000 character? how query clob column in oracle http://www.oradev.com/dbms_lob.jsp how w...

php - Phalcon v.1.3. Model's onConstruct does not fire after unserialize -

phalcon 1.3 mvc model docs say: the initialize() method called once during request, it’s intended perform initializations apply instances of model created within application. if want perform initialization tasks every instance created can ‘onconstruct’ i have model class gets serialized , implements onconstruct(): class book extends \phalcon\mvc\model { protected $a; protected $b; function onconstruct() { $this->a = 1; } function initialize() { $this->b = 2; } } multiple instances of book stored in memcached , loaded individually within same request. the problem upon read memcached (i.e. unserialization) book 's onconstruct never gets called. i have noticed when unserializing more 1 book in row, initialize() gets called first instance (which correct, according docs). however, when book #2 loaded memcached, it's $b property null (expected 2, docs say: "apply instances of model"). question...

c# - Restrict generic T to specific types -

i have following method: public static iresult<t, string> validate<t>(this t value) { } // validate how can restrict t int16, int32, int64, double , string? you can't restrict generics in way, can choose single class constraint. must either make 5 overloads or find interface 5 of things share , use that. option choose depend on validate doe. here how overloads. public static iresult<int16, string> validate<t>(this int16 value) { } // validate public static iresult<int32, string> validate<t>(this int32 value) { } // validate public static iresult<int54, string> validate<t>(this int64 value) { } // validate public static iresult<double, string> validate<t>(this double value) { } // validate public static iresult<string, string> validate<t>(this string value) { } // validate here using common interface, of members list implement iconvertible restrict that, allow iconvertible not 5 list...

c# - Variable value assign and retrieve -

how variable assigning (setting) , retrieve value works in background? example: { int myvalue; myvalue = 5; //here assign value (set) console.writeline(myvalue); // here retrieve value } so here first declare value. in next line assign value (does work same way setting property). also, when retrieving value, work same way in properties. next question: if have textbox control, has text property. lets say, name of text box control mytextbox . mytextbox.text = "michael"; // here set value string result = mytextbox.text; // here retrieve (get) value does works same { get; set; } method in fields-properties? you can @ il if want. here's simple sample using linqpad: void main() { int ; i=5 ; i.dump(); i_p = 6; i.dump(); } // define other methods , classes here public int i_p {get; set;} and here's il it: il_0000: nop il_0001: ldc.i4.5 il_0002: stloc.0 // il_0003: ldloc.0 // il_0004: c...

javascript - Chrome App doesn't load dynamic script -

i trying load javascript file dynamically using jquery.getscript in chrome app. script file residing in local application package directory. unfortunately, it's giving error: refused execute inline script because violates following content security policy directive: "default-src 'self' chrome-extension-resource:". either 'unsafe-inline' keyword, hash ('sha256-dwkwwwx2ujo8oy5zliq4qwwahk2h3hap48rowlzjcno='), or nonce ('nonce-...') required enable inline execution. note 'script-src' not explicitly set, 'default-src' used fallback. is there workaround this?

How to Proxy a Promise in JavaScript es6 -

i'm trying proxy promise in native firefox (and using babel). var prom = new promise(function(resolve, reject){resolve(42)}); var promproxy = new proxy(prom, {}); promproxy.then(function(response){console.log(response)}); this doesn't work, 'typeerror: 'then' called on object not implement interface promise.' you need have handler implement get() trap , return bound version of prom.then var prom = new promise(function(resolve, reject){resolve(42)}); var promproxy = new proxy(prom, { get: function(target, prop) { if (prop === 'then') { return target.then.bind(target); } } }); promproxy.then(function(response){console.log(response)}); note if want proxy all accessors, get function this: var promproxy = new proxy(prom, { get: function(target, prop) { var value = target[prop]; return typeof value == 'function' ? value.bind(target) : value; } }); bind ensure function won't inc...

android - Position toolbar on layout using material design -

Image
i have 3 doubts related layout , styles: need position toolbar in specific position, need add shadows on text, , need add more action buttons. the image describe problem: i have 2 "toolbar"s in layout, 1 on top, , 1 need stay before picture. did try lot of things, dont work! this layout: <android.support.design.widget.appbarlayout android:id="@+id/appbar" android:layout_width="match_parent" android:layout_height="@dimen/detail_backdrop_height" android:theme="@style/themeoverlay.appcompat.dark.actionbar" android:fitssystemwindows="true"> <android.support.design.widget.collapsingtoolbarlayout android:id="@+id/collapsing_toolbar" android:layout_width="match_parent" android:layout_height="match_parent" app:layout_scrollflags="scroll|exituntilcollapsed" android:fitssystemwindows="true" ...

javascript - Extracting info from a JSON: P5.js -

my php script json_encodes this: [{"x":"20","y":"24","name":"newnov"},{"x":"20","y":"70","name":"tito"}] but can't see how can extract information in p5.js program? say, need use 'x', 'y', 'name' draw circle in appropriate place right name. i used loadjson in script, , have variable - data = loadjson() but how get, say, 'x' component json? var radius; function preload() { var url = 'http://localhost/planettrequest.php'; radius = loadjson(url); } function setup() { createcanvas(300, 300); background(153); noloop(); } function draw() { background(200); textsize(15); text(radius.x, 10, 30); fill(0, 102, 153); } thanks comments above, that's worked in end: var data; function preload() { var url = 'http://localhost/planettrequest.php'; data = loa...

Sage Pay Forms V3.00 AES-128 Encryption VB.Net -

i thought post did not find off-the-shelf solution aes encryption needed v3.00 upgrade. the sagepay c# solution example reason did not have have encryption/decryption code example in far see. i cobbled code existing posts , rijndaelmanaged class vb example ( https://msdn.microsoft.com/en-us/library/system.security.cryptography.rijndaelmanaged(v=vs.110).aspx?cs-save-lang=1&cs-lang=vb#code-snippet-1 ).... imports system.security.cryptography public shared function aesencryption(byval strcrypt string) string dim keyandivbytes [byte]() = utf8encoding.utf8.getbytes(strencryptionpassword) ' create new instance of rijndaelmanaged ' class. generates new key , initialization ' vector (iv). using aes new rijndaelmanaged() ' set mode, padding , block size key aes.padding = paddingmode.pkcs7 aes.mode = ciphermode.cbc aes.keysize = 128 aes.blocksize = 128 ...

javascript - JQuery not running from PHP echo -

i trying execute simple jquery commands in echo statement php after user submits log in form. the user able log in correct credentials, if enter incorrect ones should show invalid credentials paragraph. here code: <?php //php code login in, working, not needed show echo 'testing <script> $( ".wrong" ).show( "slow" ); </script>'; ?> <!doctype html> <html> <head> <script src="//code.jquery.com/jquery-1.10.2.js"></script> </head> <body class="login"> <form action="" method="post" class="login-form"> <p class="wrong" style="display: none;">invalid credentials</p> <a class="link" href="#">forgot password?</a> <button type="submit" class="login-btn" name="submitlogin">log in</button...

Is there a python set deleting method that returns a value if the value you want to delete is not in the set? -

is there deleting method deleting element of set takes parameter return if there no element delete matches parameter gave delete? so set.discard(a,b) parameter want delete , b parameter gets returned if not found. something this? def _discard(s, key, ret): try: s.remove(key) except keyerror: return ret return key s = set([1,2,3]) ret = "not found" key = 4 print _discard(s, key, ret), s key = 3 print _discard(s, key, ret), s

Compiling a Qt Application using Dev C++ on Windows -

i wrote small qt application in dev-c++ shown: #include <qapplication> #include <qlabel> int main(int argc,char *argv[]) { qapplication app(argc,argv); qlabel *label = new qlabel("hello qt!"); label->show(); return app.exec(); } i quite sure i've done necessary start creating qt applications such install qt5.3.2, setup system environment variables, etc. however, when trying compile program in dev-c++, error saying: [error]: qapplication: no such file or directory after closely following instructions other tutorials, still cannot program compile. what doing wrong? dev-c++ based on mingw, should install qt compiled mingw on windows. indeed should use qmake generate makefiles. compilation should use make utility provided mingw distribution shipped dev-c++ (the name of utility might not 'make' in mingw)

cmd - Batch file to search common strings in two text files -

i have 2 text files, all_codes.txt , downloaded_codes.txt wanted compare both text files , log if string missing in downloaded_codes.txt >all_codes.txt have below strings a1 a2 a3 > downloaded_codes.txt have below strings a1 a3 in example, a2 missing in downloaded_codes.txt , want log "no" in log.txt if a2 present in downloaded_codes.txt ,then want log "yes" in log.txt this tried, not getting proper result: @echo off setlocal enabledelayedexpansion / f "delims=~" % % h in (all_codes.txt) % % in (downloaded_codes.txt) do( set found = false / f "skip=2 tokens=*" % % b in ('findstr /i "%%h" "%%a"') do( if "!found!" == "false" ((echo yes > log.txt else(echo no > log.txt) set found = true )) ) @echo off findstr /v /g:downloaded_codes.txt all_codes.txt > nul (if errorlevel 1 (echo yes) ...

java - Find out number of words in file that do not match any word in the String array -

i trying create program reads data file. want each time check if next word file matches specific word specific string array. each time words don't match, want keep track of times (wrong++) , print number of times words file didn't match @ least 1 word string array. here program: public class main_class { public static int num_wrong; public static java.io.file file = new java.io.file("text.txt"); public static string[] valid_letters = new string[130]; public static boolean wrong = true; public static string[] sample = new string[190]; public static void text_file() throws exception { // create scanner read file scanner input = new scanner(file); string[] valid_letters = { "i", " have ", " got ", "a", "date", "at", "quarter", "to", "eight", "8", "7:45", "i’ll", "see...

indic - Google input tools for sinhala language source code -

i interested in google input tools sinhala language. used google unable find source code this. anyway, found this . chinese language. know can find google input tools sinhala language or other language hindi or how can use above chinese toolkit sinhala language?

python - How to serve clojurescript over flask -

i have small flask app , want use clojurescript enhance user experience on client-side. now have trouble serving clojurescript via flask, paths mixed up. flask asserts static files javascript scripts lie in directory static . have changed project.clj compile target put there: :output-to "static/plot.js" :output-dir "static" unfortunately, when loading file, cannot load dependent files goog.require : "clojurescript not load :main, did forget specify :asset-path?" i believe missing leading /static instead of static in paths. can specify prefix leiningen cljsbuild or clojurescript inlcudes? you need specify :asset-path in compiled options (as error message suggests). https://github.com/clojure/clojurescript/wiki/compiler-options#asset-path when using :main necessary control entry point script attempts load scripts due configuration of web server. :asset-path relative url path not f...

ruby - how to rails one to one relationship? -

i new rails. please me how create rails 1 one relationship. have 2 table abc , pqr. in models have declared has_one:pqr in abc model , belongs_to:abc in pqr model. don't know how write view , controller "pqr". you use bin/rails generate controller pqr hello it generate controller file, view file, functional test file , helper view,. more information have @ this article . exists app/controllers/ exists app/helpers/ create app/views/pqr exists test/functional/ create test/unit/helpers/ create app/controllers/pqr_controller.rb create test/functional/pqr_controller_test.rb create app/helpers/pqr_helper.rb create test/unit/helpers/pqr_helper_test.rb create app/views/pqr/hello.html.erb you can add contents used view, @ action hello in controller pqr_controller.rb class pqrcontroller < applicationcontroller def hello @content = "hello world" end end then if want other action , view corresponding later...

https - wget ssl alert handshake failure -

i trying download files https site , keep getting following error: openssl: error:14077410:ssl routines:ssl23_get_server_hello:sslv3 alert handshake failure unable establish ssl connection. from reading blogs online gather have provide server cert , client cert. have found steps on how download server cert not client cert. have complete set of steps use wget ssl? tried --no-check-certificate option did not work. wget version: wget-1.13.4 openssl version: openssl 1.0.1f 6 jan 2014 trying download lecture resources course's webpage on coursera.org. so, url this: https://class.coursera.org/matrix-002/lecture accessing webpage online requires form authentication, not sure if causing failure. it works here same openssl version, newer version of wget (1.15). looking @ changelog there following significant change regarding problem: 1.14: add support tls server name indication. note site not require sni. www.coursera.org requires it. , if call wget -v --debu...

c++ - Fit the width of the view to longest item of the QComboBox -

Image
i've got qcombobox contains long strings. long means strings wider width of qcombobox on gui . in case qt display items in way: previously working matlab has less user friendly gui drop-down list think matlab solution better: is there easy way achieve similar result in qt or have setup custom model , view purpose ? i've done few years back. should working fine. //determinge maximum width required display names in full int max_width = 0; qfontmetrics fm(ui.comboboxnames->font()); for(int x = 0; x < nameslist.size(); ++x) { int width = fm.width(nameslist[x]); if(width > max_width) max_width = width; } if(ui.comboboxnames->view()->minimumwidth() < max_width) { // add scrollbar width , margin max_width += ui.comboboxnames->style()->pixelmetric(qstyle::pm_scrollbarextent); max_width += ui.comboboxnames->view()->autoscrollmargin(); // set minimum width of combobox drop down list ui.combobo...

Create chart online with c#? -

i'm number textbox value changing. now, want create chart same values. means create online chart. did not find answered in searching sites please me... there many chart template c# in code project here https://www.google.com/webhp?sourceid=chrome-instant&ion=1&espv=2&ie=utf-8#q=chart%20in%20c%23%20site%3acodeproject.com

jsf - Submit form without attached file -

i want create jsf form attached file. give option form users submit without attach file. don't want mandatory. <h:form id="form" enctype="multipart/form-data"> <div class="string"> <label class="name"> <h:inputtext id="name" value="#{contacts.name}" pt:placeholder="name*:"/> </label> </div> <label class="message"> <h:inputtextarea value="#{contacts.comment}" pt:placeholder="comment*:"/> </label> <h:inputfile id="filetoupload" value="#{contacts.file}" required="true" requiredmessage="no file selected ..."/> <h:commandbutton value="upload" action="#{contacts.upload()}"> <f:ajax exec...

sql correct but in php it skips the first result -

i use this: foreach ($result $row) { $row["testid"], $row["subject"], ... }; output values. sql works fine when go page shows me output without first element in array. example if have 5 tests show user shows test 2, 3, 4 , 5 not first 1 in array $result. code (sorry it's in dutch): require_once( "common.inc.php" ); require_once( "dataobject.class.php" ); class statistiekaanpassen extends dataobject { public function toetsen() { $conn = parent::connect(); $order = isset( $_get["order"] ) ? preg_replace( "/[^ a-za-z]/", "", $_get["order"] ) : "toetsid"; /*sql om alle toetsen op te halen*/ $sql = "select toetsid, onderwerp, puntentotaal, vak toets not exists (select * leerlingtoets toets.toetsid = l...

Matlab: Using 'dlmwrite' in a Loop -

suppose dlmwrite command has been used follows ( period vector): period=[10;20;30;40;50;60;70]; dlmwrite('parameters.tcl',['set tn {',num2str(period(n)),'}',''],'delimiter','','-append'); the output of above code n=1, writes below text in 'parameters.tcl': set tn {10} now, want use dlmwrite in loop. example if n=2, wand output should be: set tn {10 20} if n=3: set tn {10 20 30} and on. how do?! replace following fragment: num2str(period(n)) with following: strjoin(cellstr(num2str(period(1:n))), ' ')

playframework - Advanced HTTP server configurations in Play 2.3 -

i using play 2.3 develop application. i need set http.netty.log.wire true default false specified in play documents. in below link (last section) says option available specifies "we cannot use application.conf" specify this. https://www.playframework.com/documentation/2.3.x/productionconfiguration if cannot specify in application conf, how can specify this? thanks you need pass options in command line: /path/to/your/app/bin/yourapp -dhttp.netty.log.wire=true

What is the difference between a[n+1] and a[n]+1 inside an array? -

i looked , looked on website find answer couldnt find anywhere. however, difference? here think. say have array 5 elements in it, a[5]. a[n+1] second element, a[n+2] third, etc. a[n]+1 be, type in number first element [n]. number 27, since a[n]+1 equal 28. a[n]+ 1 takes value a[n] , adds 1 it. a[n+1] takes value of n , adds 1 it. bothe different in meaning context. a[n+1] index increment , value retrieval specified list , index . a[n] + 1 value retrieval specified list , index adding 1 it. for example, a = [1,2,3,4,5] n = 2 a[n+1] a[2+1] => a[3] => 4 a[n] + 1 a[2] + 1 => 3 + 1 => 4

How do I compare dates using Eloquent in Laravel? -

when run code, $entry_id = entry::where(function($q)use($intern,$input){ $q->where('interna_id',$intern['id']); $q->where('created_at','=','2015-06-06'); })->first(['id']); it gives select `id` `entries` (`interna_id` = 1 , `created_at` = 2015-06-06) limit 1 and can see, date not enclosed in '' . causes problem , mysql not able find record. example, if add '' , so, select `id` `entries` (`interna_id` = 1 , `created_at` = '2015-06-06') limit 1 the query able retrieve correct record. note:the created_at using date format, not datetime created_at of type date laravel. uses carbon package , expects such object. have like: $entry_id = entry::where(function($q)use($intern,$input){ $q->where('interna_id',$intern['id']); $q->where('created_at','=', car...

mysql - two condition after where clauses -

i have query not working $lokesh = "select * license_info mac_id='$mac_id' , admin_user_name='$admin'"; in above query selecting record macid , admin_user_name matched but while echo sql query show output like select * license_info mac_id='0800279020f2' , admin_user_name='sanjay ' last single quotes printing in below line not able retrive record. reason of printing single quotes in below line the reason variable $admin contains newline in end. remove , there no problem this. you will, however, have possible sql injection attack. use parameters, not inline values.

jsp - Custom 404 error page not displayed -

i trying give custom error page application pagenotfound or nullpointerexception using below code, web.xml : <?xml version="1.0" encoding="utf-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemalocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="webapp_id" version="3.0"> <display-name>raptor 1-5</display-name> <welcome-file-list> <welcome-file>loginpage.jsp</welcome-file> </welcome-file-list> <error-page> <error-code>404</error-code> <location>/404errorpage.jsp</location> </error-page> <error-page> <exception-type>pagenotfoundexception</exception-type> <location>/404errorpage.jsp</location...

Is there a one step method of activating beta testers on iOS using Fabric? -

we're using fabric (crashlytics) our app beta testers. not utility app, friction in beta distribution/acceptance process unhelpful. the process today is: (1) send invite (2) user accepts invite, sends uuid. don't experience app @ stage. (3) build created additional uuids etc (4) users new release emai), install, , use app. many days can pass between (1) , (4). takes many reminders folks (understandably busy) click second invite ("didn't already?"). is there better way? without app store approval process? related question, not satisfying answers: add more beta testers app through crashlytics beta the other option enterprise account apple, let create in house provisioning profile lets people run app without having add uuid. however, there limitations. apple's enterprise dev program homepage.

excel - Best ways of getting tables from R into Libre Office Writer? -

currently, work flow statistics , data restructuring in r , write documents using libre office (lo) writer. results analyses in r tables , need these lo writer. have not found way directly in easy way, is: 1) put table in r, 2) export table .csv, 3) open .csv in lo calc, 4) copy lo calc lo writer using paste special rtf. when saving .csv, doing using write.csv(table_1, "table_1.csv", na = "") . results in step because lo calc needs know how read .csv file. alternatively, 1 can install 1 of packages outputting .ods or .xls(x). one problem doing way results in long decimal numbers in file, e.g. 2.21931, whereas 1 typically wants show 2 or 3 digits in document. have found 2 solutions annoyance. the first round numbers in r using e.g. round(table_1, 2) , saving using above command. problem when 1 imports lo calc, numbers .60 become .6, losing (redundant) digit. makes inconsistent presentation. 1 can add them either in table in document or using rounding func...

ide - IntelliJ IDEA Won't let me choose Font. Also kerning Unbearable. Are these related? -

Image
i can't change font in intellij idea (just started trying use it). can't figure out why kerning absolutely terrible, related. here's i'm talking about, in file -> settings -> editor -> colors & fonts -> font. the only thing can change related fonts scheme name . kerning okay default. i wanted use different font , dark theme though. other option darcula. may experience below, kerning raise blood pressure. how can fix this? on windows 7 x64, intellij idea 14.0.2 you have create new schema in order choose font. click "save as..." button save preset , customize it.

Java - converting byte[] to int not giving result -

i have hexbinary of 4 bytes follows: ffffffc4 it should return big following function gives -60: public static int bytearraytoint(byte[] b) { return b[3] & 0xff | (b[2] & 0xff) << 8 | (b[1] & 0xff) << 16 | (b[0] & 0xff) << 24; } why doesn't work? doing wrong? the primitive type int 32-bits long , significative bit sign. value ffffffc4 has msb set 1 , represents negative number. you can "something big" using long instead of int : public static long bytearraytoint(byte[] b) { return (((long) b[3]) & 0xff) | (((long) b[2]) & 0xff) << 8 | (((long) b[1]) & 0xff) << 16 | (((long) b[0]) & 0xff) << 24; }

notifications - Chrome, recognize open tab -

i'm creating extenstion google chrome perform checking if stream on twitch.tv online , notify user evey x minutes, got covered. i'm looking jscirpt code recognize if user on streamers channel , stop notifying him. var username="$user"; setinterval(check,300000); function check() { request("https://api.twitch.tv/kraken/streams/" + username, function() { var json = json.parse(this.response); if (json.stream == null) { chrome.browseraction.seticon({ path: "offline.png" }); } else { notify(); } }); return 1; } function notify(){ var opt = {type: "basic",title: username + " streaming!",message: "click join!",iconurl: "start.png"}; chrome.notifications.create("", opt, function(notificationid) { settimeout(function() { chrome.noti...

java - button.setPressed(true) suddenly not working -

i have been using emulator following code press particular button redbut.performclick(); redbut.setpressed(true); redbut.invalidate(); redbut.setpressed(false); redbut.invalidate(); using log statements, know sure piece of code being called, not code being skipped over. on emulator, button appeared pressed if user pressed it. on real android device, process running button unchanged. problem? write code follows- redbut.performclick(); redbut.setpressed(true); redbut.invalidate(); new handler().postdelayed(new runnable() { @override public void run() { redbut.setpressed(false); redbut.invalidate(); } }, 500);

javascript - How to remove undefined and null values from an object using lodash? -

i have javascript object like: var my_object = { a:undefined, b:2, c:4, d:undefined }; how remove undefined properties? if want remove falsey values compact way is: _.pick(obj, _.identity); for example (lodash 3.x): _.pick({ a: null, b: 1, c: undefined }, _.identity); >> object {b: 1} for lodash 4.x: _.pickby({ a: null, b: 1, c: undefined }, _.identity); >> object {b: 1}

excel vba - VBA Autofilter by whether a cell contains a number formatted as a string -

so writing macro sorts through sheet columns , clears cells containing kinds of data, if numeric. existing code catch number fields , clear them: selection.autofilter field:=(i + 1), criteria1:=">0" range(cells(2, i), cells(70000, + 1)).select selection.clear worksheets("sheet1").showalldata selection.autofilter field:=(i + 1), criteria1:="=0" range(cells(2, i), cells(70000, + 1)).select selection.clear worksheets("sheet1").showalldata which works fine cells contain numbers in number format. of cells contain numbers formatted strings, ie what ="80" would produce when typed excel. need create criteria autofilter recognizes if cell contains number formatted string, dont know how, since criteria:=">0" , criteria:="=0" ignored strings. another way :) have commented code if still have questions, feel free post back. sub sample() dim rng range '~~...

Android repeating alarm not repeating correctly -

i have alarm wanting repeat around every 5 minutes. testing purposes, have set repeat once every 5 seconds instead, such: alarmmanager alarmmanager = (alarmmanager)getactivity().getsystemservice(getactivity().alarm_service); intent intent = new intent(getactivity(), coordinatealarmreceiver.class); pendingintent pendingintent = pendingintent.getservice(getactivity(), 1, intent, 0); int repeatseconds = 5; alarmmanager.setinexactrepeating(alarmmanager.rtc_wakeup, system.currenttimemillis(), repeatseconds * 1000, pendingintent); and receiving intentservice prints log statement when receives alarm. however, fires around once every minute , half instead of once every 5 seconds, set incorrectly? have tried using setrepeating() instead of setinexactrepeating() same results. here alarm receiver: public class coordinatealarmreceiver extends intentservice { public coordinatealarmreceiver(){ super("coordinatealarmreceiv...