Posts

Showing posts from August, 2012

c# - DataGridView Cell value not available for validation when inserting a new row -

situation: i'm writing winforms app using c# in vs2013 .net4.0. to carry out cell level validation in datagridview handle cellvalidating event. when validating access user input values with dgv.rows[e.rowindex].cells[e.columnindex].value for validation of existing rows works fine. issue: when user types cell on new row , presses, example, tab move next cell cellvalidating event fires value contains null. question: how access user has typed in these circumstances? i'm thinking should maybe endedit before validating thought cellvalidating inherently "while-editing" event. edit the validation takes place in validator class top end of looks this: public void validatecell(string tablename, datagridview datagrid, datagridviewcellvalidatingeventargs e, columncatalogue columncatalogue) { if (!(datagrid.rows[e.rowindex].cells[e.columnindex].value == null || datagrid.rows[e.rowindex].cells[e.columnindex].value == dbnull

python - Using Pandas how do I deduplicate a file being read in chunks? -

i have large fixed width file being read pandas in chunks of 10000 lines. works great except removing duplicates data because duplicates can in different chunks. file being read in chunks because large fit memory in entirety. my first attempt @ deduplicating file bring in 2 columns needed deduplicate , make list of rows not read. reading in 2 columns (out of 500) fits in memory , able use id column find duplicates , eligibility column decide of 2 or 3 same id keep. used skiprows flag of read_fwf() command skip rows. the problem ran pandas fixed width file reader doesn't work skiprows = [list] , iterator = true @ same time. so, how deduplicate file being processed in chunks? my solution bring in columns needed find duplicates want drop , make bitmask based on information. then, knowing chunksize , chunk i'm on reindex chunk i'm on matches correct position represents on bitmask. pass through bitmask , duplicate rows dropped. bring in entire column ded

http - Doubts on the correctness of Microsoft Azure Multimedia Services REST API -

the azure api claims rest api . found while patterns , sample implementations , verbs in rest, when inspecting in (supposedly) rest api reference , seem have invented new verb canceljob , altering internal state via http get get https://media.windows.net/api/canceljob?jobid='url-encodedvalue' this seems contradict best practices, shall implemented jobs resource , delete or correct way too? delete /api/jobs?jobid='url-encodedvalue' or even? delete /api/jobs/jobid rest has become buzz word people use api works on http. api appears people call rest level 1. level 1 means use http transport mechanism only. doesn't respect of rest constraints http designed for. don't think it's fair call these apis rest @ all, many still because rest popular , business/marketing people able have rest api. suspect case api because architect(s) of api put no effort whatsoever following rest principles.

javascript - Saving (with JS Request) and reading (with PHP) XML in MySQL -

i'm trying save xml content (that receive plain text) site's database. read saving xml content , suggested not idea save xml in text field (database), decided in blob. thing i'm doing via cors, through javascript way: var formdata = new formdata(); formdata.append("name", 'mynewfile'); // xml content var content = '<a id="a"><b id="b">hey!</b></a>'; var blob = new blob([content], { type: "text/xml"}); formdata.append("file", blob); var request = new xmlhttprequest(); request.open("post", url); request.onreadystatechange = function() { if(request.readystate == 4 && request.status == 200) { resultscontainer.innerhtml = (request.responsetext ); } } request.send(formdata); on server, store with: $name = $_post['name']; $file = $_post['file']; $sql = "insert profilefiles (name, file) values ('$name', '$file

Trying to use Git with Android Studio -

Image
with friend long time trying work git , android studio, had problem (we new git , android studio, started couple of days ago on both issues). what happens that, example, if cloned git repository , try make merge, button execute grayed out , doesn't let me compile or run it, if display project structure android or packages see nothing, can see files in project, project files, recent changes, etc... i explain in detail we've done. first, repository looks (p , c initials). x (c) / x (master) \ x (p) master has first initial commit .gitignore , readme.md, nothing more, while (me created branch p, , friend created branc c) have 1 commit each 1 executable projects, although i'm not interested in joining i've done friend has done, want start new project of android studio friend has made. so start android studio, "check out project version control -> github", put key , choose repository want clone, after ask me if want create new project , cli

java - Reflection: How to compare two objects from unkown type -

i'm doing application custom decision making. let's have 4 tables: documment, file, task , process. i'm working jpa every table translated entity, java class variables. process have many task, task have file associated , file have many documments associated. want configure can compare attribute in task attribute in process. example: configure in table decision: attribute 1: process limit date attribute 2: task actual date operator: > what i'm trying on runtime know valor of variable take decisions. and now. have these methods: public object rungetter(field field, class o, object instance) { (method method : o.getmethods()) { if ((method.getname().startswith("get")) && (method.getname().length() == (field.getname().length() + 3))) { if (method.getname().tolowercase().endswith(field.getname().tolowercase())) { try { system.out.println("method name: " + method.getname());

php - How to check for an @ in an email address from a form post -

i have form login , registration. my form <form method="post" action="login.php"> <input type="text" name="mail" value="input email"/> <input type="submit" value="check"/> </form> if enters email, want check if there @ in address. have tried using array, not working. you can use php function strpos http://php.net/strpos if(strpos($myemailpostvariable, '@') === false) { // things here failed } if fixed on using array use explode http://php.net/explode $parts = explode('@', $myemailpostvariable); if(count($parts) != 2) { // things here failed } keep in mind array way not great searching string easier , faster , more readable. as @jeroen has suggested if want validate email using filter_input() best... if(filter_input(input_post, 'mail', filter_validate_email) === false) { // things here failed }

Convert JSON Array to Int Array In Swift -

this may silly question, despite digging through questions here on stackoverflow, can't seem find use case matches predicament. namely, have data being pulled rest service spits out historical data json; [ { "city": "new york", "historicaltemps": "98.46,71.81,76.58,82.38,91.08", "timestamp": "2015-06-04 10:20:34", } ] i able parse data in ios app, , setting historicaltemps string. i'm failing, however, figuring out how convert comma-separated string int array can populate graph. i've stalled; var arr = historicaltemps.componentsseparatedbystring(",") println(arr) //prints [98.46,71.81,76.58,82.38,91.08] want. my attempts figure out how convert string array int array, however, failing me. possible suggestions? thank you! try following: let str = "98.46,71.81,76.58,82.38,91.08" let arr = split(str) { $0 == "," } let nums = map(arr) { ($0

Groovy insert and select query together using sql server database -

i have issues executing sql server query in groovy code. requirement , need read data table abc.customer , store data temporary table test. my query : declare @throughdate datetime, @startdate datetime declare @test table ( test_id char(50) ) set @throughdate = '5-27-2015' set @startdate = dateadd(year, -1, @throughdate) insert @test select test_id abc.customer isnull(create_date, '1-1-1900') between @startdate , @throughdate , datediff(minute, isnull(create_date, '1-1-1900'), isnull(last_login, '1-1-1900')) < 1 i don't have connection issues. can query other tables , data. combination of insert , select not working me. my groovy code : def sql=sql.newinstance("jdbc:sqlserver://localhost","test","test","com.microsoft.sqlserver.jdbc.sqlserverdriver") sql.eachrow("""declare @throughdate datetime, @startdate datetime declare @test table(test_id char(50)) set

How do I activate a Maven profile if a file does NOT exist? -

i’m using maven 3.2.3. how activate profile if file not exist on file system? have tried below, discovered <not> syntax isn’t supported: <profile> <id>create-test-mysql-props-file</id> <activation> <file> <not><exists>${basedir}/src/main/myfile</exists></not> </file> </activation> <build> <plugins> <!-- generate mysql datasource properties --> <plugin> <groupid>org.codehaus.mojo</groupid> <artifactid>properties-maven-plugin</artifactid> <version>

jboss7.x - JBoss 7 is stuck on "starting" -

i’m using jboss 7.1.3 on mac 10.9.5. java_home set to /system/library/java/javavirtualmachines/1.6.0.jdk/contents/home however, when startup jboss, never gets past “starting”. below log. i’m happy upgrade jboss if that’s takes, don’t see later versions on download site — http://jbossas.jboss.org/downloads/ . anyway, below log: java_opts set -xms64m -xmx512m -xx:maxpermsize=256m -djava.net.preferipv4stack=true -dorg.jboss.resolver.warning=true -dsun.rmi.dgc.client.gcinterval=3600000 -dsun.rmi.dgc.server.gcinterval=3600000 -xx:softreflrupolicymspermb=1 -djboss.modules.system.pkgs=org.jboss.byteman -djava.awt.headless=true -xx:+cmsclassunloadingenabled -xx:+useconcmarksweepgc -xx:+cmspermgensweepingenabled -djboss.server.default.config=standalone.xml -djboss.vfs.cache=org.jboss.virtual.plugins.cache.iterabletimedvfscache -djboss.vfs.cache.timedpolicycaching.lifetime=86400 -djavax.net.debug=true -dorg.jboss.as.logging.per-deployment=false =================================

authentication - Login with username or email with Cakephp 3 -

i want login username or email. want change auth fields dynamically. how can modify $this->auth fields cakehp 2 did? in cakephp 2 do: $this->auth->authenticate = array( 'form' => array( 'fields' => array('username' => 'email', 'password' => 'password'), ), ); i've tried change authenticate doesn't work: $this->auth->config('authenticate', [ 'form' => [ 'fields' => ['username' => 'email', 'password' => 'password'] ] ]); thanks! i've found solution! i assumed username alphanumeric (letters , numbers). remember add $this->auth->constructauthenticate(); appcontroller.php use cake\controller\controller; use cake\event\event; use cake\core\configure; class appcontroller extends controller { public function initialize() { parent::initialize(); $t

html - How do I center my iframe? -

i making page twitch stream gonna go, having trouble centering horizontally. whenever up, answer is: <div style="text-align:center"> <iframe></iframe> </div> but doesn't work me. iframe appears floating on top of everything, off-centered. supposed stretch out black bar, mainarea, pushing down footer, gray bar under it. instead ignores everything, leaving page snap rubber band. here's link screen cap, because won't let me post image directly... http://imgur.com/yx2oc46 this html, is 1 step under body in hierarchy: <div id="mainarea"> <div class="container page"> <div style="text-align: center"> <iframe id="player" src="http://www.twitch.tv/twitchusername/embed" frameborder="0" scrolling="no" height="480" width="853"></iframe> </div>

arrays - Better to declare JavaScript Object inside for loop or outside in terms of time optimization -

edit: question focussed on should objects declared inside loop (huge loop of order of billion count) in each iteration or better declare object once outside loop save time during object declaration (time spent on memory allocation) in each sprint. i trying optimize code making sure don't spend time allocating memory objects declared inside loop in each iteration. i have long loop (say order of billion) creates huge objects in each array iteration , pushes objects array. question is, if better declare object inside loop or declare outside javascript runtime doesn't have spend time allocating memory object in each sprint. here tried loop of million count. tried billion count didn't complete on computer: //case 1: object declared outside loop function createobjinforloopwithvardeclaredoutside() { var starttime = date.now(); var obj; //object declared here memory allocation done 1 time var targetarray = []; for(var = 0; < 1000000; i++) { obj

Operator overloading in Java (Integer wrapper class)? -

this question has answer here: is autoboxing possible classes create? 3 answers i came across example in ocjp book. says integer y=new integer("20"); y++; (un-wraps it) system.out.println(y); now, print 21. hence, makes me think, how did compiler know @ y++ should unwrap int , increment it? integer normal class(may wrapper class??), operator overloading inbuilt inside? is there way can own custom class if possible? java uses feature called autoboxing , unboxing unwrap integer , increment it. cannot implement feature in own user-defined classes. available wrapper classes java primitive types.

java - Quartz Scheduler not triggering the job when configured via Spring 4 -

ive being sometime trying setup little program uses spring , quartz schedule task. followed other similar answers no luck. @ moment think have configured correctly, see no more exceptions job looks not kicking off. in log.out spring generates, see following messages @ end: 2015-06-04t15:46:57.928 debug [org.springframework.core.env.propertysourcespropertyresolver] searching key 'spring.livebeansview.mbeandomain' in [systemproperties] 2015-06-04t15:46:57.929 debug [org.springframework.core.env.propertysourcespropertyresolver] searching key 'spring.livebeansview.mbeandomain' in [systemenvironment] 2015-06-04t15:46:57.929 debug [org.springframework.core.env.propertysourcespropertyresolver] not find key 'spring.livebeansview.mbeandomain' in property source. returning [null] i show codes... this class start scheduler: public class jobrunner { public static void main(string[] args) throws schedulerexception { applicatio

python - pip with ArcGIS 10.1 -

i have pip installed python 2.7, provided arcgis desktop 10.1. while pip works, only works when i'm in c:\python27\arcgis10.1\scripts directory, it's located. when try call different directory, error: c:\> pip failed create process. interestingly, pep8 (also in c:\python27\arcgis10.1\scripts directory) works fine directory. seems path variable working. what's happening? on windows 7, if makes difference. edit: further clarify, installed pip myself. did not come arcpy. same goes pep8 . if memory serves ran when having more 1 python folder in path and/or wrong pythonhome variable. try opening cmd shell , ensuring path , pythonhome clear of competing python entries , run pip again. set path=c:\python27\arcgis10.1\scripts set pythonhome=c:\python27\arcgis10.1 pip --version if fails try upgrading/replacing pip get-pip (might have delete pip.exe in python\scripts folder first). if works need clean path python folder in it. if there 1 py

.net - How to backup downloaded Nuget Packages with TeamCity -

my customer keep local copy of every nuget package ever used in project, possible build older versions of application if nuget.org not available. packages not created in project, downloaded using nuget restore nuget.org. it great if packages ended on file share on different server 1 running teamcity. a naive approach add build step, right after nuget installer step, copied every .nupkg file desired file share. way solve this, or there better way? where nuget packages stored on build agent? possible reference folder environmental variable or alike, copy script not need have hard coded paths? all downloaded nuget packages stored in %localappdata%\nuget\cache . if want automatically upload file share, recommend using bittorrent sync this. https://www.getsync.com/

c# - ListView two way compiled binding (x:Bind) -

Image
i want display several names, , want them editable. used observablecolection, , bind listview new x:bind feature. here's xaml: <listview> <listview itemssource="{x:bind viewmodel.players}"> <listview.itemcontainerstyle> <style targettype="listviewitem"> <setter property="horizontalcontentalignment" value="stretch" /> </style> </listview.itemcontainerstyle> <listview.itemtemplate> <datatemplate xmlns:model="using:flechette.model" x:datatype="model:player"> <textbox text="{x:bind name, mode=twoway}" /> </datatemplate> </listview.itemtemplate> </listview> and code behind: public sealed partial class gamesettingspage : page { viewmodel.gamesettingsviewmodel viewmodel { get; set; } pub

C# Copy file or folder -

i trying write program keep multiple folders in sync. this, need copy , delete files , subfolders. to me, doesn't make difference if object file or folder, want create necessary parent folders , copy object, overwriting if necessary. i'm using jagged array of filesysteminfo hold files/folders. this has advantage of avoiding duplication of code sync files , folders separately. however, can't figure out how copy filesysteminfo. i'm looking way able copy/delete/read creation or modified time work on both files , folders. filesysteminfo don't have copy or delete methods base class directoryinfo , fileinfo. so when loop on filesysteminfo objects have cast proper concrete class , use specific copy/delete methods. foreach( var fsi in filesysteminfoobjects ) { if( fsi directoryinfo ) { var directory = (directoryinfo)fsi; //do } else if (fsi fileinfo ) { var file = (fileinfo)fsi; //do

PHP cURL Request for Web Service Returning Error -

Image
i continue receive error: "failed de-serialize entity" when making rest request below. i'm assuming has formatting of json, can't life of me figure out. appreciated. //login //set url login $url = $urlroot . "/session"; //build resource request $params = array("encryptedpassword" => false, "indentifier" => $username, "password" => $password); //json encode parameters $jsonparams = json_encode($params) ; //set curl resource $ch = curl_init($url); curl_setopt($ch, curlopt_httpheader, array( "content-type: application/json; charset=utf-8", "accept: application/json; charset=utf-8", "x-ig-api-key: ".$apikey, "version: 1" )); curl_setopt($ch, curlopt_returntransfer, true); curl_setopt($ch, curlopt_post, true); curl_setopt($ch, curlopt_header, true); curl_setopt($ch, curlopt_postfields, $jsonparams); curl_setopt($ch, curlopt_ssl_verifypeer, false); //**nb dele

Grouping Totals by non standard quarters in MySQL -

i have simple table includes seller, buyer, transaction date, , total. i want sum transactions each seller quarters on given year. quarters begin on june 1 , end on may 31. i know how sum seller given date range, can't figure out how multiple quarters. i like seller q1total q2total q3total q4total seems should simple i'm struggling figure out. you can conditional aggregation: select seller, sum(case when transactiondate between '20150601' , '20150831' amount else 0 end) q1amount, sum(case when transactiondate between '20150901' , '20151231' amount else 0 end) q2amount, sum(case when transactiondate between '20160101' , '20160229' amount else 0 end) q3amount, sum(case when transactiondate between '20160301' , '20160531' amount else 0 end) q4amount tablename group seller

How to write a Scala Argonaut codec for all Java enums -

i have scala project uses bunch of java code, example java source: public enum category { foo, bar }; i have bunch of scala case classes serialise , json using argonaut this: case class thing (a: string, b: int, c: float) object thing { implicit val j = casecodec3 (thing.apply, thing.unapply)("a", "b", "c") implicit val e: equal[guild] = equal.equal (_ == _) } fine, want write scala case class uses java enum so: case class thing (a: string, b: int, c: float, d: category) object thing { implicit val j = casecodec4 (thing.apply, thing.unapply)("a", "b", "c", "d") implicit val e: equal[guild] = equal.equal (_ == _) } this yield compilation error because there no implicit codec category enum. i guess write own codec dealing category enum doing this: package object argonautimplicits { implicit val dx: decodejson[category] = stringdecodejson.map(x => category.valueof(x)) implicit val ex:

javascript - Dynamic wordpress background Based on Slider images -

i using nivoslider on wordpress , want background of homepage change based on current slide image! have no experience in javascript nor jquery im in php / html5 / css3. thanks. the wordpress nivo slider not have ability edit callbacks on slider change (unless edit plugin, breaking compatibility future versions). general jquery plugin allows that. when setting slider: $('#slider').nivoslider({ // [snip] afterchange: function(){ // active image var active_image = $(".nivo-controlnav .active"); // change class on element , style element css // e.g. fetching attribute $(active_image).attr() }, // [snip] });

linux - Default priority of thread with SCHED_FIFO -

what default priority of thread sched_fifo policy in linux? range 0-99. according red hat enterprise mrg 1.3 realtime reference guide , there no default priority value sched_fifo policy. you have set priority when set policy sched_fifo. priority values: policy default lowest highest sched_fifo 1 99 sched_rr 1 99 sched_other 0 -20 19

linux - Perl \R regex strip Windows newline character -

i'm using perl script using following code remove possible windows newline characters in input file: foreach $line(split /\r|\r/) executing same script on 2 different linux machines has different results. on machine1 script works intended, on machine2 every time capital "r" character found line split , result messed. i know if \r regex correct , how make machine2 behave intended. in perl, there several differences in way carriage returns can handled: \n matches line-feed (newline) character (ascii 10) \r matches carriage return (ascii 13) \r matches unicode newline sequence; can modified using verbs windows uses 2 characters ascii 13 + ascii 10 ( \r\n ) , unix uses ascii 10 ( \n ). \r expression matches unicode newline sequence ( \r , \n , \r\n ). the reason \r works on 1 machine , not other might differing versions of perl . \r introduced in perl 5.10.0 , if other machine using older version updating should solve issue. more info : per

ruby on rails - Check if external API is online / offline -

i have thoughts how can check if external api available or not. in controllers, i'm calling api's , don't want call them if not available otherwise thrown error in app. i think have make job running each x seconds , check if api available or not. if she's not, have variable i'm setting false example. is best way you? thanks, the way describe work of time, there's still window between when api goes down , when job runs controller may try hit api. safer way, , fewer moving parts, catch network exception ( etimedout , etc.) in controller.

ios - Use SoundTouch framework in Swift -

can please tell me how use soundtouch framework in swift ios project detect bpm? tried things bridging headers & whatever cant work... thanks! if still need use soundtouch in ios project, have shared github repository libraries compiled armv7 , armv7s , arm64 , i386 , x86_64 https://github.com/enrimr/soundtouch-ios-library to implement compiled library in project, have add soundtouch directory (which includes libsoundtouch.a , directory headers) in xcode project. in swift can't import .h need create .h file named <your-project-name>-bridging-header-file.h reference in projects build settings (under "swift compiler" "objective c bridging header") with: $(srcroot)/<your-project-name>-bridging-header.h and must able use soundtouch class.

meteor this.params._id is undefined stick -

i'm student learning meteor.js . iron:router using: this.route('postedit', { path: '/posts/:_id/edit', data: function() { console.log(this.params._id); return posts.findone(this.params._id); } }); and error displayed: this.params._id value undefined76kndyuwd2kdx2eee... why undefined has stick value? postedit call has: <a href="{{pathfor 'postedit'}}">edit</a> originally, 76kndyuwd2kdx2eee due url being localhost:3000/posts/undefined76kndyuwd2kdx2eee/edit ... please, me. thank you. please update iron@1.0.9 , should fix it.

javascript - HTML5 combine commonly-used attributes into super-attribute? -

i have lot of buttons like: <button type="button" class="btn btn-info" data-toggle="modal" data-target="#qq" data-req="foo">foo</button> <button type="button" class="btn btn-info" data-toggle="modal" data-target="#qq" data-req="bar">bar</button> <button type="button" class="btn btn-info" data-toggle="modal" data-target="#qq" data-req="baz">baz</button> i'd avoid repetition; there way define sort of single attribute expand several other attributes? example might end looking like super x = 'type="button" class="btn btn-info" data-toggle="modal" data-target="#qq"'; <button super="x" data-req="foo">foo</button> <button super="x" data-req="bar">bar</button> <button super="x&q

audio - [C++]I want to get PCM data from wav file -

i know wave file's structure. don't know exact structure of pcm data. #include<iostream> #include<fstream> using namespace std; struct wave_header{ char chunk[4]; int chunksize; char format[4]; char sub_chunk1id[4]; int sub_chunk1size; short int audioformat; short int numchannels; int samplerate; int byterate; short int blockalign; short int bitspersample; char sub_chunk2id[4]; int sub_chunk2size; }; struct wave_header waveheader; int main(){ file *sound; sound = fopen("music.wav","rb"); short d; fread(&waveheader,sizeof(waveheader),1,sound); cout << "bitspersample : " << waveheader.bitspersample << endl; while(!feof(sound)){ fread(&d,sizeof(waveheader.bitspersample),1,sound); cout << int(d) << endl; } } the above code made far. also, code can read header exactly. don't know if can read pc

java - Is there a command-line alternative to SOAP-UI for linux, for sending SOAP to HTTPS Service? -

i wish run soap-ui on linux (solaris) machine limited functionality, don't have ui, , cannot install software on or open x11 forwarding. i can run java applications, , settle alternative soap-ui. the objective able send soap message as-is https url. i have tried sending request own java application, need more trustworthy ' 404 not found ' response i'm getting doesn't make sense, while same url sending me wsdl file of web service. found guide here , load tests. for normal functional tests, official documentation here . a sample command functional tests goes like: sh /opt/app/home/soap-ui/soapui-5.0.0/bin/testrunner.sh -a -s"test_suite2" -r -f/opt/app/home/soap-ui/test-project/reports/ /opt/app/home/soap-ui/test-project/test-soapui-project.xml

xml - Not able to run the application, 'too much output to process' - Android Studio -

below xml code snippet. no changes done mainactivity.java. had started making calculator , done designing part when tried run application (on various actual devices), android studio's logcat showed - 'too output process' , force closed on device (actual device, not emulator). had used shape.xml , strings.xml file. nothing else! mainactivity.xml file <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="wrap_content" android:layout_height="match_parent" android:paddingleft="@dimen/activity_horizontal_margin" android:paddingright="@dimen/activity_horizontal_margin" android:paddingtop="@dimen/activity_vertical_margin" android:paddingbottom="@dimen/activity_vertical_margin" tools:context=".mainactivity" android:id="@+id/asdjk" android:b

Hadoop on a single node vagrant VM - Connection refused when starting start-all.sh -

i have created vagrant virtual machine , installed hadoop on that. single server cluster. when try start hadoop on machine gives following error: mkdir: call master/127.0.1.1 localhost:9000 failed on connection exception: java.net.connectexception: connection refused; more details see: http://wiki.apache.org/hadoop/connectionrefused and idea? machine named master. server ubuntu. thanks! this because hdfs nodes not running go to, cd hadoop_home/sbin ./start-all.sh will start processes.

Java Spring Data @Query with @OneToMany relation returns no result -

i have following entities: @entity public class customer extends baseentity { private string firstname; private string lastname; @onetomany(mappedby = "customer", cascade = cascadetype.all) private set<address> addresses; ... @entity public class address extends baseentity { private string street; private string housenumber; private string zipcode; private string city; @manytoone private customer customer; ... and following repository interface class: @repository public interface customerrepository extends crudrepository<customer, long> { @query("select c customer c join c.addresses (a.city = :cityname)") list<customer> findbycity(@param("cityname")string city); } now, i'm trying run following integration test, fails , absolutely don't know why. unfortunately, i'm beginner spring , i'm trying learn ;-) @test public void testfindcustomerbycity() {

python - Run multiline for loop in a single line -

>>> query='';for var in xrange(9):\n\tquery+=str(var) file "<stdin>", line 1 query='';for var in xrange(9):\n\tquery+=str(var) ^ syntaxerror: invalid syntax >>> query='';for var in xrange(9): query+=str(var) file "<stdin>", line 1 query='';for var in xrange(9): query+=str(var) ^ syntaxerror: invalid syntax why wont above code work? following works >>> query="" >>> var in xrange(9): query+=str(var) ... >>> query '012345678' >>> the ; allowed combine "small statements". expressions, print, , like. for loop, on other hand, compound statement. see full grammar specification : simple_stmt: small_stmt (';' small_stmt)* [';'] newline small_stmt: (expr_stmt | print_stmt | del_stmt | pass_stmt | flow_stmt | import_stmt | global_stmt | exec_stmt | assert_st

javascript - jQuery post and get not returning anything, despite the network request is being sent succesfully -

i have following javascript function: function test() { jquery.post("http://www.example.com/test.php", {}) .done(function(data) { alert(data); }) .fail( function(xhr, textstatus, errorthrown) { console.log(xhr); console.log(textstatus); console.log(errorthrown); }); } and test.php file reads this: <? echo "test"; ?> when call function either clicking on on page, either typing console, alert not firing, instead fail part of jquery.post being fired, following values: xhr -> object textstatus -> "error" errorthrown -> "" i've checked firefox debugers network, see request being sent desired url, , little circle @ left side gets green, means kind of response server, transfered column single "-" line, , received column 0 bytes. if call page " http://www.example.com/test.php " browser, works correctly. what problem, or how p

angularjs - Scrolling problems with kendo-ui Autocomplete in embedded mode (without iframes) -

i'm altering website devided iframes being embedded (with angularjs), without iframes. there big problem this: had kendo ui auto-complete drop-down element selecting locations. behavior iframe , embedded totally different concerning scrolling in area around/beneath auto-complete drop-down. old app: site (iframe) around scrolled , drop-down still visible , moved rest of site until selected item. new app: drop-down box closes , have retype input open again. unacceptable usability! how auto-complete drop-down (doesn't have kendo if not possible) have old scrolling behavior in embedded mode? well, found workaround works fine me: in directive html, added callback event k-close . in callback in controller prevented default behavior of close event (of course under specific conditions) following code in controller: $scope.closecallback= function (e) { if (someconditionforwhichdropdownshouldntbeclosed) { e.preventdefault(); } }; and here&#

Opencart 2.0 How to duplicate filters? -

we creating filters on opencart 2.0. gonna create "color" filter, problem filter go on every category. have put filter manually in each category or there way duplicate filter or applicate directly every category? thank you!:) the product color should product attribute , or option , not category. can filter attribute/option. need extension offer attribute or option filtering. the color product option if not default variation of product, , modify properties, i.e. price, different sku # entirely. if attribute, informational purposes only.

ruby on rails - Conditionally add class to link_to with slim syntax -

i have link , code follows: = link_to 'payment', account_payment_path, class:{'active'} and want add conditional logic view, if action_name same, add class active i change following code = link_to 'payment', account_payment_path, class:{'active' if action_name == 'payment'} but results in error. how can fix it.? if want active links there gem build active_link_to , can use , handle adding active class you: =active_link_to 'payment', account_payment_path for problem can use this: = link_to 'payment', account_payment_path, class: (action_name == 'payment' ? 'active' : '')

exploit - Metasploit meterpreter session editing files with Vi editor -

in meterpreter session after exploiting system, wanted edit .txt file within meterpreter session opened. used command: meterpreter > edit mypasswords.txt after that, opened vi editor editing not vi editor @ all. want know if there way of changing meterpreter' default editor(vi) nano. iirc uses default editor. can change default editor nano adding or modifying following lines in ~/.profile file: editor=nano visual=$editor export editor visual

python - how to drop dataframe in pandas? -

tips there dropping column , rows depending on condition. want drop whole dataframe created in pandas. in r : rm(dataframe) or in sql: drop table this release ram utilization. generally creating new object , binding variable allow deletion of object variable referred to. del , mentioned in @edchum's comment, removes both variable , object referred to. this over-simplification, serve.

testing Hibernate with Spring's EmbeddedDatabaseBuilder issues with SpringSessionContext -

i unit-testing spring framework's embeddeddatabasebuilder datasource , passing hibernate config sessionfactory , using spring 4 , hibernate 4. i not using spring context in way - config use programmatic (no annotations, no xml except hibernate mapping files). i expected hibernate use default threadlocalsessioncontext , able start , rollback transactions in unit test. however somehow hibernate has set sessionfactory.currentsessioncontext spring's springsessioncontext , complains whenever try call sessionfactory.getcurrentsession() : hibernateexception: not obtain transaction-synchronized session current thread @ org.springframework.orm.hibernate4.springsessioncontext.currentsession(springsessioncontext.java:134) @ org.hibernate.internal.sessionfactoryimpl.getcurrentsession(sessionfactoryimpl.java:1014) in code below in unit test, have set hibernate.current_session_context_class thread ignored or replaced spring implementation. public abstract class h

web frontend - How to exit javascript script tags early? -

i have page bunch of .... sections. in 1 of them, half way through , decide want stop, , not run rest of contents of script tag - still run other code segments on page. there way without wrapping entire code segment in function call? for example: <script type='text/javascript'> console.log('1 start'); /* exit here */ console.log('1 end'); </script> <script type='text/javascript'> console.log('2 start'); console.log('2 end'); </script> which should produce output 1 start 2 start 2 end and not 1 end . the obvious answer wrap script in function: <script type='text/javascript'> (function(){ console.log('1 start'); return; console.log('1 end'); })(); </script> although best approach, there cases not suitable. question is, other way can done, if any? or if not, why not? you can use break statement :

html - how to remove blank space from web page? -

Image
this question has answer here: html: white space around elements, how remove? 2 answers i have 1 problem web page design.can't remove space page! by style: <body> <div style="width:100%;" > ss </div> please see picture of page: nullify margin of document, add style web page <style> html, body{ margin: 0; } </style>

Not working- Passing data from Controller to View in a PHP MVC -

i'm watching tutorial on php, , have problems. everytime call variable in view throws error notice: trying property of non-object in /opt/lampp/htdocs/talkingspace/topics.php on line 18 and notice: undefined variable: totaltopics in /opt/lampp/htdocs/talkingspace/templates/topics.php on line 36 earlier instead of ,for example, $topic->userid, put $topic['userid'], not working anymore. here template/topics.php: <?php include('includes/header.php'); ?> <ul id="topics"> <?php if($topics) : ?> <?php foreach ($topics $topic) : ?> <li class="topic"> <div class="row"> <div class="col-md-2"> <img class="avatar pull-left" src="images/avatars/<?php echo $topic['avata