Posts

Showing posts from July, 2011

python - Go to next iteration after finding string by looping through text file? -

i'm trying iterate through text file organized this: student 1 name student 1 grade student 2 name student 2 grade ... student n name student n grade once i've found students name on line, how can change grade? here's code i've come with, can't figure out how change line following students name. gradebook = open('gradebook.txt', 'r') studentname = input("what students name?") line in gradebook: if line.rstrip() == studentname: #i want insert code here change text on line #after line studentname found. else: print("the student not found.") temp = [] open('data', 'r') f: line in f: if "student 2" in line: try: # student 2 grade line = next(f) temp.append(changed_line) # in case student name last line of file except stopiteration: b

Python "return" difficulties -

first, let me have done thorough research trying understand. not understand explanations others have given (which understood asked question). code have problems with: def tax(bill): """adds 8% tax restaurant bill.""" bill *= 1.08 print "with tax: %f" % bill return bill def tip(bill): """adds 15% tip restaurant bill.""" bill *= 1.15 print "with tip: %f" % bill return bill meal_cost = 100 meal_with_tax = tax(meal_cost) meal_with_tip = tip(meal_with_tax) when delete first "return bill" , run it, first number there error when tries calculate second number. def tax(bill) takes 100 , outputs 108 right? if delete first "return bill", why def tip(bill) not doing it's calculations 108 instead of giving error? i have problem grasping basic concepts of programming. i've been learning intensely 3 months , am. slippery subject mind grasp , appreciat

curl - PHP: check if image file exists using fopen -

this question using fopen check if file exists, not curl or getimagesize alternative methods not asking about. i having been using following function in code couple years without problems , returning false , on valid images. don't know if accidentally created typo or if host changed version of php or may have caused appreciate if can spot might going wrong. here code: function image_exist($url) { if (@fclose(@fopen( $url, "r "))) { // true; return true; } else { // false; return false; } } this returning false on valid images. why use fopen() , fclose() when there's a function purpose? function image_exist($url) { return file_exists($url); } edit: you're correct not work remote files on http(s).

Symfony Many to Many relationship Persistent collection -

many many relationship: i have 2 tables joined many many relationship. account group entity: /** * @var arraycollection * @orm\manytomany(targetentity="account", inversedby="accountgroups", cascade={"persist"}) * @orm\jointable( * joincolumns={@orm\joincolumn()}, * inversejoincolumns={@orm\joincolumn(name="id", referencedcolumnname="id")}) **/ protected $accounts; account entity: /** * @var arraycollection * @orm\manytomany(targetentity="accountgroup", mappedby="accounts", cascade={"persist"}) * */ protected $accountgroups; i tried many many relationship accountgroup entity using find() , findall(). not getting data related accounts though has. getting persistent class collection default dump. whether might relationship problem ? code used fetch : $entitymanager->getrepository('accountgroup')->find(1); thanks @cerad , @stiven llupa com

kubernetes - what's the difference between authorization and admission controller? -

admission controller intercepts requests after authentication , authorization, result in permit or deny request. point of view, can control in more detail. what's design consideration admission controller? an example might clarify difference resource quota admission controller: http://kubernetes.io/v1.0/docs/design/admission_control_resource_quota.html . user might have authority read pods in particular namespace, not quota create new ones.

Loop through multidimensional Hash of Arrays in Perl -

i have multidimensional hash of arrays represent student's grade in each subject first 4 assignments. my %students_grades = ( colton => { english => [ 90, 95, 80, 75 ], mathematics => [ 77, 89,94, 100 ], }, ); the syntax bit off here's code creates hash of arrays above. #!/usr/bin/perl %students_grades; $students_grades{'colton'}{'english'}[0] = 90; $students_grades{'colton'}{'english'}[1] = 95; $students_grades{'colton'}{'english'}[2] = 80; $students_grades{'colton'}{'english'}[3] = 75; $students_grades{'colton'}{'history'}[0] = 77; $students_grades{'colton'}{'history'}[1] = 89; $students_grades{'colton'}{'history'}[2] = 94; $students_grades{'colton'}{'history'}[3] = 100; how loop through student's grades received in history using foreach loop? right i'm looping through using loop. my $num_of

xcode - Swift 2 fatal error: unexpectedly found nil while unwrapping an Optional value -

error found line: self.picture.image = uiimage(named: pictures[closestbeacon.minor.integervalue]!) how solve? you can prevent crash safely unwrapping pictures[closetbeacon.minor.integervalue] if let statement. if let myimage = pictures[closetbeacon.minor.integervalue] { self.picture.image = uiimage(named: myimage) }

layout - JavaFX Resizing VBOX dynamically -

i having problems vbox, looked other questions me, sadly nothing worked. have vbox bunch of slider , buttons, , happens can rezise pretty want. can make small buttons inside disappear, or can make big cover other parts of program. tried vbox.setmaxsize , vbox.setminxsize, nothing happed. should buttons , sliders inside it? though since buttons , sliders vbox childrem, changes made on vbox them also. post controller class followed fxml file, fell free tell me if other classes needed. thank much. controller package fotofinish; import java.io.file; import java.net.url; import java.util.resourcebundle; import java.util.logging.level; import java.util.logging.logger; import javafx.application.platform; import javafx.beans.value.observablevalue; import javafx.event.actionevent; import javafx.fxml.fxml; import javafx.fxml.initializable; import javafx.scene.control.colorpicker; import javafx.scene.control.radiobutton; import javafx.scene.control.scrollpane; import javafx.scene.control

JavaScript table to shrink to fit its content -

the following code produces cells higher height needed want cells fit inner canvas in order draw diagonal on them var miglobal = []; var ref1 = document.createelement("table"); var refx = document.createelement("tbody"); ref1.appendchild(refx); var ref2, ref3; console.log(ref1); (var y = 0; y < 25; y++) { ref3 = refx.insertrow(y); (var x = 0; x < 25; x++) { ref2 = ref3.insertcell(x); var cnv = document.createelement("canvas"); cnv.setattribute("id", ("mycnv" + (y * 25 + x)).tostring()); cnv.setattribute("height", "30px"); cnv.setattribute("width", "30px"); var cntx = cnv.getcontext("2d"); cntx.moveto(0, 0); cntx.lineto(30, 30); cntx.stroke(); miglobal.push(cntx); ref2.appendchild(cnv); }; }; document.body.appendchild(ref1); table { border: 2

java - Box2d body not responding to inputs -

i'm using libgdx , box2d , want make player's body jump. nothing happens when try use methods if it's moving. //gravity vector2 vector2 gravity = new vector2(0,-9.8); //box2d world world world = new world(gravity); //then created player body public void createplayer(){ bodydef def = new bodydef(); def.type = bodydef.bodytype.dynamicbody; def.fixedrotation = true; def.position.set(80, 200); player = world.createbody(def); polygonshape shape = new polygonshape(); shape.setasbox(20, 20); player.createfixture(shape, 1f); shape.dispose(); } //this jump method public void jump(){ if(gdx.input.justtouched() == true) { player.applyforcetocenter(0, 900, false); system.out.println("touched");//to make sure touch working` } } nothing happens , player's body falls until collides static body, every time touch screen prints out "touched" string. update not sure if reason why it's not w

java - "SSL23_GET_SERVER_HELLO:unknown protocol" After server upgrade -

recently build new windows 2012 server, tomcat 7.0.57 , java version "1.8.0_45". i getting below error, when connecting client openssl. working ie. new server: openssl> s_client -connect xxx.xxx.xxx.xxx:443 loading 'screen' random state - done connected(00000130) 5724:error:140770fc:ssl routines:ssl23_get_server_hello:unknown protocol:.\ssl\s 23_clnt.c:601: openssl> old server: (connecting fine) openssl> s_client -connect yyy.yyy.yyy.yyy:443 loading 'screen' random state - done connected(00000114) depth=1 /c=xx/o=yyyy ca1 verify error:num=19:self signed certificate in certificate chain verify return:0 --- certificate chain ......... ssl handshake has read 3064 bytes , written 282 bytes --- new, tlsv1/sslv3, cipher edh-rsa-des-cbc3-sha server public key 2048 bit compression: none expansion: none ssl-session: protocol : tlsv1 cipher : edh-rsa-des-cbc3-sha ....... can 1 tell why behaving this?? new server: windows 2012 r2 / jav

angularjs - ionic framework tabs with ng-repeat not working -

i building android app using ionic framework. facing issue using ionic tabs. ion-nav-view content not displaying using ng-repeat, same working out using ng-repeat . tab title displaying tab content showing blank. using ng-repeat <ion-tabs class="tabs-striped tabs-top tabs-background-positive tabs-color-light"> <ion-tab ng-repeat="infotabs in customerinfo" title="{{infotabs.tabval}}" href="#/customerview/{{infotabs.tabname}}"> <ion-nav-view name="customerview-{{infotabs.tabname}}"></ion-nav-view> </ion-tab> </ion-tabs> without using ng-repeat <ion-tabs class="tabs-striped tabs-top tabs-background-positive tabs-color-light"> <ion-tab title="general" href="#/customerview/general"> <ion-nav-view name="customerview-general"></ion-nav-view> </ion-tab> <ion-tab title="employment"

java - How does the values of an array changes when we passed it as an argument to other function? -

this question has answer here: is java “pass-by-reference” or “pass-by-value”? 74 answers are arrays passed value or passed reference in java? [duplicate] 7 answers when passed array argument function, original array gets changed, array should not changed right? please correct me if wrong. below passed int x=10 argument change(int a) function. value of original int x got changed. so how same code affects array , int in different way? public class runy { public static void main(string [] args) { runy p = new runy(); p.start(); } void start() { long [] a1 = {3,4,5}; long [] a2 = fix(a1); int x=10; int y= change(x); system.out.println(y); system.out.println(x); system.out.print(a1[0] + a1[1] + a1[2] + " "); system.ou

How to convert an integer type to an unsigned type?I'm coding in Java -

for example: public static void main(string[] args) { string str = "11111111111111111111111111111111"; int = integer.parseunsignedint(str, 2); system.out.println(a); }` result:-1 doesn't range of unsigned int type 0~2^32 - 1? try this, pass in int function public static long getunsignedint(int x) { return x & 0x00000000ffffffffl; }

delete code in trigger throwing up errors oracle -

i don't know how code throws errors. compiles correctly when used throws error. create or replace trigger trg_applications before insert or update of app_id, status_id on applications each row begin :new.app_id := seq_app_id.nextval; :new.app_date := sysdate; if updating , ( :new.status_id = 2 or :new.status_id = 5 or :new.status_id = 7 or :new.status_id = 8 ) insert app_history (srn, status_id, app_date) values (:old.srn, :old.status_id, :old.app_date); delete applications :new.status_id = 2; delete applications :new.status_id = 5; delete applications :new.status_id = 7; delete applications :new.status_id = 8; end if; end; this error message error ora-04091: table apex514.applications mutating, trigger/function may not see ora-06512: @ "apex514.trg_applications", line 14 ora-04088: error during execution of trigger 'apex514.trg_applications' the cause of mutating table error misuse of

winapi - Change the unit for setting position in TextOut, C++ -

i'm working on printing plugin c++, , starting working textout print text want. works great, apparently, positions textout uses params in pixels. there way set them in cm or mm? or other?. well, it's pretty simple. coordinates not in pixels, in coordinates of mapping mode. happens default mapping mode of dc mm_text has each coordinate unit 1 pixel on device. change mapping mode using setmapmode() coordinate system prefer use. can play window extents, viewport extents, , origins customize want. might want @ documentation setmapmode() , mm_lometric (or mm_himetric) mapping mode.

bash - Filtering Input files -

so i'm trying filter 'duplicate' results file. ive file looks like: 7 14 35 35 4 23 23 53 85 27 49 1 35 4 23 27 49 1 .... that mentally can divide item 1 , item 2. item 1 first 3 numbers on each line , item 2 last 3 numbers on each line. i've got list of 'items': 7 14 35 23 53 85 35 4 23 27 49 1 ... at point in file, lets line number 3 (this number arbitrary , example), 'items' can separated. lets lines 1 , 2 red , lines 3 , 4 blue. i want make sure on original file there no red red or blue blues - red blue or blue red, while retaining original numbers. ideally file go from: 7 14 35 35 4 23 (red blue) 23 53 85 27 49 1 (red blue) 35 4 23 27 49 1 (blue blue) .... to 7 14 35 35 4 23 (red blue) 23 53 85 27 49 1 (red blue) .... i'm having trouble thinking of (or any) way it. appreciated. edit: an filtering script have grabs lines if have blue or red on lines: #!/bin/bash while read name; grep "$name" twoitems

Android : Download images and mp3 audio from server -

i want download mp3 audio , images server.file downloaded not goes sd card folder.below code correct or not or wrong in downloading on store sd card folder.how work download media files , save sd card folder.thanks in advanced. here mp3 download code. public void downloadaudiofile(final string mp3url , final string strimagename) { new asynctask<string, string, string>() { @override protected string doinbackground(string... f_url) { int count; try { f_url[0] = mp3url; url url = new url(f_url[0]); urlconnection conection = url.openconnection(); conection.connect(); // music file length int lenghtoffile = conection.getcontentlength(); log.e("lenghtoffile "," = " + lenghtoffile); // input stream read file - 8k b

android - Adding data while parsing into next activity -

i doing app, takes name , phone number in first activity. should save values , parse next activity , vice versa. eg: in actvity 1 kept name1 & age1 --> save , in same activity again inserted name2 & age2--> save and when click display should display both values saved in activity. here mentioned 2 cases, may vary 10 or 20 or n. kindly, provide on way can make it? if want pass data between activities can use below cases : case : 1 you can pass data between activites through intent . in current activity, create new intent: intent = new intent(getapplicationcontext(), newactivity.class); i.putextra("variable_key","value"); startactivity(i); then in new activity, retrieve values: bundle extras = getintent().getextras(); if (extras != null) { string value = extras.getstring("variable_key"); } this passing data between activities. case : 2 you can make class of static , public arraylist's

asp.net - Code First Enable Migration -

this question has answer here: model backing db context has changed; consider code first migrations 9 answers i receive error: additional information: model backing 'applicationdbcontext' context has changed since database created. consider using code first migrations update database ( http://go.microsoft.com/fwlink/?linkid=238269 ). go link, , click on tutorial section enabling migrations has link on how this. think link goes? same page. documentation consistently horrendous. it seems should checkbox somewhere, or line of code need add, don’t know find it. healy in tampa the documentation on microsoft site isn't clear. first came across issue needed enable migrations when working on asp.net application relied on entity framework. the error thrown same: additional information: model backing 'applicationdbcontext' context h

plsql - procedure using record type -

i create procedure returns list of first 5 records. must use record type , table type. doing wrong? create or replace procedure procedure_example(v_table out v_rec) cursor cur1 select * ( select type_note, note dd_note order type_note) rownum < 5; type v_rec record ( v_type_note number(2) , v_note varchar(30)); type v_table table of v_rec index binary_integer; begin open cur1; loop fetch cur1 v_type_note, v_note; dbms_output.put_line(v_type_note || '. --- ' || v_note); exit when cur1%notfound; --enter code here end loop; close cur1; end procedure_example; the place declared types wrong. must declare type "v_rec" , type "v_table" in package procedure belongs, not inside procedure. here's improved version of code. first, declare these types in package: type v_rec record( v_type_note number(2), v_note varchar(30));

What is an appropriate value to store in a DATE MySQL variable if only month and year are known? -

suppose have mysql variable date_stored of date datatype. have month , year particularly date data stored in date_stored . no day information given. there guidelines on store in date_stored if month , year known? mysql manual says partial dates can stored. month , day ranges specifiers begin 0 because mysql permits incomplete dates storing such '2015-00-00' or '2015-10-00' . http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html#function_date-format so if day part not given can still store yyyy-mm-00 e.g '2015-10-00' also see below related posts. store incomplete date in mysql date field mysql datatype store month , year only sql datatype - how store year?

html - Trying to display nested div inline -

i have div made of nested elements having trouble displaying inline: https://jsfiddle.net/stref/bp5ze9pn/ #liverpool-circle { display: inline; } #kings-circle { display: inline; } #london-circle { display: inline; } #waterloo-circle { display: inline; } #padidngton-circle { display: inline; } just add 1 class don't have repeat css line https://jsfiddle.net/bp5ze9pn/4/ html <div id="liverpool-circle" class="circle"> <a onclick="liverpool();"> <div class="circle"> <h3 class="numbers">3</h3> </div> </a> </div> <div id="kings-circle" class="circle"> <a onclick="kings();"> <div class="circle"> <h3 class="numbers">7</h3> </div> </a> </div> <div id="london-circle" class=

javascript - Code works fine in JSFiddle but not in my browser -

i'm working on multiple dropdown menus used ranking. found excellent code stackoverflow: how prevent duplicate values in multiple dropdowns using jquery it works nicely on jsfiddle, can't seem code work offline in chrome or ie browser. can help? <script type="text/javascript"> $(document).ready(function() { $(".go").change(function() { var selval = []; $(".go").each(function() { selval.push(this.value); }); $(this).siblings(".go").find("option").removeattr("disabled").filter(function() { var = $(this).parent("select").val(); return (($.inarray(this.value, selval) > -1) && (this.value != a)) }).attr("disabled", "disabled"); }); $(".go").eq(0).trigger('change'); }); </script> it depends on &quo

jquery - Get Maximum value from JSON object using javascript? -

i have json like var jobject = [ { a:"a1", b:100, c:800 }, { a:"b1", b:300, c:400 } ]; i need maximum value json...it has return 800 if return key , column index you can this var jobject = [{ a: "a1", b: 100, c: 800 }, { a: "b1", b: 300, c: 400 }]; var res = math.max.apply(null,jobject.map(function(v) { // iterate on array element , getting max value result array var r = []; (var val in v) { // iterate on object inside array if (v.hasownproperty(val)) { var num = parseint(v[val], 10); // parsing value integer output r.push(isnan(num) ? 0 : num); // pushing value array, in case of `nan` pushing 0 } } return math.max.apply(null,r); // getting max value object values })); console.log(res);

string - Search entire text for images -

i have problem project. need search string images. want source of image , modify html form of img tag. example image form is: and want change to: <div class="col-md-3"> <hr class="visible-sm visible-xs tall" /> <a class="img-thumbnail lightbox pull-left" href="upload/uploader/up_164.jpg" data-plugin-options='{"type":"image"}' title="image title"> <img class="img-responsive" width="215" src="upload/uploader/up_164.jpg"><span class="zoom"><i class="fa fa-search"></i> </span></a> i have done part of this. i can find image, change form of html cannot loop images found in string. my code goes like using following function string between 2 strings // substring between function getbetween($var1="",$var2="",$pool){ $temp1 = strpos($pool,$var1)+strlen($var1); $resul

javascript - Click a button to highlight a field -

i'm working company document created in word. form never intended filled out digitally instead printed , filled out hand. there 5 check boxes across top followed 9 different sections of form. of sections need filled out regardless of checked @ top; others conditional depending on has been checked @ top. my goal digitize in way required fields highlighted. if click 3rd button top sections 3 , 4 highlighted. if click 1st button section 2 gets highlighted. if click first , 3rd buttons sections 2, 3, , 4 highlighted. unfortunately it's controlled document can't post here gives idea. i have microsoft office (2010), adobe acrobat, , gimp @ disposal. i'm not against writing vba or javascript make happen i've never gotten far hello world in either. thanks in advance ideas have offer! a bit late answer, can done acrobat. the easiest way @ field naming, , use hierarchical field names, allow group fields name. in present case, have sect.4.myfield

html - Input type hidden dosent hide in form when the value is larger in php -

i trying setup hidden input field value xml string obtained array . hidden field value displayed in html while when put normal text value in hidden field works fine. //a large sized associative array convert xml , set hidden field $item_array=array(); $xml=new simplexmlelement('<origindestinationoption/>'); array_walk_recursive($item_array,array($xml,'addchild')); echo '<input type="hidden" name="return-xml" value="'.$xml->asxml();.'" />'; ?> but displays value in html form.whats wrong code? note:i using codeigniter framewrok try echo '<input type="hidden" style="display:none;" name="return-xml" value="'.str_replace('"',"'",$xml->asxml());.'" />'; ?>

javascript - Broken images in simple HTML dom -

i using simple_html_dom.php library fetch required elements page www.lifehacker.com when fetch images images don't appers , links looks broken. code using <html> <head> <title></title> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"> </script> <script type="text/javascript"> $(document).ready(function(){ $("p").click(function(){ $(this).hide(); }); }); $(document).ready(function(){ $("h1").click(function(){ $(this).hide(); }); }); $(document).ready(function(){ $("a").click(function(){ $(this).hide(); }); }); $(document).ready(function(){ $("img").click(function(){ $(this).hide(); }); }); $(document).ready(function(){ $("href").click(function(){ $(this).hide(); }); }); </script> <style type="text/css"> br{ display: none; } </style> </head> <

Eclipse Java Virtual Machine Launcher jvm.cfg Error -

Image
whenever press run in eclipse, error: "error: not open 'c:\program files\java\jre1.8.0_60\lib\amd64\jvm.cfg' ". i tried reinstalling javas , up-to-date. my installed version jre jre1.8.0_66. it sounds eclipse looking older jre. in eclipse preferences 'window > preferences > java > installed jres' , update use path update 66 jre/jdk.

Executing Google Apps Script Functions from Mobile App -

i'm developing interface user uses google spreadsheet database. nowadays uses goole sheet mobile app (android , ios) update spreadsheet, , can't find way create interface or call function on mobile app. knows how can call function script i've created on google sheets mobile app? thanks! custom functions work mobile versions of google sheets.

sql server 2008 - SQL DeadLock in application -

we have ms sql server. we have application getting sql deadlock exception, tried reproduce issue "load testing" couldn't. it happens actual production scenario the exception error is: sqlexception transaction (process id 658) deadlocked on lock | communication buffer resources process , has been chosen deadlock victim. rerun transaction. is there way find exact root cause issue.??

binary - How to convert bit stream to bytes? -

some transmiter sends infinite sequence of bits: 00100100001111110110101010001000... (first transmited bit on left) some receiver receives bits , needs contatenate them bytes , save binary file. are 36, 252, 86, 17 (decimal) correct begining values of file? (for bits showed above). best regards. i know correct interpreation of bits important, need popular solution.

vb.net - MYSQL Combing Two tables From Multiple Row -

i have 2 tables, 1 products, other new purchases products. product table item qty 301 2 302 5 303 3 304 4 305 6 purchases table item qty status date 302 5 used 09-15-2015 303 5 reserve 09-20-2015 301 5 used 09-20-2015 302 5 reserve 09-20-2015 304 5 used 10-15-2015 303 5 reserve 10-15-2015 i want display how many quantity in product table, , join quantity of purchases table product table this initial sql query select product_name, product_quantity, quantity products left outer join purchases on products.id = purchases.product_id product_status !='deleted' , status != 'used'`. however, returned the items purchases table reserve. what want achieve is item qty reserved qty total 301 2 0 2 302 5 5 10 303 3 10 13 304 4 0

ios - One controller in landscape orientation -

i have app, consists of 1 tab bar controller contains 4 navigation controllers. can't find solution have 1 controller in hierarchy of navigation controllers in landscape mode. other controllers suppose portrait. appreciate on issue. in viewdidload(): of navigation controller want landscape, include: let value = uiinterfaceorientation.landscapeleft.rawvalue uidevice.currentdevice().setvalue(value, forkey: "orientation") be sure add following override too override func shouldautorotate() -> bool { return true }

javascript - Bind three select menus together -

i have json data in link below: first select menu belongs series. second select menu belongs chapters , third belongs pages. when change first select menu naruto 1 piece has load 1 piece chapters , last 1 piece chapter. how can achieve this? <select class="browser-default" ng-model="myoption" ng-options="manga.seri manga in bilgiler1"> <option value="" disabled selected>select manga</option> <option></option> </select> <select class="browser-default"> <option value="" disabled selected>chapter</option> <option></option> </select> <select class="browser-default"> <option value="" disabled selected>page</option> <option></option> </select> <img ng-repeat="" ng-src="/{{}}"> javascript: .factory('mmg', function($http){ var fveg= {};

MySQL : xyz_dept and number of employee working in xyz_dept using nested queries -

i retrieve find out no.of employees working in “sales” department along "sales" in retrieved table as: +-------+------------------+ | name | count(e.dept_id) | +-------+------------------+ | sales | 3 | +-------+------------------+ i can write following query: mysql> select d.name, count(e.dept_id) -> department d, employee e -> e.dept_id = d.department_id , d.name='sales'; but i've been taught nested queries improve efficiency of query. i'm trying rewrite same using nested query . go this: mysql> select count(*) -> employee -> dept_id = (select department_id -> department -> name='sales'); +----------+ | count(*) | +----------+ | 3 | +----------+ i tried many combinations no hope. how can obtain below table using nested query : +-------+------------------+ | name | count(e.dept_id) | +-------+-----------------

jquery - ajax with aspnet mvc never work -

i new web development , having problem ajax call load page dynamically. this js : $(function () { $('.trenfant').on('click', function (e) { var id = $(this).attr("id"); $.ajax( { type:"get", url: '@url.action("dossierenfant", "enfant")', data: {enfantid : id}, success: function (result) { $('#divdossierenfant').html(result); }, error: function (e) { alert('ca marche po...'); } }); }); }); now controler : public actionresult dossierenfant(string enfantid) { dossierenfantviewmodel model = new dossierenfantviewmodel(); model.enfant = personneappservice.recupererenfant(new guid(enfantid)); return view(model); } finally cshtml : <div> <div class="row"> <div class="panel panel-default"> <div class="panel-heading"

Linking User Type To Data In Google Analytics -

i'm working linking user type particular field in google analytics. example, if want know top search words user type "customers", i'm creating custom report in ga , adding in fields search word along custom dimension (user-type). search word not being linked particular user type. is there way of knowing search word came in user type ? google internally or have how link search words came user types? if user type dimension in reports, can use new segment in overview of site search , use condition includes in report type "costumers". report filter show data, search term, these specific type of user. hope i've helpd.

How to Convert following String to Json using Java? -

i need convert following string json format. below input expected output reference. input: employee driver report - edr -------------------------------- employee nbr: 123480 employee type: di cat: upl driver license: pp3p30 plate: rowp part number: 1006096 output: { "employee nbr": "123480", "employee type": "di", "cat": "upl", "driver license": "pp3p30", "plate": "rowp", "part number": "1006096", } sample code: map<string, string> keyvaluemap = new hashmap<string, string>(); string[] lines = rawtext.split(system.getproperty("line.separator")); for(string line: lines) { ....... keyvaluemap.put(keyandvalues[i], keyandvalues[i + 1]); } gson gson = new gsonbuilder().setprettyprinting().create(); string json = gson.tojson(keyvaluemap); could please me on how resolve this? thanks in advance. for each line get, have p

asp.net - How to modify CSS of ajax tool ValidatorCallout Extender -

i try use validatorcallout extender asp.net ajax site. have no idea on how change popup validator css. this extender has server cssclass property. provide class name of css class in markup. <style> .someclass { color: red; } </style> <ajaxtoolkit:validatorcalloutextender runat="server" targetcontrolid="controlid" cssclass="someclass" />

c# - WPF Unhandled Exception (ntdll.dll) Acces violation -

i'm creating wpf application (c#) uses multiple dll's (c++) created college of mine. in 1 of these there still bug acces violation error occurs. since fixing bug not top priority want catch exception in wpf application application not break , can continue. at moment application has multiple windows , 1 static class controls data shared between these windows. i've tried using application.dispatcherunhandledexception event not triggers when exception occurs. the code i'm using data dll surounded try/catch block exception still occurs. acces violation exception

xcode - Interface Builder's inspectors are completely empty -

Image
i using xcode 7.0.1 , facing strange problem: inspectors (except identitiy , quick help) empty: this happened after had checked out old commit , switched head. has else observed behaviour? happened few days ago. then, able solve problem reinstalling xcode entirely. since requires redownload of xcode appstore facing long coffee break now. what wrong xcode? the same thing happened me , found workaround here: http://embraceware.com/blog/2015/09/solution-for-no-selection-in-xcode-interface-builder/ tldr: close storyboard tabs, open new one.

meteor - Reactive cursor without updating UI for added record -

i trying make newsfeed similar twitter, new records not added ui (a button appears new records count), updates, change reactively ui. i have collection called newsitems , use basic reactive cursor (newsitems.find({})) feed. ui blaze template each loop. subscription done on route level (iron router). any idea how implement kind of behavior using meteor reactivity ? thanks, the trick have 1 more attribute on newsitem collection show boolean. newsitem should have default value of show false the each loop should display feeds show == true , button should show count of items show == false on button click update elements in collection show == false show = true make sure feeds shown . as , when new feed comes button count increase reactively . hope helps

regex - how to use python re.ingorecase -

i had earlier question regarding returning original sentence irrespective of eh title or case. have done working trying work out , came this: import re nltk import tokenize nltk.tokenize import sent_tokenize def foo(): txt = "risk factors breast cancer have been characterized. breast cancer 100 times more frequent in women in men.\ factors associated increased exposure estrogen have been elucidated including menarche, late menopause, later age\ @ first pregnancy, or nulliparity. use of hormone replacement therapy has been confirmed risk factor, although limited \ combined use of estrogen , progesterone, demonstrated in whi (2). analysis showed risk of breast cancer among women using \ estrogen , progesterone increased 24% compared placebo. separate arm of whi randomized women prior hysterectomy \ conjugated equine estrogen (cee) versus placebo, , in study, use of cee not associated increased risk of breast cancer (3).\ unlike hormone replacement t

swift - Parse iOS - How to capture the findObjects() error being thrown? -

i coding in swift , attempting use findobjects() function parse ios sdk. however, can't seem figure out type of error being thrown parse if function call fails. i'm novice in swift may issue. attempt call function in do->catch block , use try keyword on function call i'm not sure catch. can catch error using _ grab description error. thanks! p.s. don't want use findobjectsinbackground() method. do { let object = try query.getfirstobject() // object } catch _ { // print out error description } in obj-c, assume similar, print out error.userinfo[@"error"] parameter of nserror returned.

vba - How to compare between excel and word/pdf? -

i have excel file want compare bunch of pdf/word files, example excel got cells: a 100 b 200 c 300 and in pdf/word there table same: a 105 b 200 c 300 i want way check every cell in each pdf if match cell in excel in example show row not equal 100 - 105. how can approach kind of problem? the way can think of copy word/pdf data excel worksheet , give same form data in excel file. then, use standard excel formulas compare data...

java - Query batch job metadata in Spring batch -

i want fetch 10 latest records batch_job_execution-table joined batch_job_instance-table. so how can access these tables? in application have used spring data jpa. it's application uses spring batch , created these tables. in other words, run join-query , map directly custom object necessary fields. far it's possible, avoid making seperate models 2 tables. don't know best approach here. if want spring batch code need use jobexplorer , apply filters on either start_time or end_time . alternatively, send sql query desired join db using jdbc. ddls of metadata tables can found here . edit if want try in springbatch, guess need iterate through jobexecutions , find ones interest you, thing )) someth. like: list<jobinstance> jobinstances = jobexplorer.getjobinstances(jobname); (jobinstance jobinstance : jobinstances) { list<jobexecution> jobexecutions = jobexplorer.getjobexecutions(jobinstance); (jobexecution jobexecution : jobexec

Python execute task -

this question has answer here: how use threading in python? 16 answers i have python class indefinitely blocking task method class a(object): def __init__(self): # start task def task(self): while true: #do work i want start execution of task in constructor of a. need run in own thread task blocking. how in python 2.7? like mentioned in comments, there's module threading seems fit task. example: import threading class a(object): def __init__(self): threading.thread(target=self.task).start() def task(self): print 'hello thread' = a() # output: 'hello thread'

c# - How to solve date group by in Data Table -

hi can able result datatable wcf(api) , bind grid like: datatable dt eventstart | eventend ============================================= 1/9/2015 1:00:00 pm | 1/9/2015 1:15:00 pm 1/9/2015 3:00:00 pm | 1/9/2015 4:15:00 pm 13/10/2015 10:00:00 | 13/10/2015 11:15:00 13/10/2015 1:00:00 pm | 13/10/2015 2:15:00 pm but want result in datatable dt2 this date | total minutes ============================================== 1/9/2015 | 150 minutes 13/10/2015 | 150 minutes anybody can please.... new in linq.... skip datatables, , bind directly linq result, this: grid.datasource=result .groupby(x=>x.eventstart.date,x=>(x.eventend-x.eventstart).totalminutes) .select(x=>new {date=x.key,totalminutes=x.sum()}); this assumes wcf returns ienumerable, has eventstart , eventend (like array, list, ilist, collection, etc)

java - how to get details in list view from sqlite database in android -

i want display details in listview sqlite database. how set custom adapter in mainactivity ? code follows: public class mainactivity extends activity { edittext eid,ename; button add; public databaseclass mdb=null; public cursor c=null; public sqlitedatabase db=null; public static final string database_name="sample.db"; public static final int database_version=1; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); eid=(edittext)findviewbyid(r.id.rid); ename=(edittext)findviewbyid(r.id.rname); add=(button)findviewbyid(r.id.radd); mdb=new databaseclass(getapplicationcontext(), database_name, null, database_version); add.setonclicklistener(new view.onclicklistener() { @override public void onclick(view arg0) { // todo auto-generated meth

unit testing - How to test an object's private methods in Scala -

i have example object: object foo { private def sayfoo = "foo!" } and want test private sayfoo method without following workarounds: 1. without defining package private 2. without defining protected , inheriting in test class i saw 1 possible solution extend privatemethodtester doesn't seem work objects classes. now, know some, if not many, not suppose test private methods rather public ones (api). nonetheless, still want test them. thx in advanced it cannot tested standard means. however, if need "cover" section of code, test methods use private method in implementation. indirect, granted, test code. for example, in class have method: def dontsaybar = { sayfoo() println("other processing...") } and "cover" code in private method if tested. p.s. rule of thumb if see code isn't showing in coverage run, don't need code.