Posts

Showing posts from February, 2012

shell - how to format simultaneously a string and floating number in awk? -

i have column follows: ifile.txt 1.25 2.78 ? ? 5.6 3.4 i format floating points decimal , skipping strings is. ofile.txt 1 3 ? ? 6 3 walter a, f. knorr , janez kuhar suggested nice scripts per question , need of command awk '{printf "%d%s\n", $1}' ifile.txt again, found have number of columns, however, other columns don't need formatting. have use above command in form of like: awk '{printf "%5s %d%s %5s %5s %5s\n", $1, $2, $3, $4, $5}' ifile.txt for example: ifile.txt 1 1.25 23.2 34 3.4 2 2.78 22.0 23 1.2 3 ? ? ? 4.3 4 ? ? ? 6.5 5 5.6 45.0 5 2.4 6 3.4 43.0 23 5.6 i used following command again suggested f. knorr in answer, awk '$2~/^[0-9]+\.?[0-9]*$/{$2=int($2+0.5)}1' ifile.txt > ofile.txt ofile.txt 1 1 23.2 34 3.4 2 3 22.0 23 1.2 3 ? ? ? 4.3 4 ? ? ? 6.5 5 6 45.0 5 2.4 6 3 43.0 23 5.6 it works fine, need f

javascript - Uncaught TypeError: Cannot read property 'xxxx' of undefined, But it's defined -

i having trouble problem hours ago. wrote these in jquery function check value in variable if it's exist or not. console.log("in tr"); console.log(tmproomlistarray[c].room_name); let roomname = tmproomlistarray[c].room_name; when ran , looked @ google chrome console. shows results this. rome <<< in console.log shows valid value in tr uncaught typeerror: cannot read property 'room_name' of undefined << happen when assign in variable , need what happen ?? i'm blind right now.. edit : edit question content i solved it. silly problem overlooked. it's array index. i put tmproomlistarray[c-1] into function , worked. think solution rest more, see problem more clearly. for want know happen read below. i got function insert row in table, , function have 2 parameters, array. function insert row continuously table. won't st

php - Converting date (with milliseconds) into timestamp -

this question has answer here: convert 1 date format in php 12 answers i have date format '25 may 2016 10:45:53:567'. i want convert time stamp. strtotime function returns empty. $date = '25 may 2016 10:45:53:567'; echo strtotime($date); // returns empty when removed milliseconds, it's working. $date = '25 may 2016 10:45:53'; echo strtotime($date); // returns 1464153353 please sort out issue. in advance. split string: $date = '25 may 2016 10:45:53:001'; preg_match('/^(.+):(\d+)$/i', $date, $matches); echo 'timestamp: ' . strtotime($matches[1]) . php_eol; echo 'milliseconds: ' . $matches[2] . php_eol; // timestamp: 1464162353 // milliseconds: 001

c++ - G++-5 tr1/regex regex_replace could not be resolved -

i using g++-5 dialect option -std=c++0x , preprocessor symbol __gxx_experimental_cxx0x__ , trying use tr1/regex . i use #include <tr1/regex> using namespace std::tr1; , regex reg("<[^>]*>"); trows no error. when use regex_replace(line, reg, ""); afterwards, following error output: function 'regex_replace' not resolved test.cpp /cppuni/src line 72 semantic error invalid arguments ' candidates are: #0 regex_replace(#0, #1, #1, const std::tr1::basic_regex<#3,#2> &, const ? &, std::bitset<unsigned long int11>) ? regex_replace(const ? &, const std::tr1::basic_regex<#1,#0> &, const ? &, std::bitset<unsigned long int11>) ' test.cpp /cppuni/src line 72 semantic error i verified, line string. i searched solution last couple of hours , find solutions involved attempted. unfortunately can't use boost/regex package. is there solution issue? edit: #include <tr1/r

c# - "window.external.notify" not available in Windows Phone app -

i trying pass data browser's scriptnotify event in windows phone app. however, window.external.notify doesn't work. if try try {window.external.notify(value);} catch (e) {alert(e.message);} then shows me "object doesn't support action". how can pass data windows phone browser c# app?

anova - aov() error term in R: what's the difference bw Error(id) and Error(id/timevar) specification? -

what difference between aov(depvar~timevar+error(id)) , aov(depvar~timevar+error(id/timevar)) formula specifications? these 2 variants produce different results. the same question once asked here: https://stats.stackexchange.com/questions/60108/how-to-write-the-error-term-in-repeated-measures-anova-in-r however, i'd repeat more appropriate example. here example created: var=rep(na,180) id=rep(1:20,each=180/20) group=rep(rep(1:2,each=9),180/(9*2)) time1=rep(rep(1:3,each=3),180/(3*3)) time2=rep(c(8,15,20),180/3) var[group==1&time1==1&time2==8]=runif(10,105,115) var[group==2&time1==1&time2==8]=runif(10,105,115) var[group==1&time1==1&time2==15]=runif(10,95,105) var[group==2&time1==1&time2==15]=runif(10,95,105) var[group==1&time1==1&time2==20]=runif(10,85,95) var[group==2&time1==1&time2==20]=runif(10,85,95) var[group==1&time1==2&time2==8]=runif(10,95,105) var[group==2&time1==2&time2==8]=runif(10,95,105) var[g

c# - Adding a new row to a table with many foregin keys -

i have small problem setting relations between tables in entity. have 3 models: appuser , assignment , completedassignment . public class appuser { [display(name = "your id:")] public int id { get; set; } [display(name = "first name")] public string firstname { get; set; } [display(name = "last name")] public string lastname { get; set; } public virtual icollection<completedassignment> completedassignments { get; set; } } public class assignment { [display(name="assignment id")] public int id { get; set; } [display(name = "assignment name")] public string assignmentname { get; set; } [display(name = "assignment description")] [datatype(datatype.multilinetext)] public string description { get; set; } public datetime creationdate { get; set; } public assignment(){ this.creationdate = datetime.now; } public virtual icollection<

php - Want to insert multiple rows from a json file in amazon's dynamoDB -

i want insert multiple rows of data amazon's dynamodb. had tried code on page this page of amazon php guide but inserting data 1 one in loop there way insert in 1 time or 1 call. because every time inserts row calls dynamodb , lead performance issue if have thousand's of rows. please refer below link php batch write on dynamodb. $dynamodb->batchwriteitem http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/lowlevelphpbatchoperationsexample.html

html - Unable to fill input value with PHP variable -

i have 2 files, landing.php , test.php. landing.php has form submitted via ajax using post method test.php. if ajax call successful, browser loads test.php, @ point having issue. cannot figure out doing wrong in attempts display value of post data sent test.php. the following ajax call landing.php. reasonably sure working correctly having looked @ post data in firebug. $('#searchform').submit(function(e) { e.preventdefault(); var data1 = $('#checkboxdiv input').serialize() + '&' + 'barcodeid=' + $('#barcodeid').val(); $.ajax({ url: 'test.php', data: data1, type: 'post', success: function() { window.location.href = "test.php"; } }); }); here contents of test.php. <?php $bar = $_post['barcodeid']; echo "<html>"; echo "<body>"; echo "<p>*" . $bar . "*</p>"; echo

asp.net mvc - How to use SQL Server Change tracking to Increase Reports performance? -

i have reports developed asp.net mvc crystal reports based on sql server queries. these queries take long time execution because there heavy calculations , result should real time. i think if saved result of calculations in new table reports can read these results directly. thought if used sql server change tracking determine changes update new table. the problem how can automatically update new table using sql server change tracking?

gwt - SERVICE_UNAVAILABLE Google Web Toolkit -

i have small gwt project ongoing , keep getting error everytime run in developement mode. http error: 503 problem accessing /segnalazioni_degrado.html. reason: service_unavailable -------------------------------------------------------------------------------- powered jetty:// these service classes i've created: datalayerservice, datalayerserviceasync, datalayerimpl package com.tesi.client; import java.sql.connection; import java.sql.resultset; import java.sql.statement; import java.util.list; import com.google.gwt.user.client.rpc.remoteservice; import com.google.gwt.user.client.rpc.remoteservicerelativepath; @remoteservicerelativepath("datalayer") public interface datalayerservice extends remoteservice { list<segnalazione> getlistasegnalazioniattivepermappa(); } . package com.tesi.client; import java.sql.connection; import java.sql.resultset; import java.sql.statement; import java.util.list; import com.google.gwt.user.client.rpc.as

c++ - why are priority queues implemented as binary heap? -

why people stress heaps used implement priority queues because time complexity of peeking @ max/min value o(1) . can't implented on bst , using pointer point @ right most/left node. given fact propose priority queue based on bst, try explain why heap better bst. a heap complete tree; balanced tree. height log_2(n+1) . a bst approach worthwhile if 1 balanced. best-known technique maintaining bst balanced avl tree. kind of tree has height bound of 1.44 log_2(n+2) - 0.33 . for consultation of minimum have cost of o(log(n)) bst versus o(1) heap. operation heap better. for insertion , deletion costs asymptotically equivalent. bst tends more expensive because height tends higher balanced tree. in addition, avl tree consumes more constant time heap. in avl (and in other balancing approaches, red-black tree, treaps, splays, etc) perform rotations, while heap perform swaps, cheaper rotations. deletion on bst complicated , expensive operation , take o(log(n)) rot

java - Should I read from a Redis Cluster slave? -

we have cluster configuration redis used cache. due normal pattern of write master , read slave (with other databases), trying same thing redis cluster. after investigation found none of redis clients (in java) redisson, jedis , spring data redis support this. seem have found workaround seems ugly , thinking if worth it? here use case approx highest qps: 1000 payload size: huge 1 mb max (after compression) cluster size 3 master each 2 slaves(pretty high spec machines) cringe part: actual network bandwidth cluster max 1gb (1 gb separately intra-cluster talk) with in mind have following questions: will (reading slave) me in way? are there pit holes should avoid (any special server side config)? is narrow path going problem? is there standard way (library/client) doing correctly any (blogs, case study, suggestions) appreciated. what expectation slave reads? it's possible , usual pattern read slaves comes set of effects. slave reads introduce sta

machine learning - Classification using Approximate Nearest Neighbors in Scikit-Learn -

i have labeled dataset having 46d featureset , around 5000 samples want classify using approximate nearest neighbors. since i'm familiar scikit-learn, want utilize achieve goal. the scikit documentations lists lshforest 1 of probable methods ann, it's unclear me how apply classification purposes. very nice question. unfortunately scikit-learn not seem support custom neighbor model now, can, implement simple wrapper on own, such as from sklearn.neighbors import lshforest import numpy np scipy.stats import mode class lsh_knn: def __init__(self, **kwargs): self.n_neighbors = kwargs['n_neighbors'] self.lsh = lshforest(**kwargs) def fit(self, x, y): self.y = y self.lsh.fit(x) def predict(self, x): _, indices = self.lsh.kneighbors(x, n_neighbors = self.n_neighbors) votes, _ = mode(self.y[indices], axis=1) return votes.flatten()

PHP foreach loop inside foreach loop? -

i have 2 foreach loop. in first foreach loop menu list , second foreach loop database fetch loop. want compare first foreach key second foreach value first foreach array result shown array ( [master/city] => city [master/national_holiday] => national holiday [master/operator_comments] => operator comments [master/sensors] => sensors ) and second foreach array result array ( [0] => array ( [menu_url] => monitoring/tickets [menu_category] => monitoring [read] => 1 [write] => 1 ) [1] => array ( [menu_url] => monitoring/serach_tickets [menu_category] => monitoring [read] => 1 [write] => 1 ) [2] => array ( [menu_ur

encryption - openssl aes_128_ctr in c -

i have 1mb size data , want use aes_128_ctr encrypt. found source code in openssl follow. /* input encrypted though 128bit counter mode being * used. state information record how of * 128bit block have used contained in *num, , * encrypted counter kept in ecount_buf. both *num , * ecount_buf must initialised zeros before first * call aes_ctr128_encrypt(). */ void aes_ctr128_encrypt(const unsigned char *in, unsigned char *out, const unsigned long length, const aes_key *key, unsigned char counter[aes_block_size], unsigned char ecount_buf[aes_block_size], unsigned int *num) { unsigned int n; unsigned long l=length; assert(in && out && key && counter && num); assert(*num < aes_block_size); n = *num; while (l--) { if (n == 0) { aes_encrypt(counter, ecount_buf, key); aes_ctr128_inc(counter); } *(out++) = *(in++) ^ ecount_buf[n]; n = (n+1) % aes_

how to access custom exception handler from python module? -

these files: mymodule/__init__.py import sys class mymodule: handle_exceptions = handle_exceptions def __init__(self): sys.excepthook = handle_exceptions #mymodule/handle_exceptions.py def handle_exceptions(ex_cls, ex, tb): #not important here pass #my_script.py import sys import mymodule sys.excepthook = mymodule.handle_exceptions the contents of 'handle_exceptions' not important here because can't access @ all. traceback (most recent call last): file "my_script.py", line 2, in <module> import mymodule file "d:\python34\mymodule\__init__.py", line 3, in <module> class mymodule: file "d:\python34\mymodule\__init__.py", line 4, in mymodule handle_exceptions = handle_exceptions nameerror: name 'handle_exceptions' not defined try this mymodule/__init__.py import sys class mymodule: def __init__(self): sys.excepthook = handle_exceptions self.handle_exceptions

ios - Dynamically instantiating custom UIView's from XIB issue (what's wrong with this code)? -

what wrong following code, it's seems have endless loop. comes through init:frame, commoninit, xib loading line triggers entering again through init:coder etc. two areas of question: a) how instantiate avoid problem (i.e. want use xib layout, dynamically creating/position multiple of these on parent view in code) b) setting self.label.text problematic seems self.label (a uilabel linked xib) hasn't been setup @ point, hence nil. dynamically, when want create little custom uiview via xib, add subclass, set value of label how do this? import uikit class directioninfoview: uiview { @iboutlet weak var label: uilabel! func commoninit() { let viewname = "directioninfoview" let view: directioninfoview = nsbundle.mainbundle().loadnibnamed(viewname, owner: self, options: nil).first as! directioninfoview // <== exc_bad_access (code=2...) self.addsubview(view) view.frame = self.bounds self.label.text = "t

Setting text to array of edit text android -

Image
i have array of text dynamically generated , when user clicks button , need each character of particular string displayed in each text. for eg. text looks like, where each'-' represents text , when user clicks button , want string/character populated each time . for. eg, when user clicks button first time, want character 'a' displayed .so, text array must lik a - - and when user clicks second time, must populate 'b' in second text field, so, output must be, a b - and values 'a' , 'b' dynamic. have tried using below code, edittext[] edittext = new edittext[dynamiclen]; (int n = 0; n < dynamiclen; n++) { edittext[n] = new edittext(puzzlewithhint.this); edittext[n].setlayoutparams(new viewgroup.layoutparams (viewgroup.layoutparams.wrap_content, viewgroup.layoutparams.wrap_content)); edittext[n].setfocusable(true);

javascript - Is it an acceptable idea that I write HTML codes into JS codes? -

every website has static codes constant. example header, footer, advertising box , ...! well want write static html codes js file, , know catch. loading faster. mean why user should download fixed html codes time? think can catch them trick mentioned. however don't have lot of experience in field. not faced problems later if that? mixing view (html) , business logic (js) anti-pattern violates separation of concerns . said, depends on kind of code mixing within view: strictly related view's rendering? if though motivation loading faster think doing wrong.

javascript - change attribute of input checkbox and see changes -

i try select elements table , set attribute 'checked'. that's code: for (var i=0 ; i<$scope.assets.length ; i++ ){ if ($scope.assetsfrommodel.includes($scope.assets[i].interfaces.ip_addresses[0].value)){ var el = angular.element($scope.assets[i].interfaces.ip_addresses[0].value); console.log(el.attr('checked','checked')); } } as can see elements angular.element (i see in console found elements need) nothing happen. should do?

php - regex for css class and id -

i want insert class , id of css file in database rows, html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,dl,dt,dd,ol,nav ul,nav li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td,article,aside,canvas,details,embed,figure,figcaption,footer,header,hgroup,menu,nav,output,ruby,section,summary,time,mark,audio,video{margin:0;padding:0;border:0;font-size:100%;font:inherit;vertical-align:baseline;} article, aside, details, figcaption, figure,footer, header, hgroup, menu, nav, section {display: block;} ol,ul{list-style:none;margin:0;padding:0;} .subscribe p{ .txt-rt{text-align:right;} .pos-relative{position:relative;} from subscribe p want subscribe not p looking regex filter elements between . , { or space each class: .txt-rt{text-align:right;} i have search between . , { , for .subscribe p{ i have search between . , spa

javascript - How to change html5 video source on click? -

what i'm trying create sort of playlist, using html5 , vanilla javascript (no jquery). same short video keeps looping until click 1 of arrows, next (or previous) video in line gets loaded in same video element. here's have: html <video autoplay="true" loop="true" id="video"> <source src="img-vid/video1.mp4" type="video/mp4" id="vid-src"> </video> <img src="img-vid/arrow_left.png" class="arrow arrow-left" id="left"> <img src="img-vid/arrow_right.png" class="arrow arrow-right" id="right"> javascript var button_next = document.getelementbyid("right"); var button_previous = document.getelementbyid("left"); var playlist = document.getelementbyid("video"); var source = document.getelementbyid("vid-src"); button_next.onclick = play_next; button_previous.onclick = play_prev; func

memory - VHDL - How to elegantly initialize an array of std_logic_vector? -

i'm trying interface classic hd44780 lcd. have implemented local ram write data wish show on display. i have defined ram in way: type ram_type array (0 (16*2)-1) of std_logic_vector(7 downto 0); signal lcd_mem : ram_type; i've tried initializing ram in way: lcd_mem(0 6) <= x"45_72_72_6f_72_73_3a"; ... but receive error on synthesis: error (10515): vhdl type mismatch error @ display_ber.vhd(74): ram_type type not match string literal is there way ellegantly initialize ram block in similar way ? perhaps should use string type instead ? yes there is. note definition of ram_type array of std_logic_vector . , x"45_72_72_6f_72_73_3a" hex string literal. these not same type, hence error. so, have put value array of vectors. such as: lcd_mem(0 6) <= (0 => x"45", 1 => x"72", 2 => x"72", 3 => x"6f", 4 => x"72", 5 => x"73", 6 => x"3a&qu

javascript - JS:Specific weight chart -

firstly understand issue should see pricture in link below : http://www.hostfile.nl/fpimages/03bkr5tq46/16043/screenshot.jpeg.html the idea , issue create chart of weight such picture or site http://www.loseit.com/#goals , description : 1- chart contain 2 lines : 1 - record today's weight , 2- goal weight. 2- can record everyday today's weight , when click "record" button directly see new line added in chart in space of today (you can see picture ) what need example or code of chart same fonctionality,really i'm not professional in javascript code? you can use flot (javascript library jquery generate charts) // null signifies separate line segments var mydata = [[0, 12], [7, 12], null, [7, 2.5], [12, 2.5]]; var mygoal = [[0, 20], [12, 20]] $.plot($("#mychart"), [ mydata, mygoal ]); check out example : http://refork.com/xa2e

Android - How to remove MediaPlayer loop delays? -

i set music file loop on mediaplayer game, causes 2 sec delay when loops. my code: boolean activatesounds = getintent().getbooleanextra("activate sounds", true); if(mp!=null){ mp.reset(); mp.release(); } mp = mediaplayer.create(startgame.this, r.raw.music1); mp.setvolume(8f, 8f); mp.setlooping(true); // causing delays if (activatesounds) mp.start(); for game, not interesting. there way make mediaplayer run out of loop delays? i not able make setlooping work without gap. only solution worked me use setnextmediaplayer call (which able start next loop without gap) , 2 mediaplayers. 'pseudo' code: class abc implements mediaplayer.oncompletionlistener { private final mediaplayer[] mps = new mediaplayer[2]; public abc() { mps[0] = new mediaplayer(); mps[1] = new mediaplayer(); mps[0].setoncompletionlistener(this); mps[1].setoncompletionlistener(this); } public void start() initmediaplay

c++ - Function pointer to member function -

i'd set function pointer member of class pointer function in same class. reasons why i'm doing complicated. in example, output "1" class { public: int f(); int (*x)(); } int a::f() { return 1; } int main() { a; a.x = a.f; printf("%d\n",a.x()) } but fails @ compiling. why? the syntax wrong. member pointer different type category ordinary pointer. member pointer have used object of class: class { public: int f(); int (a::*x)(); // <- declare saying class pointer }; int a::f() { return 1; } int main() { a; a.x = &a::f; // use :: syntax printf("%d\n",(a.*(a.x))()); // use object of class } a.x not yet on object function called on. says want use pointer stored in object a . prepending a time left operand .* operator tell compiler on object call function on.

android - Broadcast Receiver is not receiving the intent after I change the Intent action -

i trying build simple count down timer app. mainactivity starts service(timerservice). service starts countdowntimer. after every tick, send out broadcast update view in mainactivity. view time updates till last tick. when countdowntimer finishes, creating intent action indicate timer has finished. intent not being received broadcastreceiver. this countdowntimer code. @override public void onfinish() { log.i(tag, "timer finished"); intent notifymainact = new intent(constants.time_over); notifymainact.putextra(constants.get_timer_value,string.valueof(0)); sendbroadcast(notifymainact); stopself(servicestartid); log.i(tag, "stopping service " +servicestartid); } @override public void ontick(long millisuntilfinished) { long minremaining = millisuntilfinished/60000; log.i(tag, "on tick: "+string.valueof(minremaining)); intent notifymainact = new intent(constant

Apriori Algorithm - Mining association rules in Java -

scan transactions find l1 ( k = 2; lk-1 !empty; k++) { generate ck lk-1 count occurences of itemsets in ck find lk l1: set of frequent 1-itemsets counts no less support ck: set of candidates k-itemsets lk: subset of ck counts no less support transactions (dataset.txt) a, b, e b, d b, c a, b, d a, c b, c a, c a, b, c, e a, b, c f support(min) = 20% our association rule data mining task has multiple parameters , stages: generate candidates, scan , count, check min support here it's generating c till c3 c2 not counting , c3 giving wrong value. c3 should {a, b, c} {a, b, d} {a, b, e} {a, c, d} {a, c, e} {a, d, e} {b, c, d} {b, c, e} {b, d, e} {c, d, e} however we're getting a b c c d e e this wrong result. first error c2 , c3 not counting , c3 giving wrong result. my code follows: main.java package apriori; import java.io.bufferedreader; import java.io.file; import java.io.filereader; import j

android - react-native :app:installDebug FAILED -

install apk debug device failed. jianglinghuademacbook-pro:hello jianglinghua$ react-native run-android js server running. building , installing app on device (cd android && ./gradlew installdebug... warning [project: :app] current ndk support deprecated. alternative provided in future. :app:prebuild up-to-date ...... :app:assembledebug up-to-date :app:installdebug installing apk 'app-debug.apk' on 'mi note lte - 6.0.1' unable install /users/jianglinghua/desktop/hello/android/app/build/outputs/apk/app-debug.apk com.android.ddmlib.installexception: failed establish session @ com.android.ddmlib.device.installpackages(device.java:894) ........ @ org.gradle.wrapper.gradlewrappermain.main(gradlewrappermain.java:61) :app:installdebug failed failure: build failed exception. * went wrong: execution failed task ':app:installdebug'. > com.android.builder.testing.api.deviceexception: com.android.ddmlib.installexception: failed establish sess

php - JCrop cropping the wrong area -

i need implementation of jcrop. tried follow manual whenever select area, it's not selecting have selected. instead it's taking area outside selection. sometimes, it's taking area (i thinking because of photo size) it's taking wrong area. please help. here's code: note $photo uploaded image. it's being uploaded no issue on that. the 120 x 120 pixels want save uploaded pictures save storage space. also, here's css of <img> element display image cropping: max-width: 100%; height: auto; display: inline-block; position: relative; here's php code: $twidth = 120; $theight = 120; $quality = 90; $src = imagecreatefromjpeg($photo); $dst = imagecreatetruecolor($twidth, $theight); $x = $_post['x']; $y = $_post['y']; $w = $_post['w']; $h = $_post['h']; imagecopyresampled($dst, $src, 0, 0, $x, $y, $twidth, $theight, $w, $h); imagejpeg($dst, $photo, $quality); the problem here resizing image box

Existing DB - SQLite / android - read from db -

i tried many times use existing data base sqlite in android app ! can create new db, here , wanna use existing 1 ! codes , there's no problems there , not error , doesnot work , 1 can me whith ? databasehelper.java: public class databasehelper extends sqliteopenhelper { private static string db_path = "/data/data/com.global.getrain/databases/"; private static string db_name = "bookdb"; private sqlitedatabase mydatabase; private context mycontext; public databasehelper(context context) { super(context, db_name, null, 1); this.mycontext = context; } public void createdatabase() throws ioexception{ boolean dbexist = checkdatabase(); if(dbexist){ }else{ this.getreadabledatabase(); try { copydatabase(); } catch (ioexception e) { throw new error("error copying database"

java - Tomcat giving Error : "There is no Action mapped for action name" in Struts 2 -

this question has answer here: struts2 there no action mapped namespace [/] , action name [login] associated context path [/struts2test] 1 answer tried changing location of struts.xml still getting error. namespace being used in url still getting error. struts.xml : <?xml version="1.0" encoding="utf-8"?> <!doctype struts public "-//apache software foundation//dtd struts configuration 2.0//en" "http://struts.apache.org/dtds/struts-2.0.dtd"> <struts> <package name="default" namespace="/program" extends="struts-default"> <action name="gettwo" class="strutstwopack.programtwo"> <result>/success.jsp </result> <result>/failure.jsp</result> </action>

php - How to get product by tag using Woocommerce API Client -

i'm trying products woocommerce using api rest client following : $args = array( 'filter[limit]' => 3, 'filter[tags]' => 'today', 'filter[orderby]' => 'date', 'filter[order]' => 'desc' ); return $this->client->products->get('', $args); i got list of prods, need ones tag 'todays' thanks.

content management system - is there a significant advantage by using a slug for an article? -

i wondering in cms systems, regards seo , other stuff, there advantage using article slugs in urls example.com/article/the-article-name versus using article id such example.com/article/view/3 no. there not significant advantage there small advantage. it agreed upon keywords in url "a little bit". see video google's matt cutts answers question, does position of keywords in url affect ranking? . in says, "it little bit have keywords in url" .

linux - Excluding unwanted names from json with jq -

suppose curl json file, so: curl https://api.github.com/repos/ruby/ruby/tags -o ruby.json [ { "name": "yarv_migration_base", "zipball_url": "https://api.github.com/repos/ruby/ruby/zipball/yarv_migration_base", "tarball_url": "https://api.github.com/repos/ruby/ruby/tarball/yarv_migration_base", "commit": { "sha": "20c8803697df39a086175a5eb2f8e8ee00bf1e2f", "url": "https://api.github.com/repos/ruby/ruby/commits/20c8803697df39a086175a5eb2f8e8ee00bf1e2f" } }, { "name": "v2_3_1", "zipball_url": "https://api.github.com/repos/ruby/ruby/zipball/v2_3_1", "tarball_url": "https://api.github.com/repos/ruby/ruby/tarball/v2_3_1", "commit": { "sha": "5827d8e887d881eb3a6e6ea7410590261c90545f", "url": "https://api.github