Posts

Showing posts from April, 2013

Android Admob SDK AdUnitID for Google play release -

i have used android admob sdk android studio.and test banner ad displayed on app. here used ad unit id developer document . can use same adunitid when release app on google play alpha release? can use same adunitid when release app on google play production release? still didn't created admob account (or) adsense account. have google wallet account, created when register on google play. shall need create admob account , adsense account? or wallet account enough credit on account. i have put smart banner ad on app, in basis money credit me,either based on impressions or need touch ad. is other important point need do,before alpha release (or) production release on google play. i have pasted code below reference. mainactivity.java public class mainactivity extends baseactivity{ @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); adview eadview=

java - HTTP POST using CURL in Linux -

help needed on finding corresponding curl command syntax corresponding below java code works. working java code> httppost httppost = new httppost("/semp"); httppost.addheader("authorization", "basic u1zdllnptfjprte6anvxmmffdvc="); stringentity stringentity = new stringentity("<rpc>command</rcp>", "utf-8"); stringentity.setcontenttype("text/xml"); httppost.setentity((httpentity)stringentity); closeablehttpresponse response = httpclient.execute(targethost, (httprequest)httppost, localcontext); corresponding curl syntax needed? please on corresponding syntax curl thanks in advance. check curl man page. -u section.

PowerMockito.whenNew not working on android's Intent class -

i trying use mock intent object when using whennew powermockito, not able mock constructor. have tried possible combination of arguments, doesn't work. i had similar problem, , solution found in answer . to more specific: please try add @preparefortest annotation @ test or @ class level, , provide class constructs intent . public class someclassthatcreatesintent { public void somemethodwithintent() { intent = new intent(); } } and test class should this: @runwith(powermockrunner.class) @preparefortest({someclassthatcreatesintent.class}) public class someclassthatcreatesintenttest { @test public void test() { // test uses powermockito.whennew(intent.class) } } hope help.

IntelliJ IDEA 14.1.4 + Gradle: Cannot Compile Groovy Files -

each time attempt create new intellij 14.1.4 project on windows gradle integration receive following error during 'make' command when have groovy source files included in project... error:cannot compile groovy files: no groovy library defined module 'gradlecommandline' i have tried: creating gradle project through new project wizard in intellij, choosing groovy 'additional library' creating new gradle project outside of intellij using gradle init --type groovy-library command, opening intellij finds gradle.build file , automatically links project converting existing project working ivyidea plugin gradle build i have tried adding (made sure) groovy-all library 'global library' within project structure each of these gave me same 'cannot compile groovy files' error. what work: i can run gradle war command compiles correctly , can deploy build war application server (in case tomcat 7.0.47) however in watching getting starte

sql server - SQL Agent job history not found for few jobs - Database Administrators Stack Exchange

i have;backup ,rebuild indexes , update stats , few other jobs space alerts, replication jobs etc run on sql server 2102-sp2, build number:11.0.5058.0 and not see log sucess/failure few jobs : exec msdb.dbo.sp_help_jobhistory @job_name = n'database_full_backup_daily11pm' ; go--no log of sucess or fail, but job ran , see backup files stored on backup location , see database last backup taken date yesterday 11pm and there no other backup jobs running @ backup job uses custom script not maintenance plans owner of job same jobs jobs enabled. not see history via right click on job -view history also. see agent-properties-history--limit size 1000, 100 chosen but few below, see history exec msdb.dbo.sp_help_jobhistory @job_name='replication agents checkup' go----i see history exec msdb.dbo.sp_help_jobhistory @job_name = n'distribution clean up: distribution' ; go----i see history what wrong here ? ideas experts? please help

sql - MySql UPDATE statement with SELECT summarizing data from table 2 -

i have 2 tables, table has columns token (primary key) , downtime ( int ), table b has columns token , status ( enum 3 states: active , unstable , inactive ), duration ( int ). i want sum duration table b, states unstable , inactive . , after that, assign result column downtime , table a. so, example, table ======= token downtime -------------------------- bv87pxicnrtk8pw null v3525kq2kzihb9u null table b ======= token state duration ------------------------------------------ v3525kq2kzihb9u active 9 v3525kq2kzihb9u unstable 20 v3525kq2kzihb9u inactive 60 bv87pxicnrtk8pw unstable 11 bv87pxicnrtk8pw active 140 bv87pxicnrtk8pw inactive 40 result ====== token downtime -------------------------- bv87pxicnrtk8pw 51 v3525kq2kzihb9u 80 i tried update set downtime = (select sum(duration) b state != '

laravel - php artisan make:middleware OldMiddleware returns 'there are no commands defined in the 'make' namespace -

i'm trying create middleware in laravel 4.2 when run php artisan make:middleware oldmiddleware it returns 'there no commands defined in 'make' namespace' however migrate command works when run php artisan list it shows me list of command there no 'make' command indeed ? i got command : php artisan make:middleware oldmiddleware official laravel website - make:middleware artisan command added in laravel 5.0 . seems you're running older version of laravel. if want use command, upgrade laravel 5.0 .

python - How can I create an efficient hash function for a a list of numbers with a range of over a billion? -

i writing script in python , attempting create hash table 647050 values (most values occur twice, no more 3-4 times) taken column of csv file. have incredible range minimum value being 651 , maximum being 2147477024 . how can create efficient hash function can place 647050 values range of 2147476373 hash table in sensible amount of time? and how might structure code? for example have tried simple (but messy) hash function below slows such crawl haven't allowed complete. timed different intervals of values added hash table see exponential slow down (it doesn't slow down absolute crawl until on 640000 keys have been processed). the values initialized 0 : def hash_function(value): hash_key = value % 647050 return hash_key def is_inserted(hash_table, hash_key, num): if hash_table[hash_key] == 0: hash_table[hash_key] = num return true return false def insert(hash_table, hash_key, num): current_hash = hash_key inserted = fa

android - Phonegap / Cordova Filetransfer - acessing option param values from java servlet -

how access options.param values , upload imageuri java servlet . below phonegap code upload imageuri java servlet captured camera. var options = new fileuploadoptions(); options.filekey="file"; options.filename=imageuri.substr(imageuri.lastindexof('/')+1)+'.jpg'; options.mimetype="image/jpeg"; options.params = { value1: 10, value2: 30 } var ft = new filetransfer(); ft.upload(imageuri, encodeuri("http://myserver/uploadimagefile"), fileuploadsucess, fileuploadfail, options); http://myserver/uploadimagefile java servlet path, can 1 provide me sample code. just them on dopost req.getparameter @override protected void dopost(httpservletrequest req, httpservletresponse resp) throws servletexception, ioexception { string value1 = req.getparameter("value1"); string value2 = req.getparameter("value2"); }

date - Linux local versus UTC time in seconds -

can please explain wrong these 2 syntax getting elapsed time in seconds? if run both these commands @ same time: date -u +%s # - utc - returns e.g. 1303430843. date +%s # - local time - mine set pacific time # - returns e.g. 1303430843 i same number (e.g. 1303430843) of seconds, no difference, yet expect 25200 seconds - 7 hours difference, if run: date -u "+%y-%m-%d %h:%m:%s" # returns: 2011-04-22 00:01:14 date "+%y-%m-%d %h:%m:%s" # returns: 2011-04-21 17:01:14 - 7 hours difference what catch here? thank you from man page: %s seconds since 1970-01-01 00:00:00 utc so %s returns time in seconds since specific point in time specified in utc, means not affected timezones @ all.

android - Error in colors.xml -

<?xml version="1.0" encoding="utf-8"?> <!-- /* ** ** copyright 2012, android open source project ** ** licensed under apache license, version 2.0 (the "license"); ** may not use file except in compliance license. ** may obtain copy of license @ ** ** http://www.apache.org/licenses/license-2.0 ** ** unless required applicable law or agreed in writing, software ** distributed under license distributed on "as is" basis, ** without warranties or conditions of kind, either express or implied. ** see license specific language governing permissions , ** limitations under license. */ --> <resources xmlns:android="http://schemas.android.com/apk/res/android"> <!-- color resources icecreamsandwich theme. base color = 33b5e5 --> <!-- android:color/holo_blue_light value #ff33b5e5 --> <color name="highlight_color_ics">#ff33b5e5</color> <color name="typed_word_color_i

html - Search box when you type in the name, contact info will appear using PHP -

search box when type in name, contact info appear using php. i'm using "include" partial in website. page put code "index.php?section=contact" become site 'contact' page. <?php if (isset ($_get["name"])) { $phone = $_get["name"]; } else { $phone = ""; } $name = array ("naszrul 012-3456789"=>"naszrul","badarudin 012-3456788"=>"badarudin") ?> <div id="content"> <form method="get" action="_contact.php"> name: <input type="text" name="name"> <input type="submit"> </form> <br> <?php echo array_search ("$phone",$name); ?> </div> in _contact.php (which contact page partial) file, put code. instead of showing both _contact.php + index.php

Git plugin RAD not working -

Image
i have rad 8.5.5.2 , trying install git using http://download.eclipse.org/egit/updates site. getting following error can please help. cannot complete install because 1 or more required items not found. software being installed: eclipse git team provider 4.0.1.201506240215-r (org.eclipse.egit.feature.group 4.0.1.201506240215-r) missing requirement: eclipse git team provider 4.0.1.201506240215-r (org.eclipse.egit.feature.group 4.0.1.201506240215-r) requires 'org.eclipse.core.runtime [3.7.0,4.0.0)' not found screen shot attached selection made install. your rad 8.5.5.2 based on eclipse 3.6 (juno). check reference table "what versions of eclipse egit target?" in egit faq . egit 2.1 latest version supported in eclipse 3.6; try update site link: http://archive.eclipse.org/egit/updates-2.1 to try install egit 3.7.0 or older, can use update site link: http://download.eclipse.org/egit/updates-3.7

ios - iOS7 , In CollectionView , When will this method be called? layoutAttributesForElementsInRect: -

i'm new ios developer. recently i'm learning uicollectionview , i'm trying subclass uicollectionviewlayout. i have implement method -(nsarray*)layoutattributesforelementsinrect:(cgrect)rect question i have no idea did rect come from? , in scenario rect passed me ? ps. think method might more easy understand - (uicollectionviewlayoutattributes *)layoutattributesforitematindexpath:(nsindexpath *)path because indexpath limited , finite , configure cell in particular indexpath reasonable. but rect might infinite , have no idea rect came from. when creating layout subclass must override both methods. the layoutattributesforitematindexpath tells collection-view layout attributes cell @ specific index-path. must use cells. the layoutattributesforelementsinrect gets called system rectangle contains "visual elements" displayed in - cells, supplementary or decoration views. think of part of collection-view that's displayed. tells

image processing - DICOM Deflated Explicit VR Little Endian (1.2.840.10008.1.2.1.99) -

how data in transfer syntax organized? description standard: this transfer syntax applies encoding of entire dicom data set. entire data set first encoded according rules specified in section a.2. entire byte stream compressed using "deflate" algorithm defined in internet rfc 1951. initially took mean entire dicom file gzipped. if entire file gzipped, including header contains identifying transfer syntax, how parser/viewer able read transfer syntax know gzipped? from perspective of viewer given file of type, how can know of transfer syntax? gzip header? are there publicly available sample images use transfer syntax? for examples pointed @springfield762, each of _dfl files had valid deflate stream 300-some-odd bytes 8 bytes end. each decompressed length of corresponding file in archive without _dfl suffix, data not same. there additional decoding needed decompressed data original. image_dfl has deflate stream starts @ offset 334, report_dfl

gorm - Grails 3 - Add dynamic method from plugin using traits - not working -

i followed user guide add dynamic method controllers using trait plugin. the following code: ---trait--- package com.ylw.gorm trait datetrait { date currentdate() { return new date() } } ---traitinjector--- package com.ylw.gorm import grails.compiler.traits.traitinjector import groovy.transform.compilestatic @compilestatic class controllertraitinjector implements traitinjector { @override class gettrait() { datetrait } @override string[] getartefacttypes() { ['controller'] string[] } } ---controller--- @transactional(readonly = true) class mydomaincontroller { static allowedmethods = [save: "post", update: "put", delete: "delete"] def testtrait() { render "the current date -> " + currentdate() } ... } i expecting controller know currentdate() method trait. got following error in browser: caused missingmethodexception: no signature of method: com.ylw.gorm.mydomaincontroller.currentdate

asynchronous - C# Stopwatch to time an async/await method inaccurate -

i'm writing performance tests, , want able time method asynchronous. code looks this, action func<task<httpresponsemessage>> : var sw = new stopwatch(); httpresponsemessage response = null; sw.start(); response = await action().configureawait(continueoncapturedcontext: false); sw.stop(); the code compiles , runs ok, measured milliseconds 100 times higher request timings see in fiddler - fiddler reports 200-300ms, stop watch reports ~30,000ms. there catch timing asynchronous methods? solution timing in action (which annoying?) this should work fine measuring true amount of time takes asynchronous task finish. need keep in mind that: the time measuring fiddler measuring request only, , non of time takes code process response. there significant difference in time here , should able time code see how long takes progress break point before request after request. if closer 30 seconds stop watch accurate. there isn't obvious me make time inaccurate.

Laravel dependency injection into custom non-controller class fails in PHPUnit -

all. for laravel project i'm working on, i've started use dependency injection in order mock classes in tests. however, i've found if try inject custom class no explicit parent, 2 things true: the dependency injection works correctly when running application the injection fails when running tests in phpunit here sample code similar i'm using: democontroller // controller we're testing class democontroller extends controller { // injection , constructor private $helplayer1; public function __construct(helplayer1 $helplayer1) { $this->helplayer1 = $helplayer1; } ... // test function call public function testdeps() { $this->helplayer1->testlayer1(); } } helperlayer1 // our first helper class class helperlayer1 { private $helplayer2; public function __construct(helplayer2 $helplayer2) { $this->helplayer2 = $helplayer2; } ... // testing fun

How can i use java.util.TreeSet in MATLAB with user type elements and user defined comparator -

i'm new matlab , mother language c++. i'm trying implement algorithm in matlab uses balanced tree. know can done using java.util.treeset. don't know how provide own comparator tree. next code parse error classdef sitescomparator < java.util.comparator<site> also, in c++ can implement bool operator<(const type& other) . can in matlab, e.g. implement lt(a, b) or this? if comparator requires compiled java, need write , compile outside of matlab, , import use within matlab. to use compliled java within matlab, see: https://stackoverflow.com/a/9521010/931379 if can construct comparator using existing java classes, can construct within matlab , use within java.

java - How do I make play framework (1.3.1) module unit test classes appear in eclipse? -

i have few play framework 1.3.1 modules used in other play 1.3.1 applications. want start writing unit tests these modules. i have tried creating "test" folder (which contains test cases) in modules , re-importing main application in eclipse. not see module test folder anywhere. how can make work can edit test cases within eclipse?

css - Font not rendering from one URL but fine on other sites -

i have 7 websites (different domains on 1 shared hosting account) sharing same css file, of them display 3 fonts correctly except 1 url, , 1 font doesn't display, loading 3 custom fonts, 2 fine, 1 not, , loaded same way. any idea what's happening? here problem site ... http://www.theridgesresort.com/ here site works ... http://www.fontanavillage.com/ please view sites @ less 750 pixels wide, mobile style. @ big yellow buttons. i copied same path correct site other , works me: @font-face { font-family: 'copperplate_boldcondensed'; src: url('copperplate_boldcondensed/copperplate-boldcond-webfont.eot'); src: url('copperplate_boldcondensed/copperplate-boldcond-webfont.eot?#iefix') format('embedded-opentype'), url('copperplate_boldcondensed/copperplate-boldcond-webfont.woff') format('woff'), url('copperplate_boldcondensed/copperplate-boldcond-webfont.ttf') format('truetype'), url('copperplate_

javascript - Is there any method to insert link in between string -

i need insert link inside string. this... var txtarea="this link "+www.abcd.com\contacts+ "; the string+link stored in variable 'txtarea' send webpage using post method. you can use link() approach: var url = "http://www.abcd.com/contacts"; var txtarea = "this link: " + url.link(url); document.write(txtarea);

php - Swiftmailer DKIM fails only with multipart email -

i'm attempting dkim working swiftmailer php. works , dkim passes when setting body once (html or text), when adding both parts "body hash did not verify" dkim fail. does know correct way sign email both html , text parts using swiftmailer? // create signer $privatekey = file_get_contents($dkimprivatekeylocation); $domainname = 'from.here'; $selector = 'default'; $signer = new swift_signers_dkimsigner($privatekey, $domainname, $selector); $signer->ignoreheader('return-path'); // create message $message = swift_signedmessage::newinstance(); // attach signer $message->attachsigner($signer); // message setup $message->setfrom('email@from.here'); $message->setto('email@to.here'); html passes $message->setsubject('dkim html test'); $message->setbody('<p>hello world</p>', 'text/html','utf-8'); text passes $message->setsubject('dk

iphone - ios get ip address code worked before but failed now -

i use code below ip address of iphone #define ios_cellular @"pdp_ip0" #define ios_wifi @"en0" #define ios_vpn @"utun0" #define ip_addr_ipv4 @"ipv4" #define ip_addr_ipv6 @"ipv6" - (nsstring *) getipaddress1; { nsstring *address = @"error"; struct ifaddrs *interfaces = null; struct ifaddrs *temp_addr = null; int success = 0; // retrieve current interfaces - returns 0 on success success = getifaddrs(&interfaces); if (success == 0) { // loop through linked list of interfaces temp_addr = interfaces; while(temp_addr != null) { if(temp_addr->ifa_addr->sa_family == af_inet) { // check if interface en0 wifi connection on iphone nsstring *s= [nsstring stringwithutf8string:temp_addr->ifa_name]; nslog(@"%@ ---",s); if([s is

MYSQL: Getting certain data from a cross join depending on condition -

this problem query: select distinct t.name tname, t.task_group tg, tgs.name tgname tasks t, task_users tu, task_groups tgs (tu.worker = 1 , t.keyid = tu.task , tgs.keyid = t.task_group); the query works. thing part of clause tgs.keyid = t.task_group filters out results condition not true (which is, of course correct). how can modify query , still tname when condition not true , in case obtain predefined string tgname? to give information when condition not true t.task_group allways -1. in case tgname of "n/a". how can this? use case...when...else...end : select distinct t.name tname, t.task_group tg, case when tgs.keyid = t.task_group tgs.name else 'something else' end tgname tasks t, task_users tu, task_groups tgs (tu.worker = 1 , t.keyid = tu.task);

javascript - Unable to use jQuery in chrome extension -

i trying figure out why not able use jquery in extension, absolute beginner, in theory should job: manifest { "manifest_version": 2, "name" : "id", "version" : "0.1", "description" : "id", "browser_action" : { // "default_icon" : "icon.png", "default_popup" : "popup.html", "default_title" : "id" }, "content_scripts": [ { "js": [ "jquery.min.js", "app.js" ], "matches": [ "http://*/*", "https://*/*"] }] } popup.html <!doctype html> <html> <head> <title></title> </head> <body> </body> </html> app.js $("body").append("hello world"); yet see empty popup instead of "hello world" you can't inject c

xamarin - SQLite.Net Update generating error "it has no PK" -

i'm using lync syntax in pcl using xamarin. public class settings { [primarykey, autoincrement] public int id { get; set; } public string user_name { get; set; } public string password { get; set; } public string server { get; set; } } void createtables() { database.createtable<settings>(); } void insert() { settings s = new settings(); s.server = "<none>" s.user_name = ""; s.password = ""; database.insert(s) } void update() { settings s = database.table<settings>().firstordefault(); s.server = server_address.text; s.user_name = user_name.text; s.password = pass.text; database.update(s) } i cannot update settings: has no pk when updating inserting works fine. i'm using xamarin in pcl referencing sqlite.net. i'm new sqlite , xamarin please verbose when asking more detail. update - resolved the class in same namespace place create

amazon web services - Which kind of AWS EC2 instance to use with ElasticSearch? -

usually main factors decide are: is system index intensive? indexing lot ? are performing lot of faceting , other search related functionality ? how many documents have? in case, doing indexing once per day our system doing massive search functionality , have large (massive) amount of documents. by having @ amazon ec2 instances , think "memory optimised r3" i'm looking appreciate if share personal experience.

java - Chronometer doesn't start from 00:00:00 -

i have problem chronometer. when start it, begins 01:00:00. don't know why. think code correct. can understand problem is? this code: chronometer crono = new chronometer(this); crono.setbase(systemclock.elapsedrealtime()); crono.start(); when print time call method: long time = systemclock.elapsedrealtime() - totaltime.getbase(); date date = new date(time); simpledateformat formatter = new simpledateformat("hh:mm:ss"); formatter.format(date); thanks much! you're trying format date difference date. i'd maybe timezones come play? scala> new java.util.date(0) res2: java.util.date = thu jan 01 01:00:00 gmt 1970 scala> new simpledateformat("hh:mm:ss").format(new date(0)) res5: string = 01:00:00 you might want [ durationformatutils.formatduration() ]( http://commons.apache.org/proper/commons-lang/javadocs/api-2.6/org/apache/commons/lang/time/durationformatutils.html#formatduration(long , java.lang.string)).

actionscript 3 - Flash/AS3 - MovieClip into Bitmap -

Image
i need turn movieclip have on stage bitmap. function have made halfway works; make bitmap movieclip correct image, not rotate it. here function function makebitmapdata(mov):bitmapdata { var bmpdata:bitmapdata = new bitmapdata(mov.width, mov.height, true, 0); bmpdata.draw(mov); this.addchild(new bitmap(bmpdata)); //shows bitmap on screen purely example return bmpdata; } here output how should rotate bitmap or purely copy pixels in bitmap, rotated , all? have checked rotate() function , fl.motion.matrixtransformer class? this question looks helpful.

erlang - Why do I get syntax error before: '{'? -

while playing erlang getting started section have met bizarre syntax error on trivial use case (simple map initialization). there suggestion why happen? 1> #{ "key" => 42}. 1: syntax error before: '{' details: erlang r16b03 (erts-5.10.4), eshell v5.10.4. because maps introduced in erlang 17. you have upgrade installation or not use maps.

Python: Indices of identical tuple elements are also identical? -

just starting out apologize if stupid question. python 2.7 if it's important. i'm writing program evaluates polynomial coefficients represented elements of tuple @ x power index of coefficient. runs fine when coefficients different, issue i'm having when of coefficients same. code below - def evaluate_poly(poly, x): """polynomial coefficients represented elements of tuple. each coefficient evaluated @ x ** index of coefficient""" poly_sum = 0.0 coefficient in poly: val = coefficient * (x ** poly.index(coefficient)) poly_sum += val return poly_sum poly = (1, 2, 3) x = 5 print evaluate_poly(poly, x) ##for coefficient in poly: ##print poly.index(coefficient) which returns 86 expect. the commented out print statement return indices of each element in poly. when they're different (1, 2, 3) returns expect (0, 1, 2) if of elements same (1, 1, 2) indices same (0, 0, 1), i'm able evaluate polynomi

java - Stop the JPA (Hibernate) Criteria API creating repeated INs for a group of OR Predicates -

i'm using criteria api hibernate implementation of jpa. want improve structure of generated sql query same in expression isn't repeated each or predicate. i want because code running on gae , stackoverflowerror in case list of names long in in condition (it's due hibernate using stringbuilder build parameter list). i've pinned problem down section of code when remove, 8, of or predicates code runs without error. code runs fine on non-memory restrictive environments (my pc)....and yes have increased instance memory allocation on gae still same error. the java code have build part of query below (parameter names edited , i'm using @staticmetamodel classes parameter names):- private void buildnamestoquery(list<string> names, root<aroot> theroot, join<entity1, entity2> ajoin, list<predicate> orpredicates) { orpredicates.add(ajoin.get(entity1_.name1).in(names)); orpredicates.add(ajoin.get(entity1_.name2).in(names));

c# - Dependent project complexity -

initially developing window(form) project 1 named proj1. added project 2 named proj2 proj1. added references of proj2 in proj1. made proj2 startup project. while compiling , running, fine. built rebuilt in both release mode , debug mode. copied exe of proj1 , put @ different place. runs without showing dependency error starting point proj1 not proj2. to resolve opened solution file of proj2 , added proj1 there , added references also. put proj2 starting file. running well. when copy exe of proj2 place, shows dependency error. when put proj1 exe @ place, runs well. the error is: unhandled exception: system.io.filenotfoundexception: not load file or assembly 'myexcelreader, version=1.0.0.0, culture=neutral, publickeytoken=null' or 1 of dependencies. system cannot find file specified. @ codegen.program.createnominals(xmldocument xmldoc, xmlnode rootnode) @ codegen.program.main(string[] args) adding references projects alone not cause exception - occurs wh

mysql - How to select the compute the range value of a given date? -

Image
i have table below. want count , select values within month range. here's query select count(*) c, monthname(file_date) mn baguio_patrolcase monthname(file_date) between 'january' , 'july' group monthname(file_date) order file_date what want achive count , select values february june. how this? when convert date month name, comparing strings . here 2 options want: where month(file_date) between 2 , 6 file_date >= '2015-02-01' , file_date < '2015-07-01' the second better, because allows engine use index on file_date (if available). also, between keeps end values (it inclusive ). so, if want february through june, use months, rather 1 , 7.

dom - Jquery removing element from html -

i have html var content = $("#directions-panel > .adp").find("div[jsinstance='"+i+"']").prop('outerhtml'); i'm attempting remove first table column within html. here attempt not working. content.findr(".adp-directions > tbody > tr > td.adp-substep:eq(0)").remove(); your code remove first cell class adp-substep . instead of doing, try: content.find(".adp-directions > tbody > tr").each(function(){ jquery(this).find("> td.adp-substep:eq(0)").detach(); //or remove }); the code above remove first cell of each table row.

go - How to get the status code from within the HTTP request handler -

in request handler have conditional statement need fetch http status code. func posthandler(w http.responsewriter, r *http.request) { params := mux.vars(r) idstr := params["id"] // how 307 status code, decide whether redirect or not? if w.statuscode != 307 { // not work, no such field - why not??? http.redirect(w, r, idstr, 307) } else { rendertemplate() } } m.handlefunc("/{id:.*}", posthandler).methods("post") // matched first intercept post requests status 307 m.handlefunc("/{id:.*}", myhandler).methods("get", "post") i've made example illustrate concrete scenario: http://play.golang.org/p/yzgtsvo524 how achieve this? basically i'm using 307 because need resend post values http.redirect(w,r, url, code) destination. afaik seems best way this, again, can't without status code. additional question: using 307 bad solution? if so, what's better alternative?

django - OAuth2 server-side flow or client-flow for Facebook login on iOS app -

i'm coding api django + drf , client ios app. users need able authenticate facebook. my initial thought implementing client-side flow , send access token via https backend, retrieve user info token , register/login user end , seems approach popular since it's easier implement using facebook ios sdk. is there security gain using server-side flow instead? but i'm not sure implementation of server side flow. understanding there link third party oauth endpoint (does need web view or link facebook native app?) redirection uri embedded (the app custom url? myapp://... ? right?). ressource owner authenticate , redirected client (the app). ios app access code url , send access code end. end uses id , secret along code user access token (so it's never handled client). wouldn't work? does worth security-wise? in mobile app, doesn't makes sense use client-side flow? i understand tokens gotten client side flow in cases short-lived (depends on provider),

Export sql server table structure with data programmatically using C# -

i have table data in sql server. need take backup of table structure data sort of file programmatically using c# . may .sql extension file. same way using task option in sql server management studio. i googled did not find related this. if suggest me link highly appreciated. (edited in comments) the backup safety purpose. going execute conversion logic 1 of scheduler control. process is: get backup of table data list. truncate table. convert data desired format. insert converted data same table. if conversion logic problem, can fix later using backup file. this may you: select * newtable yourtable you not need create newtable manually, execute query. update :you can download database data dataset , use dataset write xml or without schema using dataset.writexml method this: ds.writexml(@"e:\temp.xml", xmlwritemode.writeschema);

php - Laravel Query builder returns empty array despite it being not null -

based on http://mikehillyer.com/articles/managing-hierarchical-data-in-mysql/ article select * nested_category +-------------+----------------------+-----+-----+ | category_id | name | lft | rgt | +-------------+----------------------+-----+-----+ | 1 | electronics | 1 | 20 | | 2 | televisions | 2 | 9 | | 3 | tube | 3 | 4 | | 4 | lcd | 5 | 6 | | 5 | plasma | 7 | 8 | | 6 | portable electronics | 10 | 19 | | 7 | mp3 players | 11 | 14 | | 8 | flash | 12 | 13 | | 9 | cd players | 15 | 16 | | 10 | 2 way radios | 17 | 18 | +-------------+----------------------+-----+-----+ 10 rows in set (0.00 sec) using laravel , raw query thus: $leaf_nodes = db::select( db::raw("select name nested_category rgt = lft + 1") ); print_r(db::ge

postgresql - How to make this SQL query for Alfresco shorter? -

how sql query made alfresco shorter? select string_value document_name, audit_created creation_date alf_node node inner join alf_node_properties on (id=node_id) inner join alf_qname on (qname_id=alf_qname.id) ns_id in (select ns.id alf_namespace ns ns.uri='http://www.alfresco.org/model/content/1.0') , local_name='name' , audit_creator = 'admin' , audit_created > '2015-05-06' order audit_created; this query came from.

html - center image in a pattern -

i have svg rectangle takes 100% width , apply pattern in it. have image contained in pattern placed in centre of rectangle , repeated. css equivalent be: background-position: center; . i play x of pattern, width unknown beforehand. here's snippet: <svg width="100%" height="120" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" preserveaspectratio="xmidymid meet"> <style scoped="true"> @keyframes enlarge { 0% {r: 10;} 30% {r: 10;} 100% {r: 100%;} } #holecircle { animation: enlarge 4s alternate infinite; } </style> <defs> <pattern id="pattern" x="0" y="0" width="480" height="480" patternunits="userspaceonuse" patterntransform="matrix(0.04 0 0 0.04 0 10)"> <path fill="black" d="m363.29999,3

javascript - Display JSON Objects as options in dropdown -

i have simple html page in read objects json file , show them options in dropdown using javascript. html , json below : html <html> <body> <select id="myid">mylist</select> <script src="myscript.js"></script> </body> </html> json [{"mode":"card"}, {"mode":"cash"}, {"mode":"cheque"}]; any w.r.t. javascript appreciated! working , tested code , reading external local json file (data.json) using javascript, first create data.json file below data: data = '[{"mode":"card"}, {"mode":"cash"}, {"mode":"cheque"}]'; mention path of json file in script tag <html> <script type="text/javascript" src="data.json"></script> <script> function addoptions(){ var jsonarray = json.parse(data);

encryption - How to discover the crypt method? -

i got little system here encrypt connection string used in sql server. when put connection like: server=wk-001;database=4rsystem;user id=user1;password=user123; i receive encrypted string: rjuduypxzusmrfhgktw0gy3xpf97woawia4dbwjk85an9qscwmjbjakt8lxauejl9hpo0gw3cva7iitpovqacw== btw, got encrypted string (generate same "system") , need decrypt. there's way discover encryption method / how decrypt it?

node.js - Promise inside loop in nodejs isn't working as expected -

i have array of events, each value there may/may not query fires data. var eventtypes = [["write","write","write","write"],["write","write","read","write"]]; _.each(eventtypes,function(obj){ gettime(obj); }); gettime=function(events){ var resultarray = []; _.each(events,function(event){ if(event === "read"){ resultarray.push(makesqlquery(event)); }else{ resultarray.push({"time":current_time}) } }); q.all(resultarray).then(function(finalresult){ insertintopostgresql(finalresult); }); } makesqlquery = function(event){ var deferred = q.defer(); sql.query("select time events eventtype ="+ event, function(result,error){ if(error){ deferred.reject(error); }else{ deferred.resolve({time:result.time}); } }); return deferred.promise; } in above cod

r - custom functions with dplyr summarise -

i've got data frame looks this: row year rainfall area species density rainfall1 1 46 1993 433.70 br red 2.9300000 low 2 47 1994 365.65 br red 8.0000000 low 3 48 1996 545.80 br red 5.8558559 high 4 49 1999 785.40 br red 17.0158617 high 5 50 2000 736.30 br red 8.8778409 high 6 51 2001 370.40 br red 6.9874901 low 7 52 2002 174.80 br red 2.0579308 low 8 53 2003 290.50 br red 7.6328655 low 9 54 2004 424.40 br red 7.4234908 low 10 55 2005 336.30 br red 0.7580045 low 11 56 2007 524.40 br red 0.4500000 high this repeats resulting 4 areas , 2 species giving 120 results. i'd add new column relative density year in area/species (as percentage). i've wrote small function relative density: relative <- function(x) (x/sum(x)) * 100 i'm not sure how right set of data work out group_by , summarise functions. need able retrieve densities given year,species,a

haskell - Difference between new-template.cabal and stack.yaml -

i want use reactive-banana in new haskell project. never used cabal-install or stack before. created directory , initialized project files in using stack new . see 2 files in directory: new-template.cabal , stack.yaml . how set dependencies , make sure downloaded , compiled? at first tried add - reactive-banana-0.8.0.2 in stack.yaml under extra-deps: , both stack build , stack solver didn't download it. augmented part called library in new-template.cabal this: library hs-source-dirs: src exposed-modules: lib build-depends: base >= 4.7 && < 5 , reactive-banana >= 0.8 default-language: haskell2010 every time tried run stack build , crashed error , suggestion add package stack.yaml under extra-deps: , , happened 3 times until packages installed, , import them in stack ghci repl. so question is, idiomatic way use stack ? of these 2 files should use specify dependencies , other project metadata? s

mysql - SELECT not working only inside @sql statement -

i've got query works on table, , doesn't work on another: here's code (please note part of query): set @sql = null; select group_concat(distinct concat('sum(case when columna = "' ,columna, ' "then 1 else 0 end) "' ,columna, ' "')) @sql table; i don't know why works table, when switch on table gives me error 1 row(s) affected, 1 warning(s): 1260 row 12 cut group_concat() if remove @sql thing , select gives me data without error...but truncates string @ point... don't know why cause trying build dynamic query (prepared statement) should below. again case condition case when columna = columna 1 else 0 end doesn't seems valid since columna = columna true. declare @sql varchar(200); set @sql = 'select group_concat(distinct concat(sum(case when columna = columna 1 else 0 end) columna)) (another sql query part) table';

css - Issue with min and max media queries due to using ems? -

im working on mobile first site. media queries set ems so: html { font-size: 62.5%; } body { font-size: 16px; font-size: 1.6rem; } @media (min-width: 320em) { } @media (min-width: 600em) { } @media (min-width: 770em) { } i need add max-width media query below same breakpoint middle media query, screen size either 1 or other. if working px easy: @media (max-width: 599px) { } @media (min-width: 600px) { } can same done ems? reiterate, need screen size in either min or max media query. cant have 'no mans land' in between. as possible have decimal places on ems think following wont work. screen 599.5ems wide in between 2 media queries. @media (max-width: 599em) { } @media (min-width: 600em) { } i've built few sites both min , max width media queries, , me they've been painfully difficult maintain , didn't add value. i use min-width queries mobile-first sites, because makes sense me think design smallest screen width first , add

vba - Replace #N/A error when using R1C1 as Vlookup -

i'm using below code fast vlookup, i'm struggling when code returns "#n/a" errors. i've tried copy , paste special in hope "n/a" treated regular text (then can replace value want), doesn't seem work. my code follows: lr1 = worksheets("risk explorer greeks").cells(rows.count, "i").end(xlup).row range("j2:j" & lr1).formular1c1 = "=vlookup(rc[-1], r1c1:r50000c1, 1, false)" would appreciate help! ideas on how can rid of these "#n/a" errors using vba?

Latest date of specific columns in excel -

Image
i have been few days thinking problem in excel , can't seem find solution trying page first time. the problem follows: i have set of columns specify name, type , model of different products. in addition have column date released , column says if row latest in specific name, type , model or not (they have same compare dates). wanted automate column have done others don't know start. seems incredibly difficult compared others have done. sample: title type model date last date? fear low b421 06/04/15 no fear low b421 23/05/15 yes hert medium m12 07/11/14 no if me appreciate. clue or idea helpful. ok formula need in e2 this:- =if(countifs(a$2:a$4,a2,b$2:b$4,b2,c$2:c$4,c2,d$2:d$4,">"&d2),"no","yes") if data in columns d headers in row 1. pull down e3, e4 etc. this says:- 'if there matching products later date, can't

android - have issue in getting proper responce from for-loop -

i getting data json using for-loop. here code: try { jsonobject jsonobj=new jsonobject(strri); privacy_setting_ozone_feed obj=new privacy_setting_ozone_feed(); jsonarray=jsonobj.getjsonarray("setting"); jsonarray jsonarray4=jsonobj.getjsonarray("blocklist"); log.d("ads", jsonarray4.tostring()); for(int i=0;i<jsonarray.length();i++) { jsonobject jsoninnerobj=jsonarray.getjsonobject(i); try { obj.strvalue=jsoninnerobj.getstring("value"); }catch(exception e) { } try { obj.str_name=jsoninnerobj.getstring("name"); }catch(exception e) { } } (int j=0; j<jsonarray4.length(); j++)//----------(loop) { jsonobject jobject = jsonarray4.getjsonobject(j); try

spring xd - Direct binding deployment with Kafka as message bus -

i trying use direct binding on following stream. stream create --definition "time | log" --name ticktock stream deploy ticktock --properties module.*.count=0 deployment fails exception on both admin , container node: java.lang.illegalargumentexception: module count cannot 0 @ org.springframework.xd.dirt.integration.kafka.kafkamessagebus$kafkapropertiesaccessor.getnumberofkafkapartitionsforproducer(kafkamessagebus.java:799) @ org.springframework.xd.dirt.integration.kafka.kafkamessagebus.bindproducer(kafkamessagebus.java:500) @ org.springframework.xd.dirt.plugins.abstractmessagebusbinderplugin.bindmessageproducer(abstractmessagebusbinderplugin.java:287) @ org.springframework.xd.dirt.plugins.abstractmessagebusbinderplugin.bindconsumerandproducers(abstractmessagebusbinderplugin.java:143) @ org.springframework.xd.dirt.plugins.stream.streamplugin.postprocessmodule(streamplugin.java:73) @ org.springframework.xd.dirt.module.moduledeployer.postprocess

Override transitive dependency - Maven -

below dependency project [info] | +- jasperreports:jasperreports:jar:3.1.4:compile [info] | | +- commons-beanutils:commons-beanutils:jar:1.7.0:compile [info] | | +- commons-collections:commons-collections:jar:3.2.1:compile [info] | | +- commons-digester:commons-digester:jar:1.8:compile [info] | | +- com.lowagie:itext:jar:2.1.0:compile [info] | | +- jfree:jcommon:jar:1.0.15:compile [info] | | +- jfree:jfreechart:jar:1.0.12:compile [info] | | +- xml-apis:xml-apis:jar:1.3.02:compile how can override jasperreports include xml-apis:xml-apis:jar:1.3.04? see exclude not interested in not want exclude xml-apis. so syntax override transitive dependency? i tried following , worked in parent pom <properties> <!-- xml apis --> <xml-apis.version>1.3.04</xml-apis.version> </properties> <dependencymanagement> <dependency> <groupid>xml-apis</groupid>

Allocate matrix of integer with c -

i have integer 2d matrix numi , 3d double matrix called prob . here 2 allocation: int main ( int argc, char* argv[]){ double ***prob; int **numi; numi = (int **)malloc((dim)*sizeof(int *)); prob = (double ***)malloc((dim)*sizeof(double**)); ... for( = 0; < n ; i++){ prob[act][actstart][i] = value; numi[i][i]= value2; } } how many rows , cols has numi ? dim x dim matrix ??? prob 3d matrix...here allocation dim x dim x dim ? numi not have rows , columns, pointer-to-pointer-to-int, , happens pointing @ allocated memory has room dim pointers-to-int, not dim * dim ints. equivalent treating having been declared int* numi[dim] a call int* numi; numi= malloc( dim*dim*sizeof(int) ); will allocate dim dim matrix of integers. however, please note multi-dimensional arrays, int example[a][b] , size of allocated area equivalent int* example_ = malloc(a*b*sizeof(int)) ,

shell - How to every read three lines into html table from var? -

i set var: imgpath=$(find $pwd -depth -maxdepth 3 -name " cpu_u .gif" -o -name " cpu_s .gif" -o -name "*memory_free.gif" | sort -n) every read 3 lines var html table. i write script: #!/bin/sh imgpath=$(find $pwd -depth -maxdepth 3 -name "*cpu_u*.gif" -o -name "*cpu_s*.gif" -o -name "*memory_free.gif" | sort -n) cat <<eof1>report.html <html> <table width="1000" border="1" align="center" cellpadding="2" cellspacing="0" bordercolor="#333333"> <tr><td width="15%" bgcolor="#00ffff"><span class="style5">testcase</span></td> <td width="15%" bgcolor="#00ffff"><span class="style5">grinder component</span></td> <td width="15%" bgcolor="#00ffff"><span class="style5">grinder co