Posts

Showing posts from April, 2012

maven - File lock exception when using graphHopper in java program -

i'm using graphhopper in following way: graphhopper hopper = new graphhopper().forserver(); hopper.setchenable(false); hopper.setgraphhopperlocation(graphhopermasterfile); hopper.setosmfile(osmfile); hopper.setencodingmanager(new encodingmanager("car,bike")); hopper.importorload(); ghrequest req = new ghrequest().addpoint(new ghpoint (latfrom, lonfrom)).addpoint(new ghpoint(latto, lonto)) .setvehicle("car") .setweighting("fastest") .setalgorithm(algorithmoptions.astar_bi);; req.gethints().put("pass_through", true); ghresponse res = hopper.route(req); i obtained graphhopermasterfile downloading zip https://github.com/graphhopper/graphhopper/blob/0.5/docs/core/routing.md . i obtained .osm file http://download.geofabrik.de/europe/great-britain/england/greater-london.html . i added maven dependancy http://mvnrepository.com/artifact/com.graphhopper/graphhopper-we

php - how make these variables dynamic in foreach loop -

i have cart data , want use paypal want make cart data formate code: $item_1 = new item(); $item_1->setname('item 1') // item name ->setcurrency('usd') ->setquantity(2) ->setprice('15'); // unit price $item_2 = new item(); $item_2->setname('item 2') ->setcurrency('usd') ->setquantity(4) ->setprice('7'); $item_3 = new item(); $item_3->setname('item 3') ->setcurrency('usd') ->setquantity(1) ->setprice('20'); // add item list $item_list = new itemlist(); $item_list->setitems(array($item_1, $item_2, $item_3)); you can define varying data in assoc array first: $data = array( array( 'quantity' => 1, 'price' => '15'), ... // etc ); then iterate on , add result array: $result = array(); for($i = 0; $i < count($data); ++$i) { $obj = new item(); $obj->setname('item ' .

sql - Execute multiple queries in a single database connection using oracle 10g and php -

i want run multiple sql queries in single database connection using oracle 10g , php. here every sql query queries have create database connection. there way run multiple sql queries in single database connection or have fetch data way only? because when have run 50 queries, have write 50 times below. <?php include("mydb.php"); // run query $sql6 = "select * dat to_char(wd,'dd/mm')='19/08'"; $stid6=oci_parse($conn, $sql6); // set array $arr6 = array(); if(!$stid6){ $e=oci_error($conn); trigger_error(htmlentities($e[message],ent_quotes),e_user_error); } $r6=oci_execute($stid6); if(!$r6){ $e=oci_error($stid6); trigger_error(htmlentities($e[message],ent_quotes),e_user_error); } // through query while($row = oci_fetch_array($stid6,oci_assoc)){ // add each row returned array $arr6[] = array(($row['wd']) , (float)$row['data']); } oci_free_statement($stid6); oci_close($conn); ?> <?php include("mydb.php");

php - MYSQL Left Join month count from two tables -

i want add columns represent month base counts other table. i have 2 tables. leave application leaveid userid 1 3 2 4 3 5 4 1 leave dates dateid leaveid leavedates 1 1 2015-10-06 2 1 2015-10-07 3 2 2015-11-01 4 2 2015-11-02 5 3 2015-01-01 6 4 2015-02-12 i want end total leave count based on months: userid january fabruary march on... 1 1 3 1 2 2 0 1 2 3 4 1 do conditional summing of entries, this:- select a.userid, sum(if(month(leavedates) = 1, 1, 0)) january, sum(if(month(leavedates) = 2, 1, 0)) february, sum(if(month(leavedates) = 3, 1, 0)) march, sum(if(month(leavedates) = 4, 1, 0)) april, sum(if(month(leavedates) = 5, 1, 0)) may,

java - Number picker doesn't show properly as designer -

Image
i have issues number picker control in android studio. control aren't displayed on real device when run application. number picker has no gray background color, no "+" / "-" buttons displayed, transparent ? xml <?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#000000" > <expandablelistview android:layout_width="wrap_content" android:layout_height="342dp" android:id="@+id/lvtranexp" android:layout_alignparentleft="true" android:layout_alignparentstart="true" android:layout_above="@+id/numberpicker" android:layout_alignparenttop="true" /> <linearlayout andro

php - issue on printing woocommerce notices after user registration redirect -

i'm playing filter ( woocommerce_registration_redirect ) log out user after registeration , show temporary message. here's i've done add_filter( 'woocommerce_registration_redirect', 'redirect_after_register' ); function redirect_after_register() { wp_logout(); wc_add_notice( __( 'some message', 'woocommerce' ), "notice" ); return wc_get_page_permalink( 'myaccount' ); } after user registration, redirect him account page, wc_print_notices() must display custom notice message. unfortunately, doesn't' work , message doesn't appear. can on this? you're trying message appear after re-direct, correct? code seems add notice page before redirect. have devise mechanism fire function after re-direct happens. same problem faced try upon plugin activation. can use same solution in codex: https://codex.wordpress.org/function_reference/register_activation_hook

excel vba - VBA CommandBars.ExecuteMso ("PasteAsTableSourceFormatting") with link to Source -

i pasted table excel powerpoint code: pptapp.commandbars.executemso ("pasteastablesourceformatting") everything works fine. how link source range? you can use function provided @jamieg reference pasted shape( related question ), can access range of pasted shape accessing linked properties: dim shp shape set shp = getpastedshape() 'assuming pasted shape contains excel spreadsheet if shp.type = msoembeddedoleobject shp.oleformat.object.workbook.sheet(1).range("a1") end if

Join table in Mysql to create new table -

how join 2 tables in mysql database create third permanent table updated other 2 tables updated? as stated in comment creation of view simple as: create view permanent_join_table select add select statement point on , replace permanent_join_table name require.

Java ScheduledExecutorService ScheduleWithFixedDelay adding unexpected delay after some iterations? -

i ran scheduling program on 2 m/c both windows different configuration- public class testscheduling { static boolean header = false; static scheduledexecutorservice m_scheduleservice; public static void main(string[] args) throws ioexception { workerthread worker = new workerthread(); m_scheduleservice = executors.newscheduledthreadpool(1); m_scheduleservice.schedulewithfixeddelay(worker, 1, 1, timeunit.milliseconds); } static public class workerthread implements runnable{ public workerthread(){ } @override public void run() { try { processcommand(); } catch (interruptedexception e) { // todo auto-generated catch block system.out.println("something wrong in thread"); e.printstacktrace(); } } private void processcommand(

c# - Wait 5 seconds in Universal App -

i need make pause in windows 10 uwp app. and thing want wait 5 seconds next acton. tried task. slepp pressed button frozen... pause should here: loading.isactive = true; //int period = 5000; //threadpooltimer periodictimer = //threadpooltimer.createperiodictimer(timespan.frommilliseconds(period)); loading.isactive = false; how can make 5s pause? you use task.delay() method: loading.isactive = true; await task.delay(5000); loading.isactive = false; when using method ui doesn't freeze.

How to display form validation constraints message on GWT Material inputs using Editor and Validation Framework from Presenter's class? -

i use: gwt-platform gwt validation gwt uieditor framework gwt material inputs after constraints validation display error messages. supported gwt material inputs, materialtextbox using method:  materialtextbox.seterror("please provide name"); the problem can executed view class: public class loginview extends viewwithuihandlers<loginuihandlers> implements loginpresenter.myview { interface binder extends uibinder<widget, loginview> {} /** driver link proxy bean view. */ public interface editordriver extends simplebeaneditordriver<loginmodel, loginview> { } @uifield materialtextbox email; @uifield materialtextbox password; @uifield materialbutton loginbutton; @uifield materialcheckbox keepmeloggedincheckbox; @inject loginview(binder uibinder) { initwidget(uibinder.createandbindui(this)); addclickhandlertologinbutton(); } //@uihandler("loginbutton") private void onl

html - Remove the top margin of header in bootstrap -

Image
html <div class="container-fluid"> <div class="row"> <div class="page-header header_site"> <h1><font>abc company</font></h1> </div> </div> </div> css code: .header_site { background-color: darkblue; } font { color: white; margin: auto 160px auto 160px; } i want remove top-margin marked in following figure. give h1 , page header margin-top of 0 , make sure body doesn't have padding: body { padding: 0; } .page-header, .page-header h1 {margin-top:0;} example bootply if need h1 move down bit, give padding-top

python - My file has no length? Even though it does -

def file_contents(): global file_encrypt encryption_file = input("what name of file?") file_encrypt = open(encryption_file, 'r') contents = file_encrypt.read() print (contents) ask_sure = input("is file encrypt?") if ask_sure == "no": the_menu() this part of code opens file user enters, right? there no real problems here. def key_offset(): key_word = '' count = 0 total = 0 while count < 8: num = random.randint (33, 126) letter = chr(num) key_word = key_word + letter count = count + 1 offset = ord(letter) total = total + offset print("make sure copy key decryption.") if count == 8: total = total/8 total = math.floor(total) total = total - 32 print(key_word) return total this part calculates offset , etc etc. once again no problems here. def encrypting(): file = fi

angularjs - Is it okay to handle all the $http errors in controller? -

in services, i'm invoking rest services , returning promises controllers. error's handled @ controllers using catch below, myservice.getdata(url).then(getdatasuccess).catch(exception.catcher('contact admin : ')); my question here is, since real $http calls made @ service, should have write catchers in service or catching in controller fine?, scenario 1: function getdata(url){ return $http.get(url); } scenario 2: (nested calls make combined results) function getotherdata(url){ var defer = $q.defer(); $http.get(url).then( function(response){ $http.get(nextservice).then( function(res){ defer.resolve('combined data'); } ) } ); return defer.promise; } both service method not handling errors. instead returns promise. there situation kind o

C++ w/ OpenGL Pixel Perfect Plot -

i need plot pixel on window, according position in pixels in integers, not floats. like, example, if plot 0, 0 top left corner of window, 1,1 1 pixel right of 0, 0, , 1 pixel below 0. guess need kind of grid. don't care if 0, 0 origin how is, need count pixels, not having 1 max , -1 min, or whatever. things have tried: thought window width ^-1 * x plotting, , work, not time. anyways, how go doing this? have done x position / screen width, , works best, stops working every 10 or pixels. first of all, opengl doesn't guarantee pixel perfect placement in cases. however, there common gotcha: center of each pixel not have integer coordinates if pixel coordinates. here's diagram of bottom-left pixel in opengl viewport. +y ^ | +-----+ | | | o | | | +-----+---> +x if data transformed each pixel has width , height of 1 unit, center of pixel @ (0.5, 0.5) . if draw gl_point @ pixel, coordinates should (0.5, 0.5) . if draw rectangle, go (0,0)

Google Sheets: count occurrences of a string in different columns -

cola colb colc cold cole date id1 id2 id3 id4 1/12/2016 79858 1219 1/15/2016 761 159473 1/19/2016 107597 36204 1/19/2016 109374 93360 1/19/2016 2040 1/19/2016 115902 83366 12617 1/19/2016 7902 1/19/2016 2040 34312 1/19/2016 111954 1/19/2016 2040 116886 1/20/2016 90553 76985 1/20/2016 85454 15933 1/20/2016 88148 1/20/2016 115902 35453 93364 1/20/2016 58459 1/20/2016 49432 112242 75566 154497 1/22/2016 101672 58459 1/22/2016 1/25/2016 1211 2040 39552 1/25/2016 752 i'm trying count number of times id present in range colb:cole if date between timeframe. with =countif(b2:e,"79858") can count number of times specific id appears in columns ids, can't add date in countifs function because size of array

javascript - sidebar disappear when window is at a certain width -

i have created site side bar. sidebar has been made change size window shrinks there still isn't enough space on page. have been looking around find way can have side bar disappear when screen shrunk. there needs button can press bring sidebar until mouse isn't on sidebar more. thought mobile devices to. have been looking while can't seem right. code below body :) body { margin: 0; background: -webkit-linear-gradient(left, lightblue,#ffff66, #ff3333 ); /* safari 5.1 6.0 */ } ul { list-style-type: none; margin: 0; padding: 0; width: 25%; position: fixed; height: 100%; overflow: auto; } li { display: block; color: #000; padding: 8px 0 8px 16px; text-decoration: none; } li a.active { background-color: #4caf50; color: white; } li a:hover:not(.active) { background-color: #555; color: white; } <ul> <li><a class="active" href="

genetics - Best way to create a Punnett Square in PHP? -

Image
i've hunted high , low answers can't find helpful. i'm working on genetics project, , need create script can generate punnett square genetics passed. the sort of thing i'll working bbee x bbee , there longer strings bbeewwss x bbeess . it result in bbee , bbee , bbee i've had ideas on using arrays split alleles , combine them feel might quite costly resource wise. is there smart way of achieving i'm trying do? thanks info, andy i know after php solution, there solution written in javascript might easier work with: https://github.com/armatronic/punnett-squares-js here's preview of how looks:

matlab - Algorithm that process the autocorrelation function for each frame in order to extract the pitch period during that frame -

i have speech signal divided n frames. have loop loops through each frame , calculates auto correlation. don't know how can extract pitch period of each frame. there function can use? snippet of code have follows: for j = 0:n frame{j+1} = y1((framelength*(j))+1 : framelength*(j+1)); = minimumlag:maximumlag autocorrelation(i) = autocorrelate(framelength,i,frames{j+1}); end; end; see reference link looks simple peak search on resultant sequence. reference suggests 2nd strongest peak.

loops - C# Print word number of times depending on the input value -

print word in program number of times given user. this attempt: console.write("enter number of times print \"word!\": "); int number = console.readline(); if(number > 0) console.writeline("word!"*number) this not work. how achieve this? you need execute statement number of times user has specified, c# has few convenient ways. among them are: a for loop: console.write("enter number of times print \"word!\": "); int number = int32.parse(console.readline()); for(int = 0; < number; i++) console.writeline("word!") or while loop: while(number > 0){ console.writeline("word!") number--; } also notice console.readline() returns string , , need int . remedy used int32.parse .

java - Android gradle app:DexDebug error Parse.com -

i have build android app , have error when trying compile app error:execution failed task ':app:dexdebug'.>com.android.ide.common.process.processexception: org.gradle.process.internal.execexception: process 'command '/library/java/javavirtualmachines/jdk1.7.0_79.jdk/contents/home/bin/java'' finished non-zero exit value 2 this gradle file: apply plugin: 'com.android.application' android { compilesdkversion 22 buildtoolsversion "22.0.1" defaultconfig { applicationid ******** minsdkversion 15 targetsdkversion 22 versioncode 5 versionname "1.211" // multidexenabled true } buildtypes { release { minifyenabled false proguardfiles getdefaultproguardfile('proguard-android.txt'), 'proguard-rules.pro' } } } repositories { mavencentral() maven { url 'https://maven.fabric.io/public' } } depend

sql - mysql multiple join with same table and grouping by category -

i need query last news grouping category (category limit 5) , order published_at. me? tables news 1. id 2. caption 3. published_at category 1. id 2. name news_has_category 1. news_id 2. category_id sample output caption01.. 2016-01-28 category_id = 4 caption02.. 2016-01-27 category_id = 4 caption03.. 2016-01-26 category_id = 4 caption04.. 2016-01-25 category_id = 4 caption05.. 2016-01-24 category_id = 4 caption06.. 2016-01-28 category_id = 3 caption07.. 2016-01-27 category_id = 3 caption08.. 2016-01-26 category_id = 3 caption09.. 2016-01-25 category_id = 3 caption10.. 2016-01-24 category_id = 3 caption11.. 2016-01-28 category_id = 6 caption12.. 2016-01-27 category_id = 6 caption13.. 2016-01-26 category_id = 6 caption14.. 2016-01-25 category_id = 6 caption15.. 2016-01-24 category_id = 6 i tried creating tables in mysql per table structure. first need group category , date in grouped categ

Combining the common elements in two lists in R, using only logical and arithmetic operators -

i'm attempting work out gcd of 2 numbers (x , y) in r. i'm not allowed use loops or if, else, ifelse statements. i'm restricted logical , arithmetic operators. far using code below i've managed make lists of factors of x , y. xfac<-1:x xfac[x%%fac==0] this gives me 2 lists of factors i'm not sure go here. there way can combine common elements in 2 lists , return greatest value? thanks in advance. yes, max(intersect(xfac,yfac)) should give gcd.

opencv4android - Cant find .so files in openCV 3.1.0 SDk for android 3.1.0 -

i looking .so files on opencv 3.1.0 android imported android studio app. cant seem find files. the file name might have changed, still under native libs folder, extracted opencv-3.1.0-android-sdk.zip archive. for example, v7a under: /opencv-android-sdk/sdk/native/libs/armeabi-v7a/libopencv_java3.so

r - Memory bottleneck in seqdist? -

is possible there memory bottleneck in seqdist()? i'm researcher working register data on windows x64 computer 64 gb of ram. our data consists of 60,000 persons, , @ moment i'm working on data has 2.2 million lines in spell format. can't run seqdist on (method="om", indel=1, sm="trate", with.missing=true, full.matrix=false), error message same in here , important part seems point not large enough memory: "negative length vectors not allowed". ok, seqdist() doesn't seem utilize whole ram. right i'm running on sample of 40,000 persons, , seems go through, r using less 2 gbs of ram. if run seqdist() on 60,000 persons, error. might there size limit of 2^31-1 in there somewhere? calculating ward clusters readily utilizes available ram. i've had use 40 gbs of ram, @ least proves r capable of utilizing large amounts of ram. edit: maximum number of cases 46341. warning though, eats memory if size <= 46341. example: librar

embed bulk data for post-deployment script in sql server data tools (SSDT) -

in class libraries possible use embedded resources , access them in code. can use embedded resources (e.g. tab separated text files) in ssdt use them 'seeding data' in post deployment script? prefer not use hard-coded paths. as can not that, since scrip execute @ sql server has no access local drive file is. have done before copy file inside script variable xml type. example: declare @x xml = n '..........' , manipulate variable insert in desired table.

XPages - Dojo Accordion Container with Panes Autohieght -

i have dojo accordion panes. whatever did, couldn't solve problem. accordion pane's height same accordion pane has maximum height. i want high enough according it's content. mean automatically high. add css xpage or theme: .dijitselected .dijitaccordioncontainer-child { height: auto !important; } dojo accordion's pane open correct height then. use theme "bootstrap3.2.0" alternatively accordeon works theme out of box expected.

javascript - Image and data upload to database,using php -

got code upload new products db since im new php,ive got copied several sources seems on place,and syntax alright,but still no success in uploading image & inserting data db upload.php page - <?php require "dbconn.php"; require "functions.php"; if(isset($_post['submit'])) { $product_name = strip_tags($_post['name']); $product_price = strip_tags($_post['price']); $category = strip_tags($_post['category']); } $target_dir = "img/'.$category.'/"; $target_file = $target_dir . basename($_files["filetoupload"]["name"]); $uploadok = 1; $imagefiletype = pathinfo($target_file,pathinfo_extension); // check if image file actual image or fake image if(isset($_post["submit"])) { $check = getimagesize($_files["filetoupload"]["tmp_name"]); if($check !== false) { echo "file image - " . $check["mime"] . "."

Syntax error with INSERT INTO Access vba -

when run following code, receive syntax error insert statement. prior executing docmd step, locals window shows value of valuestring string value of "1/4/2016" i assume error has string being entered date field, not sure how fix it. formdate formatted date , data1 not declared, though shows in locals window date, #1/4/2016# public sub import2(filename variant) dim wb object, ws object dim xl object set xl = createobject("excel.application") dim qs string dim valuestring string 'opens workbook, populates data1, etc. set wb = xl.workbooks.open(filename) set ws = wb.worksheets("for export") data1 = ws.cells(2, 1) data2 = ws.cells(2, 2) data3 = ws.cells(2, 3) valuestring = "(" & data1 & ")" qs = "insert maf (formdate) values & valuestring" docmd.runsql qs 'currentdb.execute qs modify this: da

How to set submenu items to Wordpress? -

Image
here menu working at: i have added submenu items under menu item. but not work @ all. how can add submenu items? or @ least how check if menu using can that? here page working at: http://darnicgaz.md/?lang=en_us ok have tested site. submenu displaying fine in mobile , display none in web view. style.css line no 1110 #primary-menu ul ul, #primary-menu ul li .mega-menu-content { display:none } remove display :none style

php - Selecting the right data for a user -

Image
i have 2 tables in data base u_id of table tasks foreign key of id table users my code <?php require("common.php"); if(empty($_session['user'])) { header("location: login.php"); die("redirecting login.php"); } $query = " select id, username, eid users id <> '5' "; $query1 = " select t_id, task_tom, u_id tasks order t_id desc limit 1 "; try { $stmt = $db->prepare($query); $stmt->execute(); } catch(pdoexception $ex) { die("failed run query: " . $ex->getmessage()); } $rows = $stmt->fetchall(); try { $stmt1 = $db->prepare($query1); $stmt1->execute(); } catch(pdoexception $ex) { die("failed run query: &qu

regex - regular expression - replace a word by a space -

i have line , wants replace not dots , underline space. now replace word "german" (without quotes) blank line . can ? preg_replace('/\(.*?\)|\.|_/i', ' ', best regs edit: public function parsemoviename($releasename) { $cat = new category; if (!$cat->ismovieforeign($releasename)) { preg_match('/^(?p<name>.*)[\.\-_\( ](?p<year>19\d{2}|20\d{2})/i', $releasename, $matches); if (!isset($matches['year'])) preg_match('/^(?p<name>.*)[\.\-_ ](?:dvdrip|bdrip|brrip|bluray|hdtv|divx|xvid|proper|repack|real\.proper|sub\.?fix|sub\.?pack|ac3d|unrated|1080i|1080p|720p|810p)/i', $releasename, $matches); if (isset($matches['name'])) { $name = preg_replace('/\(.*?\)|\.|_/i', ' ', $matches['name']); $year = (isset($matches['year'])) ? ' ('.$matches['year'].')' : ''; return trim($name).

Git merge auto-add all new lines -

//edited clarity is there way actually, or theoretically merge 2 commits , keeps of different content between them. suppose have master branch single file called index.js //master //index.js alert('a'); alert('z'); two branches off of master this: //branch 1 //index.js alert('a'); alert('b'); alert('z'); //branch 2 //index.js alert('a'); alert('c'); alert('z'); the ideal automerge result merging branch 1 branch 2 be //branch 2 //index.js alert('a'); alert('b'); alert('c'); alert('z'); is there anyway achievable? your diagrams confusing, , don't justice point trying make. basic question can preserve commits in 2 feature branches such appear in master branch whence created. git has tool doing this, , called git rebase . consider following scenario: master: -- b -- c branch1: -- b -- d branch2: -- b -- e in example, both branch1 , branch2 branched o

Automate Azure Deployment -

i'm trying understand automation deployment options existing in azure. wanted build simple description of components, similar wordpress template available in marketplace, doesn't need command line run. so far i've seen different approaches using powershell, cli , 1 api. didn't quite understand them, can me understand different options available? , main problem, how build command line free template azure, ones available in marketplace (any tutorial?). thanks. first of all, should understand there 2 different deployment models in azure: service management model (asm, iaasv1, paasv1) or classic deployment model. resource manager (arm, iaasv2, paasv2) deployement model. details: https://azure.microsoft.com/en-us/documentation/articles/resource-manager-deployment-model/ different models , different approaches azure resource manager gives possibility use json templates deploy content of entire resource group 1 click/command (so, 1 json files can desc

mpxj - Unsupported encoding command ansicpg949 -

using mpxj~, .mpp file upload. net.sf.mpxj.mpp.mppreader called -> read(inputstream is) error code: projectreader reader = new mppreader (); projectfile project; try { project = reader.read(uploadfile.getinputstream()); error file : rtfparserkit mpxj bug ticket : http://sourceforge.net/p/mpxj/bugs/289/ help~ java.lang.illegalargumentexception: unsupported encoding command ansicpg949 @ com.rtfparserkit.parser.standard.standardrtfparser.processencoding(standardrtfparser.java:349) @ com.rtfparserkit.parser.standard.standardrtfparser.processcommand(standardrtfparser.java:150) @ com.rtfparserkit.parser.raw.rawrtfparser.handlecommand(rawrtfparser.java:278) @ com.rtfparserkit.parser.raw.rawrtfparser.handlecommand(rawrtfparser.java:241) @ com.rtfparserkit.parser.raw.rawrtfparser.parse(rawrtfparser.java:87) @ com.rtfparserkit.parser.standard.standardrtfparser.parse(standardrtfparser.java:50) @ com.rtfparserkit.converter.text.abstracttextconverter.convert(abstracttextco

python - Django Test Runner Not Finding Test Methods -

i upgraded django 1.4 1.9 , realized weird going on tests. here project structure: project manage.py app/ __init__.py tests/ __init__.py test_mytests.py the test_mytests.py file looks this: from django.test import testcase class mytests(testcase): def test_math(self): self.assertequal(2, 2) def test_math_again(self): self.assertequal(3, 3) the test runner can find of tests when run ./manage.py test app or ./manage.py test app.tests . when try running ./manage.py test app.tests.mytests get: file "/usr/lib/python2.7/unittest/loader.py", line 100, in loadtestsfromname parent, obj = obj, getattr(obj, part) attributeerror: 'module' object has no attribute 'mytests' if change test class name test_mytests can run ./manage.py test app.tests.test_mytests , find tests. reading django docs though , seems file name , class name don't have same. in either case showed above still can't run ind

javascript - Perform an action on all the member of JS object -

i have js object like object {id: 1, name: "grain", price: 26.0, dm: 2.0} i want divide float values 2 . appreciated traverse through object , check float values. divide: for (var prop in obj) { var n = obj[prop]; if(n === number(n) && n % 1 !== 0) { obj[prop] = n / 2; } } please note: the above match 14.2 , not 14.0 or 14 of course. for floats without decimal places use !isnan(n) instead of n === number(n) && n % 1 !== 0 . match integers . (will match 14.2 , 14.0 , 14 ) if want match floats , printed out floats use: !isnan(n) && n.tostring().indexof('.') . (will match 14.2 , 14.0 , not 14 ) of course traverse $.each(..) also.

hadoop - How to tell distcp to ignore "file not found ..." and fall through to the next files? -

we have full hdfs backup using distcp takes long time run, of data on hdfs "moving", is created , deleted. results in mappers failing java.io.filenotfoundexception: no such file or directory . such files unimportant, want backup best can. now seems -i "ignore failures" not quite want because ignore @ map level rather file level, if map task fails files associated map task ignored. want file ignored.

ssis - Capturing the max value in a data flow -

i'm getting ssis after several years of not using it. here need do. 1) read value table , store variable 2) create data flow retrieve number of rows having value greater value retrieved in #1. 3) store rows retrieved in #2 table 4) determine maximum value of particular column rows read in step #2 , update table referenced in #1. the first 3 steps easy, straightforward , working. however, i'm not best way accomplish #4. best can subjective straight forward mechanism add multicast component prior destination. the multicast allow data flowing through pipeline show in more 1 stream. done through pointers actual data buffers , doesn't result in physical copies of data being strewn about. from multicast, connect aggregate component , perform max operation on whatever column you're using. you know have 1 row coming aggregate i'd use ole db command component update table #1. like update etlstatus set maxvalue = ? packagename = ?; and you&#

android - Volley Could not validate certificate -

i using volley month now, , encounter error. 01-28 01:52:48.973 17167-17167/? e/response error: com.android.volley.noconnectionerror: javax.net.ssl.sslhandshakeexception: com.android.org.bouncycastle.jce.exception.extcertpathvalidatorexception: not validate certificate: certificate expired @ sun jan 01 07:59:59 gmt+08:00 2017 (compared sat jan 28 01:52:48 gmt+08:00 2017) before happened. using app google api. have more 1k request 1day.

android - How to detect a white document (or a card) on a white background (opencv) -

i using opencv , android . the opencv function "findcontours" returns detected contours white document on darker background . whereas white document on white(or lighter) background not detect . could please suggest way in android using opencv . thanks in advance :) the opencv function "findcontours" returns detected contours white document on darker background . this not accurate. according opencv documentation findcontours(...) "finds contours in binary image". therefore you'll need binarize image first, either using threshold or more sophisticated approach. there nice tutorials on matter, this one . though many of them c++ api, of opencv methods have counterparts in java.

c - fgets not waiting for user input -

in given code fgets not waiting input. i tried using scanf it's giving unusual error(exception thrown @ 0x0f74ddf4 (ucrtbased.dll)). i'm using visual studio 2015 debugging code. can explain why fgets not waiting input? #include<stdio.h> #include<stdlib.h> #include<process.h> //global-variable declartion #define max 1000 //global-structures declaration struct census { char city[max]; long int p; float l; }; //global-structure-variable declaration struct census cen[] = { 0,0,0 }; //user-defined function void header(); void header() { printf("*-*-*-*-*census_info*-*-*-*-*"); printf("\n\n"); } //program starts here main() { //variable-declaration int = 0, j = 0; //int no_of_records = 0; //function call-out header(); printf("enter no. of city : "); scanf_s("%d", &j); printf("\n\n"); printf("enter name of city, population , literacy level"); printf("\n\n"); (i = 0;i <

asp.net - get username after login -

Image
i want username after login doesn't work. public partial class login : system.web.ui.page { string struser; protected void login1_loggedin(object sender, eventargs e) { struser = membership.getuser().username; response.redirect("home"); } protected void login1_authenticate(object sender, authenticateeventargs e) { struser = membership.getuser().username; response.redirect("home"); } } this error: membership.getuser().username null, because new principal object not attached current httpcontext object yet. so need explicitly retrieve logged-in user using username login control. update: credit jadarnel27 protected void login1_authenticate(object sender, authenticateeventargs e) { // username login control , retrieves user info explicitly membership user = membership.getuser(login1.username); ... }

java - Error:(124, 9) error: method does not override or implement a method from a supertype -

i'm trying develop complete android login registration system php , mysql android. if user forget password, new password send e-mail. follow tutorial . forgetpassword email = (edittext) findviewbyid(r.id.forpas); forgetpassword.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { if ((name.gettext().tostring().trim().length() == 0) || (email.gettext().tostring().trim().length() == 0)) { toast.maketext(getapplicationcontext(), "name or e-mail cannot null", toast.length_long).show(); return; } else { netasync(); } } }); private class netcheck extends asynctask { private progressdialog ndialog; @override protected void onpreexecute(){

php - mysqli execute() executing successfully but is not fetching the records -

this question exact duplicate of: trouble mysqli 4 answers i executing select query using mysqli ... /** ------------ queries ---------- **/ $stmt = $mysqli->prepare("select * dept"); if(! $stmt) { echo "statement not prepared well"; } else { echo $mysqli->error; } if (!$stmt->execute()) { echo "execute failed: (" . $stmt->errno . ") " . $stmt->error; } // add else else{ echo "query executed no result fetch"; } if (!($res = $stmt->get_result())) { echo "getting result set failed: (" . $stmt->errno . ") " . $stmt->error; } /** ------------------------------- **/ #------result ---- var_dump($res->fetch_a

left join - Navicat MySQL Query Column is null when joining two tables(customer and order table relationship) -

Image
as can see in image custom created column "customer" null, when use right join shows up, idorder nulled... check if there null values in customer table, if there null values in strings, result of concat null too.

jquery - How to check which table cell triggered an action JavaScript -

i new web development , hang of doing simple tasks working on project , turns out task want carry out have use javascript having little knowledge of javascript can't figure out how want , have searched online haven't been able finding of use: how know element clicked within table? how access specific cell of clicked table row in javascript ... here project code have written far: <!doctype html> <html> <head> <meta charset="utf-8"> <title>menu</title> <script> function toggletable() { var ltable = document.getelementbyid("menulist"); ltable.style.display = (ltable.style.display == "table") ? "none" : "table"; } </script> </head> <body> <table width="300" border="1" id="menuitems"> <tbody> <tr> <td onclick="toggletable()" id="cell1">&nbsp;on-menu</td>

c# - How to get selected dropdownvalue in AjaxFileUpload onuploadComplete event? -

<%@ page language="c#" autoeventwireup="true" codefile="test.aspx.cs" inherits="test"%> <%@ register assembly="ajaxcontroltoolkit" namespace="ajaxcontroltoolkit" tagprefix="asp" %> <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> </head> <body style="height: 162px"> <form id="form1" runat="server"> <div> <asp:radiobutton id="mca" runat="server" text="mca" autopostback="true" oncheckedchanged="mca_checkedchanged" /> <br /> </div> <asp:dropdownlist id="dropdownlist1" runat=&