Posts

Showing posts from July, 2010

php - Symfony 2 : doctrine entities not updated -

i'm new symfony 2.0 , doctrine. have generete entity refer cookbook 'how generate entities existing database' relation ship : client have many payement payement 1 client entity : client.php <?php namespace auto\ecolebundle\entity; use doctrine\orm\mapping orm; /** * client * * @orm\table(name="client", indexes={@orm\index(name="fk_client_delegation1_idx", columns={"delegation_id"})}) * @orm\entity */ class client { /** * @var string * * @orm\column(name="nom", type="string", length=45, nullable=false) */ private $nom; /** * @var \datetime * * @orm\column(name="date_nais", type="date", nullable=true) */ private $datenais; /** * @var string * * @orm\column(name="profession", type="string", length=45, nullable=tru

sql - How to combine two query's results into one row? -

i have 2 queries return 1 result each i.e 1 number select count(*) stockcounta table_a dept='aaa' results stockcounta 550 . select count(*) stockcountb table_b dept='bbb' results stockcountb 450 i wish join 2 results 1 row record i.e | stockcounta | stockcountb | 550 | 450 you can use: select (select count(*) stockcounta table_a dept='aaa') stockcounta, (select count(*) stockcountb table_b dept='bbb') stockcountb explanation: can select single value field in select statement, write like select x.*, (select * table_y y) valuefromy table_x x this work when sub query returns @ 1 row. 0 rows valuefromy return null , more 1 row, query fail. an additional feature of select (in sql server) can select values without specifying table @ all, this: select 3.14 moreorlesspi you can combine both facts combine 2 counts single result, writing query looks like: select (select query returns @ 1 row)

python 3.x - KeyboardInterrupt Exception works sometimes? -

i have simple python script: import socket import sys try: s = socket.socket(socket.af_inet, socket.sock_raw, socket.getprotobyname("icmp")) except socket.error msg: print("could not open socket connection!") print(msg) sys.exit(1) try: s.bind(("", 0)) print("starting listener...") while true: buff = s.recvfrom(65535) print(buff[1][0]) except keyboardinterrupt: s.close() print("\nmanually quitting...") sys.exit(3) except socket.error msg: s.close() print("socket connection failed!") print(msg) sys.exit(2) except: print("something went wrong! quitting...") sys.exit(4) s.close() when run script python 3.2.3, ctrl-c keyboard exception not caught time, means works sometimes. in fact error message different when trying ctrl-c program @ arbitrary moment. here output on console when script ran 3 times right after another: $ sudo pytho

c++ - Sorting data from text file -

i need write program reads unknown number of numerical data text file array , uses sorting parameter sort numbers. i've been trying hours , can't program work void sort(double &, double arr[], int s); int main() { fstream myfile; int size, = 0; const int n = 1000; double x[n]; //reading data myfile.open("data.txt"); if (myfile.fail()) { cout << "error opening file" << endl; exit(1); } while (!myfile.eof()) { myfile >> x[i]; cout << x[i] << endl; i++; } size = - 1; cout << size << " number of values in file" << endl; myfile.close(); = 0; while (size > i) { cout << x[i] << endl; i++; } //sorting sort(x[n], x[n], size); = 0; while (size > i) { cout << x[i] << endl; i++; } return 0; } void

android - Communicating between fragments - accessing class inside fragment? -

i attempting communicate between 2 fragments in android program. i've been following guide communicating other fragments , going far. have 1 fragment sending data host activity, , activity correctly acknowledges data through log statements. have referenced second fragment within activity, , set send information fragment, therein lies problem; method in second fragment, need call host activity, inside of class inside of fragment, , what's more, method relies on data defined inside of fragment. i've tried call method directly, cannot seem it. there way of getting past these limitations? host activity: package com.example.chris.drawingtest; import android.app.activity; import android.os.bundle; import android.util.log; public class drawingactivity extends activity implements toolbarfragment.toolselectionlistener { public void sendnewvalue(int newvalue) { log.d("data received toolbar fragment: ", "the id of button pressed " + new

initialization - Passing level with SKTransistion issue -

when making transition new scene, (i calling instance of self new scene), trying set level number property of new instance. problem when instance first created initwithsize called before can set level property, , can set level property after instance created, therefore property level set default (0) when initwithsize first called. myscene *destinationscene = [[myscene alloc]init]; destinationscene.currentlevel = (int) level; nslog(@"519 level passed: %d new level: %d", (int)level, destinationscene.currentlevel); sktransition *transtition = [sktransition doorwaywithduration:2]; [self.view presentscene:destinationscene transition:transtition]; initwithsize: check level number here , load _currentlevel = self.currentlevel; // check if no level ie loading game first time if (_currentlevel==0) { _currentlevel=1; } [self loadlevel:_currentlevel]; only way around have found call initwithsize twice uses

node.js - Using directory (for images links etc) in Openshift (nodejs application) -

i have webpage have hosted using node application on openshift. here http://nodejs-volition.rhcloud.com/ my question simple (although haven't found else asking it). how refer other files in directory contains index.html for instance use image in directory in index. current html image is <img src="$openshift_repo_dir/images/1416870991752.jpg" alt="spark core"> i have tried using "images/1416870991752.jpg". have same problem linking other html files in directory? doing wrong? please help? as corey112358 alludes below key in host using nodejs server must defined. application has server file, rather creating new server must modify existing one. i've done now, there 2 changes make server.js file. the 1st change modification of cache. should this... self.zcache['index.html'] = fs.readfilesync('./index.html'); self.zcache['page2.html'] = fs.readfilesync('./page2.html'); self.zcache['sparkc

Use a javascript variable in the PHP Code -

i want use value of 'n1' variable in 5 , 6 lines off code. means 'n1' variable javascript variable , want use in following php code lines: var x=50*math.cos((<?php echo posst($streamval[n1][1]); ?>*math.pi)/50)+100; var y=50*math.sin((<?php echo posst($streamval[n1][1]); ?>*math.pi)/50)+75; <script> (var n1 = 0; n1 <= 3; n1++) { ctx.beginpath(); ctx.moveto(100,75); var x=50*math.cos((<?php echo posst($streamval[n1][1]); ?>*math.pi)/50)+100; var y=50*math.sin((<?php echo posst($streamval[n1][1]); ?>*math.pi)/50)+75; ctx.lineto(x,y); x=quarterx(x,y,<?php echo posst($streamval[0][1]); ?>); y=quartery(x,y,<?php echo posst($streamval[0][1]); ?>); ctx.font = "10px arial"; ctx.stroketext('<?php echo posst($streamval[0][0]); ?>',x,y); } </script> how can that? thanks. you dont use javascript variable in php, can create loop in php <script>

python - How to find the number of the day in a year based on the actual dates using Pandas? -

my data frame data has date variable dateopen following format date_format = "%y-%m-%d %h:%m:%s.%f" , have new column called openday day number based on 365 days year. tried applying following data['dateopen'] = [datetime.strptime(dt, date_format) dt in data['dateopen']] data['openday'] = [dt.day dt in data['dateopen']] however, day in month. example if date 2013-02-21 10:12:14.3 above formula return 21. however, want return 52 31 days january plus 21 days february. is there simple way in pandas? on latest pandas can use date-time properties : >>> ts = pd.series(pd.to_datetime(['2013-02-21 10:12:14.3'])) >>> ts 0 2013-02-21 10:12:14.300000 dtype: datetime64[ns] >>> ts.dt.dayofyear 0 52 dtype: int64 on older versions, may able convert datetimeindex , use .dayofyear property: >>> pd.index(ts).dayofyear # may work array([52], dtype=int32)

c# - Replacing a certain word in a text file -

i know has been asked few times, have seen lot of regex etc., , i'm sure there way stream reader/writer. below code. i'm trying replace "tea" word "cabbage". can help? believe have wrong syntax. namespace week_9_exer_4 { class textimportedit { public void editorialcontrol() { string filename; string linereadfromfile; console.writeline(""); // ask name of file read console.write("which file wish read? "); filename = console.readline(); console.writeline(""); // open file reading streamreader filereader = new streamreader("c:\\users\\greg\\desktop\\programming files\\story.txt"); // read lines file , display them // until null returned (indicating end of file) linereadfromfile = filereader.readline(); console.writeline("please e

java - xjc: override xs:simpleType definition -

i compiling set of xsds java classes using xjc . able override data type definition given simple type. xsd snippet is: <xs:simpletype name="cpt-datetime"> <xs:annotation> <xs:appinfo>can specified integer number or xs:datetime</xs:appinfo> </xs:annotation> <xs:union membertypes="xs:unsignedlong xs:datetime"/> </xs:simpletype> which results (not surprisingly) in element of cpt-datetime type being defined in resulting java class string , e.g. public class ccreporttraininitialization { ... @xmlelement(required = true) protected string time; ... public string gettime() { return time; } public void settime(string value) { this.time = value; } ... what datatype of time (in example) date-time specific type, e.g. xmlgregoriancalendar or that: public class ccreporttraininitialization { ... @xmlelement(required = true) protected xmlgregoriancalenda

c# - Change Header Text in Column of Gridview pulling from Database -

hi wondering how can change header text of column in gridview when pulling database build gridview. here how building gridview. sqlconnection conn = new sqlconnection("removed"); sqldatareader rdr = null; string commandstring = "select ordernumber, createddate, createdby, customerid, store_number, package dbo.orderheader"; try { conn.open(); sqlcommand cmd = new sqlcommand(commandstring, conn); rdr = cmd.executereader(); gridview1.datasource = rdr; gridview1.databind(); } catch (exception ex) { // log error } { if (rdr != null) { rdr.close(); } if (conn != null) { conn.close(); } } } get header row object in databound event , change desired name, void gridview1_databound(object sender, eventargs e) { // header row. gridviewrow headerrow = gridview1.headerrow; he

ios - iOS7 and iOS8 segue.destinationViewController -

i'm trying make app work both ios7 , ios8 , ran problem in prepareforsegue methods in view controllers. in ios8 segue.destinationviewcontroller of class uinavigationcontroller, use [[segue.desinationviewcontroller viewcontrollers] objectatindex:0] works fine, in ios7 segue.desinationviewcontroller of class cmamyviewcontrollerclassname, throw error when try send viewcontollers message it. i found this solution work, wondering if there's better solution? other latter post haven't been able find it. if there's not "proper" solution, i'll create method gets correct view controller; wondering how other people handled situation. thanks! this issue resolved checking class of destination view controller before trying access 1 of properties: - (void)prepareforsegue:(uistoryboardsegue *)segue sender:(id)sender { destcontroller *vc = segue.destinationviewcontroller; if ([dvc iskindofclass:[destcontroller class]]) dvc.prope

sqlite - How to Convert twitter api timestamp to unix time in vba excel -

i trying convert twitter timestamp string unix time (seconds since epoch). have been searching while cant find works. know how convert "mon sep 24 03:35:21 +0000 2012" unix time? or if not, sqlite db time function? using mon sep 24 03:35:21 +0000 2012 string, returns unix (aka posix) date long. dim tt string, ut long tt = "mon sep 24 03:35:21 +0000 2012" ut = ((cdate(mid(tt, 5, 6) & ", " & right(tt, 4) & mid(tt, 11, 9)) + (iif(mid(tt, 21, 1) = chr(45), -1, 1) * timeserial(mid(tt, 22, 2), mid(tt, 24, 2), 0))) - 25569) * 86400 debug.print ut the result 1348457721 sample you've provided. edit: modified above code account both positive , negative utc timezone offsets.

cakephp 2.0 flash messages not displaying -

i'm trying display flash messages errors not displaying tried , researched didnt come solution, im quite new cake beer me thnks carts userscontroller public function add() { if ($this->request->is('post')) { $this->user->create(); if ($this->user->save($this->request->data)) { $this->session->setflash(__('the user has been created')); $this->redirect(array('action' => 'index')); } else { $this->redirect(array('controller'=>'pages', 'action' => 'home')); $this->session->setflash(__('the user not created. please, try again.')); } } } default.ctp <div id=""> <?php echo "flash:" ?> <?php echo $this->session->flash();?> element/failure <div class="flash flas

android - Changing the background color of searchview autocomplete dropdown -

Image
i have searchview content provider custom suggestions, displayed in dropdown. however, dropdown background dark while text black it's not visible. app theme inheriting theme.appcompat.light else in app black text on light background. i want change background of dropdown text readable haven't found way of doing so. closest got following solution here: style android searchview drop down popup when dropdown appears, stuff looks messed up. is there working solution this? applying styles can change dropdown background color , items text color , size <!-- toolbar --> <style name="toolbarstyle" parent="theme.appcompat"> <item name="android:textcolorprimary">@android:color/white</item> <item name="android:textcolorsecondary">@android:color/white</item> <item name="actionmenutextcolor">@android:color/white</item> <item name="android:dropdownit

javascript - jQuery: click indicator on div -

it may obvious i'm new web development. anyway, i'm trying create click event on div , change background color. want background change original color after click up. here have: jquery: $('.details1').click(function() { $(this).toggleclass('on').delay(200).toggleclass('on'); }); css: div.on { background: #f78181; } i don't want millisecond delay, that's debugging. want change background on click down , up. thanks. you have use settimeout() function problem instead of delay() $('.details1').click(function(){ settimeout(function(){ $('#clrd').toggleclass('on'); }, 200); }); you can change time (milliseconds) per need. in case 200ms check fiddle

javascript - Private namespaces for library sub-modules using prototype -

i'm working on large javascript ui module, think in dimension of iscroll. keeping thing sane, split library several logical sub-modules (like: touch interaction, dom interaction, etc.) communicate each other using simple pubsub system. each of these sub-modules has it's own namespace use storing variables. enable several instances of library running @ same time, constructor includes logic copy every namespace has been assigned 'tocopy' object directly every new instance. the basic structure looks this: // constructor function constructor() { (var key in this.tocopy) { // create deep copy , store inside instance this[key] = utils.copyobj(this.tocopy[key]); } } constructor.prototype.tocopy = {} // sub-module #1 constructor.prototype.tocopy._module1namespace = {} constructor.prototype._privatefn = function() { /** stuff within this._module1namespace or send events */ } constructor.prototype._privatefn = function() { /** stuff within this._module

Return 10 rows per person from Access table -

i have table includes id, person's name, , other data. i'm trying write query returns 10 rows each person (ideally 10 random rows, if has first 10 rows each person, suffice). i've found sql return 10 random rows table, not 10 rows per person. tells how solve in oracle, i'm having trouble making work in access: sql return n rows per row value select * ( select row_number() on (partition birthcountry order dbms_random.value) rn , firstname , lastname , birthdate , birthcountry yourtable ) rn <= 10 edit: have tried based on link posted comments, , returns 1 record (for person has 1 record in table--all others have more 10). select a.id, a.mapped_prov_name, count(*) rank_number qryjustnames inner join qryjustnames b on a.mapped_prov_name = b.mapped_prov_name group a.id, a.mapped_prov_name having count(*) <= 10 order a.mapped_prov

ruby - Rails fixtures — Incrementing an ID attribute automatically? -

i have fixtures file id's this: post_one: id: 1 attr2: 'some_value' post_two: id: 2 attr3: 'some_other_value' and on. is there way not have type in id's each record, , have incremented automatically? if don't specify id, hash label , use id. benefits of not specifying id: stable, autogenerated ids label references associations (belongs_to, has_one, has_many) habtm associations inline lists autofilled timestamp columns fixture label interpolation support yaml defaults see page in documentation more info on fixtures: http://api.rubyonrails.org/classes/activerecord/fixtureset.html

Running parallel OpenCL kernels -

i have been looking opencl little while, see if useful in context, , while understand basics, i'm not sure understand how force multiple instances of kernel run in parallel. in situation, application want run inherently sequential , takes (in cases) large input (hundreds of mb). however, application in question has number of different options/flags can set in cases make faster, or slower. hope can re-write application opencl , execute each option/flag in parallel, rather guessing sets of flags use. my question this: how many kernels can graphics card run in parallel. can looked @ when purchasing? linked number of shaders, memory, or size of application/kernel? additionally, while input application same each execution modify data in different way. need transfer input data each kernel separately allow this, or can each kernel allocate "local" memory. finally, require multiple kernels, use work-items instead? in case, how determine how many work-items can run in

php - How to configure Pre-Domain using qtranslate (Wordpress) -

i want ask... i want using qtranslate plugin on wordpress site. i want model link url this www.example.com << default using english language www.ru.example.com << using russia language www.id.example.com << using indonesia language image > can open link pre-path , pre-domain mode work mod_rewrite / pretty permalinks . additional configuration needed pre-domain mode! i don't know configure this, confused, don't find search in google... please me..

javascript - Jquery Code Sinppets to Solve -

can tell me possible solutions these?? question 1: web page form id "my_form" , few elements class "excluded" applied. how can make copy of form , rid of elements excluded class, new copy of form? question 2: examine code snippet. think it's supposed do? why doesn't work? how fix it? $("li").each(function () { if ($(this).find("ul")) { $(this).css("background-color", "gray"); } else { $(this).css("background-color", "white"); } }); question 3: user complaining audio playing after hitting play/pause button. given below implementation, why happen? how fix it? // pause button implementation: $("#toggleplaypause").on("click", function () { if (audio.paused === true) { audio.play(); } else { audio.pause(); } }); // when current audio has played way through, read next element. audio.addeventlistener("ended&quo

c++ - Qt QWidget::setGeomerty -

i'm stuck simple function of qt not work me.i made class inherits qmainwindow , class inherits qwidget.then made second member object(a pointer to) inside first , assigned centralwidget during construction of window. when comes adjust centrawidget inside window function qwidget::setgeomerty() don't work.here's code: void mainwindow::show() { //some code centers window on screen int margin=this->width()/7; centralwidget()->setgeometry(margin,centralwidget()->geometry().top(),this->width()-margin,centralwidget()->geometry().bottom()); qmainwindow::show(); } i know might stupid can't figure out.help me. qmainwindow has own layout in center area occupied central widget. won't pretty straightforward break layout , modify central widget size / position arbitrarily. recommend use placeholder central widget , add widget child. i'm pretty sure can achieve want setting proper qt built in layout "placeholder"

bdd - Behave - Common features between applications, avoiding duplication -

i have many applications want test, have largely overlapping set of features. here oversimplified example of scenario might have: given <name> playing game, when shoot @ <color> target should <event> examples: | name | color | event | | alice | red | hit | | alice | blue | miss | | bob | red | miss | | bob | blue | hit | | bob | green | hit | it's silly example, suppose have lot of players different hit/miss conditions, , want run just scenarios given name? say, want run tests alice . there's still advantage having hit/miss tests in single scenario outline (since, after all, they're closely related). one approach duplicate test every name , tag them, like: @alice given alice playing game when shoots @ <color> target should <event> examples: | color | event | | red | hit | | blue | miss | this way can run behave --tags @alice , i'm repeated same scenario every user, , that's

database - Will enabling row movements on list-partitioned table cause performance problems(oracle 11g r2) -

our incident management system has run years, , large quantity of closed incident tickets makes table rather huge , slows down search queries. our database version oracle 11g r2 enterprise edition(partition option added). concerned 2 large tables are: incident , incident_area_info (one incident corresponds multiple incident_area_info, , they're joined using incident_id ). want use following strategy: split incident table 2 partitions: closed_incidents , active_incidents , using list-partition , status partition key. also, manually enabled row movements on incident table , incident_area_info table, can close incident. split incident_area_info using reference partition. drop original indexes , replace them corresponding partitioned local indexes search open incidents default i have applied strategy in developing environment , search operation's execution time reduces 10% of original on average(we have 4 million closed incidents , 40,000 active incidents). bu

Give the simplest example for Google Cloud Messaging for Android -

i registered project in google api console updated android sdk ->extra->google cloud messaging android imported library gcm.jar in project necessary classes visible. want write simple example of using google cloud messaging android. examples complex , confusing. please tell me simplest example android. application starts , take notice in form of text. simplest example. , if can example of how make server kotoorye send these messages. see repository contains necessary code creating working client , server implementation gcm. to learn gcm take @ official site good luck!

PHP array : Echo a $var inside a form with option value -

how can display variable $player->name inside form option value user select variable , submit form. here's code not working : <?php $team = $_post['team']; $result = file_get_contents("http://nhlwc.cdnak.neulion.com/fs1/nhl/league/teamroster/$team/iphone/clubroster.j son"); $json = json_decode($result); $goalies = $json->goali; foreach ($json->goalie $player) { **echo "<option value=\"".$player->name."\">".$player->name."</option>** } ?> you did not have double quotes , semicolon @ end of statement. <?php $team = $_post['team']; $result = file_get_contents("http://nhlwc.cdnak.neulion.com/fs1/nhl/league/teamroster/$team/iphone/clubroster.json"); $json = json_decode($result); $goalies = $json->goali; foreach ($json->goalie $player) { echo "<option value=\"".$player->name."\&q

javascript - Display multiple progress bar with multiple file upload using jquery,html and css -

i use 1 browse button select multiple files upload 1 progress bar display uploaded files. please review following code: <!doctype html> <html> <head> <title>proper title</title> <style> .a{ display:none; } </style> </head> <body> <form id="myform" method="post" enctype="multipart/form-data" "> files: <input type="file" id="files" name="files" multiple><br/> <div id="selectedfiles"></div> <progress class='a' max=100 value=10></progress> <input type="submit" > </form> <script> var seldiv = ""; document.addeventlistener("domcontentloaded", init, false); function init() {

eclipse - How to copy the error message from console to file in java? -

this question has answer here: java output console error message file? 5 answers printstream out = new printstream(new fileoutputstream("test2_output.txt")); system.setout(out); this above code not correct code.i require above file should contain error message produced in console . code error message console , copy message file. you can redirect java standard out , standard error log files. in fact, here oracle's (user submitted blog) answer question: https://blogs.oracle.com/nickstephen/entry/java_redirecting_system_out_and

windows - Passing parameters (with spaces) to batch file from java program -

in program want execute jar parameters of .bat file. .bat file %6 -jar %5 -u %1 -p %2 -dbbkp %3 > %4 java program pass parameters above .bat file string jarpath=request.getsession().getservletcontext().getrealpath("")+"/oes-smartclient/oes-smartclient.jar"; string outputfilepath=request.getsession().getservletcontext().getrealpath("")+"/resources/webfiles/oesfiles/dbbackupstatus.txt"; string jrepath="c:\\program files (x86)\\java\\jre7\\bin\\java"; string batfilepath = request.getsession().getservletcontext().getrealpath("")+"/web-inf/classes/oesdbbackup.bat"; string backuplocation = request.getsession().getservletcontext().getrealpath("")+"/web-inf/classes/backuplocation"; batfilepath="\""+batfilepath+"\""; jarpath="\""+jarpath+"\""; outputfilepath="\""+outputfilepath+&q

Python bowling program dictionary from text file -

below assignment. stuck on how include total in dictionary. not sure if possible need average. appreciate push in right direction. :) assignment:write program read unknown number of bowlers , bowling scores (with possible values 1 300) external file called "bowlingscores.txt". file similar following: david 102 hector 300 mary 195 jane 160 sam 210 output bowlers’ names external data file called "bowlingaverages.txt". next each bowler's name, print message dependent on scores: perfect scores (equal 300), output “perfect” scores greater average score, output “above average” below average, output “below average” scores = {} total = 0 def bowl_info(filename): infile = open("bowlingscores.txt", "r") line in infile: if line.strip().isdigit(): score = int(line) scores[name] = score total += score else: name = line.strip() return scores bowl

Can Insert and delete be done at the same time in oracle -

just curious know.if 2 jobs running 1 inserting table , other deleting rows table. can performed in parallel? table contains 300 columns 50gb data. end in deadlock if so? given fact cannot remove records have not been inserted, can insert , delete on same table @ same time, not on same records. hence, cannot deadlock. can lock though. you'll need come more complex, deadlock oracle.

python 2.7 - Why is there a for in a sentence? -

in python, meet situation there in list. don't know what's meaning of that. scores = [game.state.getscore() game in games] i meet in project called pacman, project in ai(artificial intelligence). on 550-580 lines in pacman.py . this construction called list comprehension in python. see here more details. in brief, way of writing code below: scores = [] game in games: score.append(game.state.getscore())

javascript - Delay in playing HTML5 audio file on mobile browsers -

i making web app, , needed add short sound when button being clicked. the file in mp3 format , around 24kb in size, didnt want use javascript create element added dom , used css hide it, added preload="auto" gets loaded dom <audio id="click" preload style="display:none;"> <source src="sound/click.mp3" type="audio/mp3"> </audio> in javascript, have like: var clicksound = $('#click')[0]; then in function listens click on button have: function(){ clicksound.play(); } this works fine on computer (firefox, chrome), on mobile after clicking trigger button, wait 3 seconds before plays first time, , will play instantly after first delayed play . update: i noticed if navigate mp3 file on mobile http://example.com/sound/click.mp3 , click on play, still delays, seems had buffer. anyway around problem? complete example: here jsfiddle mobile testing. var clicksound = document.getelem

c# - MVC5 Ajax.BeginForm refresh whole page -

why form post not happening via ajax instead reloading new page? my .js includes: <script src="/app/javascript/libraries/jquery-1.11.1-min.js"></script> <script src="/app/javascript/libraries/jquery.validate.js"></script> <script src="/app/javascript/libraries/jquery.validate.unobtrusive.js"></script> my razor view: <div id="login-partial-update"> @using (ajax.beginform("login",null, new ajaxoptions { updatetargetid = "login-partial-update", httpmethod = "post" }, new { id = "js-form-login" })) { @html.textboxfor(x => x.email, new {placeholder = "email address"}) <div class="errormessage"> @html.validationmessagefor(x=>x.email) </div> @html.passwordfor(x => x.password, new {placeholder = "password"}) <div class="errormessage"> @html.validationme

java - PMD multiple rulesets pass build but single ruleset fails build -

i using pmd maven plugin project , seeing strange behavior in it. following pom.xml configuration fails build violations in basic.xml - <configuration> <rulesets> <ruleset>${project.basedir}\ruleset\basic.xml</ruleset> <!-- ruleset>${project.basedir}\ruleset\braces.xml</ruleset> <ruleset>${project.basedir}\ruleset\design.xml</ruleset> <ruleset>${project.basedir}\ruleset\controversial.xml</ruleset> <ruleset>${project.basedir}\ruleset\coupling.xml</ruleset> <ruleset>${project.basedir}\ruleset\clone.xml</ruleset> <ruleset>${project.basedir}\ruleset\comments.xml</ruleset--> </rulesets> </configuration> but below 1 passes build smoothly - <configuration> <rulesets> <ruleset>${project.basedir}\ruleset\basic.xml</ruleset> <ruleset>${project.basedir}\ruleset\braces.

c# - Fluent NHibernate HasManyToMany with a discriminator column specifying relationship type -

i'm using fluent nhibernate , i'm trying map many-to-many property bypasses join table. tricky thing is, join table has column determines type of relationship is. for purpose of question, let's have person table , relation table. persontable (personid, name, etc) relationtable (relationtype, personida, personidb) i want introduce collection property in person class each type of relationship e.g. sons, daughters, etc. hasmanytomany<person>(x => x.sons) .table("relationtable") .parentkeycolumn("personida") .childkeycolumn("personidb") .where("relationtype='a_is_father_of_b_boy'"); hasmanytomany<person>(x => x.daughters) .table("relationtable") .parentkeycolumn("personida") .childkeycolumn("personidb") .where("relationtype='a_is_father_of_b_girl'"); the above mappings working reading database not inserting, example:

javascript - Angular View automatically redirecting to default (otherwise) view -

my view automatically redirecting default (otherwise) view , have no idea why. when click, goes view1 view2 , automatically redirects default view3 . checked putting console.log() in view2 view1 -> view2 -> view3 myapp.config(function ($stateprovider, $urlrouterprovider) { $stateprovider .state('view1', { url: "/view1", templateurl: "app/views/start/view1.html", controller: 'mycontroller' }) .state('view2', { url: "/view2/:details", templateurl: "app/views/start/view2.html", controller: 'mycontroller' }); $urlrouterprovider.otherwise('/view3'); }); and calling $state.go this. $state.go('view2', { details: json.stringify(response.details) }); i tried intercept preventing default on $statechangestart ran error : $digest() iterations reached. aborting

mysql-connector-python-2.0.2-py3.3.msi Installation failed -

i want use "import mysqldb" downloaded windows (architecture independent), msi installer python 3.3 address : http://dev.mysql.com/downloads/connector/python/ after installation complete,tell me installation failed import mysqldb traceback (most recent call last): file "", line 1, in importerror: no module named 'mysqldb' please tell me how do。thx. ps:i use mysql server 5.5 , python33 take @ example in documentation , find module coming oracle's mysql connector not named mysqldb , mysql (or rather mysql.connector ): import mysql.connector cnx = mysql.connector.connect(user='scott', password='tiger', host='127.0.0.1', database='employees') cnx.close() from: http://dev.mysql.com/doc/connector-python/en/connector-python-example-connecting.html

linux - Monitor already used serial port using python -

how monitor serial port used or not? using pyserial application , isopen() not working script when run in ubuntu. if (ser.isopen()): ser.write(data_string) else: print("port in use") i never got "port in use" . trying execute script parallel in 2 different terminals still no else part execution there.

c# - Linq to entities : Many to many in one single select -

i have domain: public class user { public long id { get; set; } public string login { get; set; } public string password { get; set; } } public class application { public long id { get; set; } public string name { get; set; } } public class userapplications { [foreignkey("user")] public long userid { get; set; } public user user { get; set; } [foreignkey("application")] public long applicationid { get; set; } public application application { get; set; } public datetime lastconnection { get; set; } } i want make select returns that: list of select new { user = user, applications = applications // list of user's applications } i try: from u in users join ua in userapplications on u.id equals ua.userid userapplications ua in userapplications.defaultifempty() join in applications on ua.applicationid equals a.id applications select new { user = u, applications = applications } but rep