Posts

Showing posts from January, 2014

How can I get the length of a String in Swift 2.0? -

so far was: let string = "my example string" if count(string) >= 3 { ... } but error: count unavailable: access count property on collection. type string doesn't conform protocol collectiontype oh, simple: string.characters.count

entity framework - How to seperate Initializer method for various environments -

i new ef code first. i've project in i've created initializer class derived createdatabaseifnotexists, dropcreatedatabaseifmodelchanges, dropcreatedatabasealways or custom db initializer. i've used "dropcreatedatabaseifmodelchanges" development purpose, it's recreate database whenever model changes , it's during development, time deploy qa , production environment. my idea keep development namespace models { public class schoolinitializer : dropcreatedatabaseifmodelchanges<schoolcontext> { protected override void seed(schoolcontext context) { } } } and qa or production namespace models { public class schoolinitializer : createdatabaseifnotexists<schoolcontext> { protected override void seed(schoolcontext context) { } } } how achive using app.config file. when pubish qa or release, should change automatically. thanks. use slowcheetah package, ...

forms - drupal changing input html attribute "tabindex" in entityform module -

there module creating html forms in drupal cms called "entity form". created entity form 2 text boxes , 1 text area. how can custom input's html attributes? want change "tab index" attribute of these 3 inputs. for example there is: <textarea tabindex="1"></textarea> i want change to: <textarea tabindex="3"></textarea> i tried find input's name in module's files customization didn't find anything. i prefer drupal interface. want find other way,if wasn't possible.

vba - Excel copy range to keep hidden rows -

as question states, anyway copy/paste range , copy hidden rows too? currently use xlwb.sheets("template").range(template_rfull_inc).copy thisworkbook.sheets(test_name).range("a11") application.displayalerts = false .pastespecial xlpastecolumnwidths .pastespecial xlpastevalues, , false, false .pastespecial xlpasteformulas, , false, false .pastespecial xlpasteformats, , false, false .pastespecial xlpastevalidation application.cutcopymode = false application.displayalerts = true end is code like .pastespecial xlhiddenrows if long winded or going cause headache have work around if want same lines hidden in copy (test_name), have run else after copy. closed should work. dim toproworiginal long dim toprowcopy long toproworiginal = template_rfull_inc.row toprowcopy = thisworkbook.sheets(test_name).range("a11").row dim r range each r in range(template_rfull_inc).rows thisworkbook.sheets(test_name).rows(r...

python - Why does pandas series.map method work for column concatenation? -

from couple of other posts , simple way concatenate columns in dataframe use map command, in example below. map function returns series, why can't regular series used instead of map? import pandas pd df = pd.dataframe({'a':[1,2,3],'b':[4,5,6]},index=['m','n','o']) df['x'] = df.a.map(str) + "_x" b x m 1 4 1_x n 2 5 2_x o 3 6 3_x this works though i'm creating series. df['y'] = pd.series(df.a.map(str)) + "_y" b x y m 1 4 1_x 1_y n 2 5 2_x 2_y o 3 6 3_x 3_y this doesn't work, gives typeeror df['z'] = df['a'] + "_z" typeerror: unsupported operand type(s) +: 'numpy.ndarray' , 'str' this doesn't work either: df['z'] = pd.series(df['a']) + "_z" typeerror: unsupported operand type(s) +: 'numpy.ndarray' , 'str' i checked see if map returns ...

ios - objective c and iphone map route issue -

i have been using link polyline points content of link i have expression polyline points nsstring* apiurlstr = [nsstring stringwithformat:@"http://maps.google.com/maps??output=dragdir&saddr=%@&daddr=%@", saddr, daddr]; nsregularexpression *regex = [nsregularexpression regularexpressionwithpattern:@"points:\\\"([^\\\"]*)\\\"" options:0 error:null]; nstextcheckingresult *match = [regex firstmatchinstring:apiresponse options:0 range:nsmakerange(0, [apiresponse length])]; nsstring *encodedpoints = [apiresponse substringwithrange:[match rangeatindex:1]]; but code returns encodedpoints nil in response this response link above in xcode: link code: response content how encoded points using regular expression? problem in code? working fine before 2 days. don't know problem. you should use webservice. google maps provides api . your issue you're downloading web page. said working 2 days ago? well, may have change...

python - Simple line plots using seaborn -

Image
i'm trying plot roc curve using seaborn (python). matplotlib use function plot : plt.plot(one_minus_specificity, sensitivity, 'bs--') where one_minus_specificity , sensitivity 2 lists of paired values. is there simple counterparts of plot function in seaborn? had @ gallery didn't find straightforward method. since seaborn uses matplotlib plotting can combine two. if want adopt styling of seaborn set_style function should started: import matplotlib.pyplot plt import numpy np import seaborn sns sns.set_style("darkgrid") plt.plot(np.cumsum(np.random.randn(1000,1))) plt.show() result:

mongodb - Python Eve: Add custom route, changing an object manually -

i started using eve , it's great getting full rest api run. however, i'm not entirely convinced rest perfect in cases, e.g. i'd have simple upvote route can increase counter of object. if manually retrieve object, increase counter, , update it, can run problems getting out-of-sync. i'd add simple extra-route, e.g. /resource/upvote increases upvote count 1 , returns object. i don't know how "hacky" is, if it's over-the-top please tell me. don't see problem having custom routes important tasks work in restful way. know treat upvotes own resource, hey thought we're doing mongodb, let's not overly relational. so here far got: @app.route('/api/upvote/<type>/<id>') def upvote(type, id): obj = app.data.find_one_raw(type, id) obj['score'] += 1 problem #1 find_one_raw returns none time. guess have convert id parameter? (i'm using native mongodb objectid) problem #2 how save object? don't s...

java - Provider order using AuthenticationManagerBuilder -

i'm using spring security 4.0.1 , want use multiple authentication providers authentication using java-based configuration. how specify provider order? i hoping use authenticationmanagerbuilder , since that's websecurityconfigureradapter.configureglobal() exposes, don't see way specify order. need create providermanager manually? update: here's problem clarification based on arun's answer. specific providers want use activedirectoryldapauthenticationprovider , daoauthenticationprovider custom userservice . ultimately i'd authenticate against daoauthenticationprovider first , activedirectoryldapauthenticationprovider second. the ad provider involves call authenticationmanagerbuilder.authenticationprovider() dao provider involves calling authenticationmanagerbuilder.userservice() , creates daoauthenticationprovider around user service behind scenes. looking @ source code, doesn't directly place provider in provider list (it creates configu...

c# - Trim JSON fields, not working for nested JSON -

i want trim string field in json. use own jsonconverter (code below, newtonsoft), added on mvc application start in global.asax. go fine, if there no nested json. if there is, nested json not handled. why? should change fix it? for example {"name":" jacek ","age" = " 10 "} working {"name":" jacek ","age"=" 10 "."address":{"street":" long "}} not working street, works name , age. my string converter string public class mystringconverter : jsonconverter { public override bool canconvert(type objecttype) { return objecttype == typeof(string); } public override bool canread { { return true; } } public override object readjson(jsonreader reader, type objecttype, object existingvalue, jsonserializer serializer) { var text = (string)reader.value; return triminputfield(text); } public override void ...

linux - How to create a zip file without the middle directory? -

i have directory structure: 20150626/b/cctype1/file1 20150626/b/cctype2/file2 20150626/b/cctype3/file3 in zip file want directory structure be: 20150626/cctype1/file1 20150626/cctype2/file2 20150626/cctype3/file3 skipping directory b, without creating new directory structure , copying/moving files explicitly there large number of files! this trick using sym link should work , avoid copying/moving ! cd 20150626/ ln -s b 20150626 zip -r yourfile.zip 20150626/ (i not sure can use zip directly it)

c# - array of bytes to SQL Server -

how pass array of bytes c# windows application sql server via stored procedure? code in sql : insert pers_usermachine (userid,nboftemplates,fingerprint1,fingerprint2,fingerchecksum1,fingerchecksum2) values( @userid, @nboftemplates, convert(varbinary(max),@fingerprint1), convert(varbinary(max),@fingerprint2), @fingerchecksum1, @fingerchecksum2 ) and code in c#: public int saveuser(int id, string userid, int nboftemplates, byte [] fingerprint1, byte [] fingerprint2, int32 fingerchecksum1, int32 fingerchecksum2) { try { hybriddictionary paramsdictionary = new hybriddictionary(); paramsdictionary.add("@id", id); paramsdictionary.add("@userid", userid); paramsdictionary.add("@nboftemplates", nboftemplates); paramsdictionary.add("@fingerprint1"...

php - Send AJAX Request with Query String -

i have standard hyperlink 2 query strings send php form seen below: echo ' <strong>(<a id="cancel-upgrade" href="unsubscribe.php?cu='.$payref.'&su='.$stripe_subscription_id.'">cancel upgrade)</a></strong>'; the way know how send data via ajax is: $.post('process-payment.php', $("form#payment-form").serialize(), function (data) { if (data == "success") { ...something else { else } }); is there anyway use link have , use query string data, via ajax, php form , act on success/error messages received? you can add query string parameters post request request. example: $.post('process-payment.php?somekey=somevalue&anotherkey=anothervalue', //... so if you're echoing values php might like: $.post('process-payment.php?cu=<?php echo $payref; ?>&su=<?php echo $stripe_subscription_id; ?>', //... (or of...

html - Side Navigation styling issues -

would center paragraph content respect .main-content div right of side navigation, when use margin: 0 auto nothing happens. know wrote css wrong not sure of how fix it.i white background of link that's clicked span entire row of div holds navigation. doesn't reach far left side. $(document).ready(function(){ var navelement = $('.nav-el'); $('.content-area').hide(); navelement.find('a').on('click', function(e){ e.preventdefault(); navelement.find('.current').removeclass('current'); $(this).addclass('current'); $(this.hash).show().siblings().hide(); }).first().click(); }); .hide { display: none; } body { } .container { position: relative; } #contentbox { border: 1px solid grey; width: 960px; height: 1000px; border-radius: 5px; margin: 0 auto; } .side-nav { position: relative; float: left; width: 250px; background-color: green; height: 100%; } .nav-el { margin: 0;...

Extract tuples from file with python and regEx -

have html format file sorts of data, need extract pairs of (id, title). wrote regex seems work fine in regex online tester. file need extract data: <g id="node841" class="cond_node"><title>sr_aud_nbest_list_playlistplayplaylist_cond</title> <g id="node842" class="prompt_node"><title>sr_aud_nbest_list_playlistplayplaylist_prompt</title> <g id="edge841" class="edge"><title>sr_aud_nbest_list_playlistplayplaylist_cond&#45;&gt;sr_aud_nbest_list_playlistplayplaylist_prompt</title> <g id="node848" class="node"><title>sr_aud_main_link_51</title> <g id="node841" class="prompt_node"><title>sr_aud_nbest_list_playlistplayplaylist_prompt</title> <g id="node841" class="cmd_node"><title>sr_aud_nbest_list_playlistplayplaylist_cmd</title> <g id="node856...

apache - htaccess rewrite rule needed for example.com/xxx/xxx -

i need rewrite rue redirect below www.example.com/45678/2323 to below www.example.com/view_basket.php?order_id=45678&pin=2323 i'm using below code seems there problem base url when i'm suing rewrite rule images on page not loading, images on page has simple relative path below <img src="image.jpg"> or <img src="folder/image.jpg"> here rewrite rule rewriteengine on rewritebase / rewritecond %{http_host} ^(?!www\.)(.+) [nc] rewriterule ^(.*) http://www.%1/$1 [r=301,ne,l] rewriterule ^([^/]*)/([^/]*)$ /view_basket.php?order_id=$1&pin=$2 [l]

php - how should I use output of conversion of htaccess rewrite rules to nginx rewrite rules -

i use neginx, need convert htaccess rewrite rules neginx rewrite rules. used this converting. want know how should use of output ? .htaccess: rewriteengine on rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^(.*)$ index.php?rt=$1 [l,qsa] errordocument 404 /error404.html nginx rules: (the output) if (!-f $request_filename){ set $rule_0 1$rule_0; } if (!-d $request_filename){ set $rule_0 2$rule_0; } if ($rule_0 = "21"){ rewrite ^/(.*)$ /index.php?rt=$1 last; } how should use of output ? it should noted have multiple .htaccess in different folders (3 .htaccess files in 3 different folder) in nginx, there no such thing htaccess file. of nginx rules need go directly nginx config file. see: http://nginx.org/en/docs/beginners_guide.html#conf_structure what you'll need because htaccess files in different folders need wrap rules in location blocks. so example, if rules posted translated htaccess ...

javascript - call php var inside JS -

could tell me why not working ? <html> <body> <?php $var1 = "hello"; echo $var1; ?> <button type="button" onclick="document.getelementbyid('demo').innerhtml = <?php echo(json_encode($var1)); ?>;"> hi</button> <p id="demo"></p> </body> </html> what should able read php variable js ? thanks it string. ' s needed added around string. onclick="document.getelementbyid('demo').innerhtml = '<?php echo(json_encode($var1)); ?>';"

Unable to Install Wrapped App using Microsoft Intune -

i new microsoft intune. enrolled ios , android devices on microsoft intune. i upload ipa file , apk file on microsoft intune , both installed on respective device. then wrapped both apps using microsoft intune wrapping tool ios , android , again upload both apps. unable install these apps on devices. apps download starts @ end of progress there error failed download. please me regarding this. the question bit dated, if still issue, ios specifically, try wrapping application , downloading again, , that, keep eye @ log (from xcode / window / devices). may see log lines indicate issue is, or @ least in right direction - possibly issues certificate, signing, , like.

How to specify external C++ source folders for Android NDK with Gradle -

i want add c++ source files android studio project not in project tree. i'm new gradle, , tried research as possible. read, following build.gradle file should work, doesn't. bit jni.sourcedirs came post: http://www.shaneenishry.com/blog/2014/08/17/ndk-with-android-studio/ is right approach? apply plugin: 'com.android.application' android { compilesdkversion 22 buildtoolsversion "22.0.1" defaultconfig { applicationid "com.mycompany.myapp" minsdkversion 22 targetsdkversion 22 ndk { modulename "mymodule" ldlibs "log" } } buildtypes { release { minifyenabled false proguardfiles getdefaultproguardfile('proguard-android.txt'), 'proguard-rules.txt' } } sourcesets.main { jni.srcdirs '../external/source/dir' } } have @ article this: http://www.sureshjosh...

ios - Set Image on UITabBar Contoller -

Image
i have developed tabbar base application have 5 tabs , trying set images on each tabs. ive used inbuid functionalities provide xcode setting images im not getting exact results want. here tabbar controller in case getting images in grey colors actual images not grey colored images. please 1 have solution solve issues.i want set image reties have. thank you. begin ios 7, can choose treat of images in app template—or stencil—image. when elect treat image template, system ignores image’s color information , creates image stencil based on alpha values in image. uiimage has new property named renderingmode default rendering mode uiimagerenderingmodeautomatic . experience means template image when init image need uiimage *image = [uiimage imagenamed:@"someimage"]; uiimage *thisoneshouldbeused = [image imagewithrenderingmode: uiimagerenderingmodealwaysoriginal] see template images in uikit user interface catalog more information

Integrating spring security in a web application which uses angularjs for routing -

my web application uses angular routing .the problem face on spring security integration is, once security xml file in action doesn't prevent intercept url's specified. please give solution. spring security xml: <http auto-config="true"> <intercept-url pattern="/admin**" access="role_user" /> <form-login login-page="/rest/testing/login" authentication-failure-url="/rest/testing/login?error" username-parameter="username" password-parameter="password" /> <logout logout-success-url="/rest/testing/login" /> <!-- enable csrf protection --> <csrf/> </http> <authentication-manager> <authentication-provider> <user-service> <user name="admin" password="admin" authorities="role_user" /> </user-service> ...

javascript - Encryption: What is a tag? -

i reading through node-forge documentation , keep seeing reference 'tag' variable. tag , meant for? in examples given, they're using aes in galois/counter mode (gcm) . gcm provides both confidentiality (similar ctr mode), , message integrity (similar if using hmac in addition aes). the tag authentication tag. it's computed each block of ciphertext, , used verify no 1 has tampered data. you can see these lines here: var pass = decipher.finish(); // pass false if there failure (eg: authentication tag didn't match) if (pass) { // outputs decrypted hex console.log(decipher.output.tohex()); } where check made see if authentication tag validated correctly.

java - Getting Facebook Profile Picture in Android -

i building android app , have integrated facebook login form of registration , login. trying work out best way of getting users profile picture, have had allow @ developer docs - https://developers.facebook.com/docs/graph-api/reference/user/picture/ , not sure how handle response, mean how image in response, sent via bitmap or url link, not quite sure. here code docs provide getting profile picture /* make api call */ new graphrequest( accesstoken.getcurrentaccesstoken(), "/{user-id}/picture", null, httpmethod.get, new graphrequest.callback() { public void oncompleted(graphresponse response) { /* handle result */ } } ).executeasync(); thanks help you have perform graphrequest docs how so. use facebook's profilepictureview in xml layout. xml layout <com.facebook.login.widget.profilepictureview android:id="@+id/myprofilepic" android:layout_width="48dp" ...

windows - running php scripts locally though task manager -

i'm looking advice. rignt i've got bunch of php scripts i've scheduled through cron. run on local machine doing stuff pulling stuff out of mysql db , sending automated emails. run them have in crontab: 0 7 * * 1 /usr/bin/php /phpscripts/script.php i need migrate of scripts windows machine. i'm planning use windows task scheduler run scripts, how can run actual php scripts locally? understand need xampp run apache server? guess need windows equivalent of /usr/bin/php in crontab. installing php you don't have install xammp , can install php alone, have ate windows php installation guide: windows installer (php 5.1.0 , earlier) windows installer (php 5.2 , later) manual installation steps if prefer installing xamp, can run php script after locating php.exe -f flag: c:\xampp\php\php.exe -f c:\xampp\htdocs\my_script.php running php file after have php installed, check command line php on microsoft windows manual information on how run ...

java.util.concurrent - Waiting for a hierarchy of tasks to complete -

this abstraction of actual problem, hope it's accurate enough explain things. i'm processing file hierarchy, , i'm processing files asynchronously using java threadpoolexecutor finite number of threads , unbounded queue. starting @ particular directory, add task queue each file within directory. shutdown , await completion. the tasks despatched using executor.execute(runnable). the problem when directory contains further directories, 1 of these tasks may spawn further tasks, , these tasks not being executed because @ top level threadpoolexecutor has been shut down. so question is, in top level thread, how await completion of whole hierarchy of tasks, recognising haven't started yet? i did abstraction of problem. if described, walk whole hierarchy in orginal parent thread , fire off tasks there. in real problem can't that: it's essential feature of problem spawned child task submits further tasks. in top level thread can use that: cou...

c# - Nested ILookup - Argument ype error -

consider following object: class menu{ public int section {get; set;} public string parent {get; set;} public string name {get; set;} public string url {get; set;} /* more */ } i getting list of these objects , want group them section , inside each section want group them parent used following structure: ilookup<int, ilookup<string, menu>> menustructure = menulist.tolookup(m => m.section, menulist.tolookup(m => m.parent)); but i'm getting error: cannot implicitly convert type 'system.linq.ilookup<int,mynamespace.menu>' 'system.linq.ilookup<int,system.linq.ilookup<string,mynamespace.menu>>'. explicit conversion exists (are missing cast?) what doing wrong?

python - Shifting order of rows in Dataframe -

i trying make last 2 rows of dataframe df first 2 of dataframe previous first row becoming 3rd row after shift. because added rows [3,0.3232, 0, 0, 2,0.500] , [6,0.3232, 0, 0, 2,0.500] . however, these added to end of df , hence become last 2 rows, when want them first two. wondering how this. df = df.t df[0] = [3,0.3232, 0, 0, 2,0.500] df[1] = [6,0.3232, 0, 0, 2,0.500] df = df.t df = df.reset_index() you can call reindex , pass new desired order: in [14]: df = pd.dataframe({'a':['a','b','c']}) df out[14]: 0 1 b 2 c in [16]: df.reindex([1,2,0]) out[16]: 1 b 2 c 0 edit another method use np.roll note returns np.array have explicitly select columns df overwrite them: in [30]: df = pd.dataframe({'a':['a','b','c'], 'b':np.arange(3)}) df out[30]: b 0 0 1 b 1 2 c 2 in [42]: df[df.columns] = np.roll(df, shift=-1, axis=0) df out[42]: b 0 b 1 1 c 2 2 0...

excel - vba find value then paste another into different cell in another column -

i'm running macro looks value column of 'sheet 1' in column c of sheet 2, if these match value column b of sheet 1 should copied column m of corresponding row in sheet 2. the macro have works, because massive worksheet, loop in taking far time. because sheet 1 has around 300,000 rows , value in each instance unique. in sheet 2 there around 50,000 rows. it's been running overnight , has reached 60,000 rows in sheet 1 far i'm no means vba expert, or intermediate i've read maybe using find faster looking match , looping? this macro i'm using option explicit sub lookupandcopy() application.screenupdating = true dim j long, long, lastrow1 long, lastrow2 long dim sh_1, sh_3 worksheet dim myname string set sh_1 = sheets("sheet1") set sh_3 = sheets("sheet2") lastrow1 = sh_1.usedrange.rows.count j = 2 lastrow1 myname = sh_1.cells(j, 1).value lastrow2 = sh_3.usedrange.rows.count = 2 lastrow2 if sh_3.cells(i, 3).value = ...

logstash - How to dynamically calculate a field value of current log entry from its preceding log entry? Or should this be done at kibana visualization side? -

my csv data format: date total ----- --- date1, 10 date2, 15 date2, 30 i want logstash dates in timestamp field, "total" in total field (its easy upto part) want calculate "increment" field diffing "totals" previous log/csv entry. output this date total increment ----- --- --------- date1, 10, 0 date2, 15, 5 date2, 30, 15 also, if want visualise time difference between different log entries, how do that? tips highly appcreciated. logstash doesn't provide in terms of correlation between events. take @ elapsed{} filter, keeps cache of "start" events in order tag "end" events when arrive. use system in own filter compute running total. if want current total, can aggregate , display sum in kibana.

python - Simpler Way of Creating Lists from other Lists -

i have 3 lists: x, y, , z. same size, need create new lists of x, y, , z, depending on value @ each index of z, shown below: xnew = [] ynew = [] znew = [] = 0 value in z: if value > 0: xnew.append(x[i]) ynew.append(y[i]) znew.append(z[i]) += 1 does know if there tidier, perhaps more efficient, way of performing above computation? probably straightforward way: it = zip(x, y, z) xnew, ynew, znew = zip(*(t t in if t[-1] > 0)) we use the zip function twice restore original structure of data. zip(x, y, z) creates new iterator object, yields triples. (t t in if t[-1] > 0) filters triples ( t[-1] value ). zip(*(...)) yields 3 tuples , xnew , ynew , znew receive them.

java - jetty Persistent Sessions -

i'm using persistent sessions jetty, described here: http://www.eclipse.org/jetty/documentation/9.3.x/using-persistent-sessions.html sessions saved , restored after stop/restart. this true long application not abruptly terminated, i.e. not calling stop() method on server instance, though file session has been persisted looks fine. i'd able restore sessions, maximum extent possible, in case of sudden halt of system. any suggestions on how achieve this?

c# - Get method specifically to handle a 0 value -

in web api controller method have. public ihttpactionresult getmember(int id) { member member = db.members.find(id); if (member == null) { return notfound(); } return ok(member); } basically checking here if there no current member id = 0, returning notfound ... , ui receiving. the scenario 0 value api should provide new item defaults.any examples on how achieve this? i came not able work right. public ihttpactionresult getmember(int id) { member member = db.members.find(id); if (id > 0) { var members = db.members.find(); member = members.firstordefault((m) => m.memberid == id); //return notfound(); if (member == null) { return notfound(); } else { db.members.add(member); db.savechanges(); } return ok(member); ...

pouchdb size increasing whilte deleting and restoring docs -

i've noticed size of db increasing after deleting / restoring docs auto-compaction set true . do wrong? here code: var db = new pouchdb("mydb", {adapter: "idb", auto_compaction: true}); var docs = [{_id: "0", name: "foo1"}, {_id: "1", name: "foo2"}]; db.bulkdocs(docs).then(function() { db.alldocs({include_docs: true}).then(function(result) { docs = result.rows.map(function(row) { return row.doc; }); }; }; function remove() { (var in docs) { docs[i]._deleted = true; } return db.bulkdocs(docs); }; function restore() { (var in docs) { delete docs[i]._deleted; delete docs[i]._rev; } return db.bulkdocs(docs); } // calling function increases size of db function test() { return remove(docs).then(restore); } that's not correct way delete documents pouchdb. use: db.remove(doc, [options], [callback]) ...

Spring 4 wrap all hibernate exception in NPE -

i have strange error. i use spring4 (4.1.6.release) , hibernate4 (4.3.10.final). when break annotation in entity this: @joincolumn(referencedcolumnname = "nonexistfieldname") i catch npe springframework when entitymanagerfactory bean created. this exception throws in org.springframework.beans.factory.support.abstractautowirecapablebeanfactory#initializebean(java.lang.string, java.lang.object, org.springframework.beans.factory.support.rootbeandefinition) it's very, strange. because hibernate throws throw new annotationexception( "unable map collection " + collectionentity.getclassname() + "." + property.getname(), ex ); in hibernate-core-4.3.10.final-sources.jar!/org/hibernate/cfg/annotations/collectionbinder.java:1461 but in abstractautowirecapablebeanfactory.java:1572 catch(throwable ex) already nullpointerexception full stack trace: http://pastebin.com/1nsznqyg why strange?

php - MYSQL Joins in Select query -

i writing database manage sport league table needs separate tabe hold details of occasional points variations fall outside normal logic of league table calculation. the 2 tables have are create table if not exists `fixtures` ( `id` int(6) unsigned not null auto_increment, `comp_id` int(6) not null, `date` date default null, `time` time default null, `hteam_id` int(6) default null, `ateam_id` int(6) default null, `hscore1` int(6) default null, `ascore1` int(6) default null, `hscore2` int(6) default null, `ascore2` int(6) default null, `hbonus` int(6) not null, `abonus` int(6) not null, `played` varchar(2) not null, primary key (`id`) ) engine=myisam default charset=latin1 auto_increment=30 ; create table if not exists `pointsadjust` ( `id` int(6) unsigned not null auto_increment, `fix_id` int(6) default null, `team_id` int(6) default null, `value` int(6) default null, `reason` varchar(75) character set latin1 collate latin1_general_ci ...

embedded - PIC16F887 PORT won't work with XC8 C compiler -

i'm pretty new pic programming , i'm trying use c (compiled microchip's xc8 free in mplabx ) make simple "input output" program. problem i'm having ra2, ra3 , ra5 input pins not working when programming in c. it's not hardware problem, because when programming in ladder pins work fine. i've searched around on internet while , couldn't find same problem yet. the program i'm trying burn onto pic follows: #define _xtal_freq 20000000 #include <xc.h> // begin config #pragma config fosc = hs // oscillator selection bits (hs oscillator) #pragma config wdte = on // watchdog timer enable bit (wdt enabled) #pragma config pwrte = off // power-up timer enable bit (pwrt disabled) #pragma config boren = on // brown-out reset enable bit (bor enabled) #pragma config lvp = off // low-voltage (single-supply) in-circuit serial programming enable bit (rb3 digital i/o, hv on mclr must used programming) #pragma config cpd = off // data eeprom ...

websphere - Federation Issue -

i have couple of questions in federation process. 1) can node of was v8.5.5 federated dmgr of was v7.0 ? 2) can node running on windows7 o/s federated dmgr sitting in linux o/s (linux o/s running in vmware in same machine windows) ? i trying federation process in different scenarios. tried federate node of v8.5.5 running on windows 7 dmgr of v7.0 running on linux o/s (linux running on vmware in same machine windows) , got error while federating. tried dmgr console command prompt of node v8.5.5. both dmgr , server running , checked host names. both host names different. the error is... com.ibm.websphere.management.exception.connectorexception: admc0016e: system cannot create soap connector connect host xxx.xxx.xxx.xxx @ port xxxx. can 1 please suggest whether can try above scenario? if might causing error? 1) can node of v8.5.5 federated dmgr of v7.0 ? no, dmgr must on highest version/fixpack level. have upgrade dmgr version 7 version 8.5.5 able...

android - Sideways Button On Edge of Screen -

Image
i'm trying add button edge of screen this: i tried using code below since rotation around center there space on right side of button half length of button. <?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" > <button android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignparentend="true" android:layout_centervertical="true" android:rotation="270" android:text="button" /> </relativelayout> use relativelayout access attribute layout_alignparentend button . if root layout relativelayout use that, if not can wrap button in relativelayout , use layout. if choose latter option, need position layout. ...

sql server - how to pivot result based upon physical column name -

Image
i have 3 tables 1. master table m_mastertable 2. detail table of m_mastertable 3. actual physical table how write query give me desire output, matching physical columns fieldname(2) in pivoting result? id primary key detailed foreign key. 1 : have @ this: --quick , dirty sample data declare @master table ( id int, tablename nvarchar(100) ) declare @detail table ( detailid int, tableid int, fieldname nvarchar(100), excelmappingcolumn nvarchar(100) ) insert @master values (1,n'a') insert @detail values (1,1,n'code',n'virtualcode') insert @detail values (2,1,n'value',n'value of virtual exam') -- getting query declare @stmt nvarchar(max) = '' declare @columns nvarchar(max) select @columns = coalesce(@columns + ',[','',@columns + ',[') + fieldname + '] [' + excelmappingcolumn + ']' @detail tableid = 1 select @stmt = 'select ' + @colu...

ios - How to correctly pass selector as parameter in swift -

conclusively speaking i have class contains instances of b. , in class a, pass function of selector method of b. , b use selector register notification. however, when notification comes in, not run selector , show "unrecognized selector sent instance". if move want in class b class a, worked. however, want them separated seems more organized. new objective-c , swift, therefore, don't know how pass selector parameter in case. answer in swift great. viewcontroller.swift class viewcontroller: uiviewcontroller { var sessionctrl : gksessioncontrollerh! override func viewdidload() { super.viewdidload() // additional setup after loading view, typically nib. sessionctrl = gksessioncontrollerh() // register notifications registernotification() } func registernotification() { sessionctrl.registernotification(gkgesture.up, gesturehandler: "gestureuphandler") } func gestureuphandler() {...

c# - MyApp.App does not contain a definition for Initialize after adding ResourceDictionary -

everything fine till add resource dictionary. looks like: app.xaml: <application x:class="myapp.app" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" xmlns:local="clr-namespace:myapp.myapp.common"> <application.resources> <resourcedictionary> <resourcedictionary.mergeddictionaries> </resourcedictionary.mergeddictionaries> <local:mainmenubuttonvisibilityconverter x:key="mainmenubuttonvisibilityconverter" /> <!-- withoot line fine--> </resourcedictionary> </application.resources> app.g.cs: namespace myapp { ... public static void main() { myapp.app app = new myapp.app(); app.initializecomponent(); // <------ here problem app...

vb.net - Registering Changed Input -

so working on webpage displays stored information in form can edited. requester can enter contact information stored in database , can called "editor" on information , update request. issue having when populate form setting value of each textbox input , want able changed input in each form update database. code use populate form: dim customername textbox = directcast(radpanelbar1.finditembyvalue("requesterinformation").findcontrol("txtcustomername"), textbox) customername.text() = pmpmr.customername this code use updated information form once editor clicks approve button: dim customername textbox = directcast(radpanelbar1.finditembyvalue("requesterinformation").findcontrol("txtcustomername"), textbox) information.customername = customername.text i realize small sample show code webpage on 800 lines. thank you!

windows - New to Python (3.4.3), trying to pip install basic libraries and receiving this message -

command "c:\python34\python.exe -c "import setuptools, tokenize;__file__='c:\\users\\jamey\\appdata\\local\\temp\\pip-build-4xxi4hts\\numpy\\setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record c:\users\jamey\appdata\local\temp\pip-l8qukpar-record\install-record.txt --single-version-externally-managed --compile" failedwith error code 1 in c:\users\jamey\appdata\local\temp\pip-build-4xxi4hts\numpy it has lot of errors, need add basic libaries before installing more advance ones? tells me need microsoft visual c++ 10.0 for numpy , other such libraries, these difficult build on windows because need compiled during installation. setting proper build environment difficult on windows. you have few choices: download build of python includes these libraries. popular package of python includes numpy (and other scientific libraries) anacon...

How to generate Xpath for a node in XML using java? -

i have piece of code generate xpath node. doesn't create array structure of it. example, if element has 2 elements same name, need provide index point them appropriately. illustration of below. <abc> <def> </hij> </def> <def> </lmn> </def> </abc> now, xpath hij , need this: //abc[1]/def[1]/hij to xpath lmn , need this: //abc[1]/def[2]/lmn i have piece of code give me //abc/def/hij , //abc/def/lmn private string getxpath(node root, string elementname) { (int = 0; < root.getchildnodes().getlength(); i++) { node node = root.getchildnodes().item(i); if (node instanceof element) { if (node.getnodename().equals(elementname)) { return "\\" + node.getnodename(); } else if (node.getchildnodes().getlength() > 0) { if(...

android - Change a different button when i click a button -

i trying create memory game can't find way change x button when press y button. here code. want able handle different buttons when private void gridbuttonclicked been used. public class mainactivity2 extends actionbaractivity { private static final int num_rows =10 ; private static final int num_cols = 4; button buttons[][]=new button[num_rows][num_cols]; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main_activity2); populatebuttons(); } private void populatebuttons() { tablelayout table = (tablelayout) findviewbyid(r.id.tableforbuttons); for(int row=0; row < num_rows; row++){ tablerow tablerow=new tablerow(this); tablerow.setlayoutparams(new tablelayout.layoutparams( //we use fill screen tablelayout.layoutparams.match_parent, tablelayout.layoutparams.match_parent, 1.0f)); table.addview(tab...

javascript - System.OverflowException in converting js to C# -

var pin = parseint(form.mac.value.slice(-6), 16) % 10000000; i'm convert js c# this var pin = convert.toint16(networks[networkindex, 0].substring(networks[networkindex, 0].length - 6)) % 10000000; and error an unhandled exception of type 'system.overflowexception' occurred in mscorlib.dll additional information: value either large or small int16. the value big int16 . try use convert.toint32 . var pin = convert.toint32(networks[networkindex, 0].substring(networks[networkindex, 0].length - 6)) % 10000000;

php - Create record with Relation Laravel 5.1 -

hi have next code create records institution::create($request->all()); user::create([ 'name' => $request['name'], 'lastname' => $request['lastname'], 'phone' => $request['phone'], 'email' => $request['email'], 'password' => $request['password'], 'state' => 1, 'profile_id' => 1, 'institution_id' => institution::max('id'), ]); the last attributes user thats correct implement so? last 3 user attributes , correct way? or there better using institution::max('id') creates race condition. since create() static method of eloquent::model returns newly-created model, can do: $institution = institution::create($request->all()); user::create([ 'name' => $request['name'], 'lastname' => $request...

go - Runtime Error: Index out of range when attempting to os.StartProcess -

i can't seem figure out why it's doing this: i have function setup this: func (srv *server) startserver() { // stuff make sure paths correct path := srv.path + "server.exe" var args = []string{ "ip=" + srv.ip, "un=" + srv.username, "pw=" + srv.password } proc, err := os.startprocess(path, args, new(os.procattr)) if err != nil { panic(err) } } the startprocess method throws index out of range. i'm missing something, can't see it. exact error requested: panic: runtime error: index out of range goroutine 1 [running]: syscall.startprocess(0xc082052b70, 0x21, 0xc08200a6e0, 0x5, 0x5, 0xc08201dd60, 0x0, 0x0, 0x0, 0x0) c:/go/src/syscall/exec_windows.go:322 +0x94c os.startprocess(0xc082052b70, 0x21, 0xc08200a6e0, 0x5, 0x5, 0xc08200a730, 0x5217e0, 0x0, 0x0) c:/go/src/os/exec_posix.go:45 +0x482 os.startprocess(0xc082052b70, 0x21, 0xc08200a6e0, 0x5, 0x5, 0xc08200a730, 0x0, 0x0, 0...

sql - Postgres where query optimization -

in our database have table menus having 515502 rows. has column status of type smallint . currently, simple count query takes 700 ms set of docs having value of status 3 . explain analyze select count(id) menus status = 2; aggregate (cost=72973.71..72973.72 rows=1 width=4) (actual time=692.564..692.565 rows=1 loops=1) -> bitmap heap scan on menus (cost=2510.63..72638.80 rows=133962 width=4) (actual time=28.179..623.077 rows=135429 loops=1) recheck cond: (status = 2) rows removed index recheck: 199654 -> bitmap index scan on menus_status (cost=0.00..2477.14 rows=133962 width=0) (actual time=26.211..26.211 rows=135429 loops=1) index cond: (status = 2) total runtime: 692.705 ms (7 rows) some rows have column value of 1 query runs fast. explain analyze select count(id) menus status = 4; query plan --------...

C# Datatable to IList conversion -

i using below code convert dataset ilist . there better way write code below: ilist lst = new list<object>(); var tbl = dslist.tables[0]; foreach (datarow dr in tbl.rows) { lst.add(dr.itemarray); } using system.linq; ilist<object> lst = dslist.tables[0].rows.oftype<datarow>().select(x => x.itemarray).tolist(); simply using system.link's select() method on rows collection of table . extension method can called on ienumerable<t> (means on object implements interface directly or through inheritance). if don't have ienumerable<t> query, rather simple ienumerable (non generic), can use trick of calling .oftype() on it, returns generic instance. if want flatten out enumerable, can use selectmany() . if you're stuck on pre-linq .net, must have loop.

Google App Invite - Message Failed To Send -

i getting following error while sending app invite: generic::invalid_argument: com.google.apps.framework.request.badrequestexception: no associated application and/or client id found package name some info: i have tried both signed release key , debug key my application live on play store anybody got idea it? just error specifies there's no client id found app. you need to: go developer console projects apis & auth credentials create new client id: installed application android enter package name enter sha1 release or debug (which ever 1 want work with) make deep linking choice create i'm not going explain how sha1 or else can found easily. there might more, have stuff set , not removing of see if else needed. however, solve error. also, google-services.json file asked obtain @ developer page app invites not necessary app invites functioning.

hibernate - Unnecessary delete on @ManyToMany relationship -

i have 2 entities: @entity public class entity1 { @id @column(name="id_entity_1") private integer id; @onetomany(mappedby="entity1", cascade={cascadetype.persist}) private list<entity2> list; @manytomany @jointable( schema="schema", name="v_other_relationship", joincolumns={@joincolumn(name="id_entity_1", insertable=false, updatable=false)}, inversejoincolumns={ @joincolumn( name="id_entity_2", referencedcolumnname="id_entity_2", insertable=false, updatable=false ) } ) //getters , setters } @entity public class entity2 { @id @column(name="id_entity_2") private integer id; @manytoone @joincolumn(name="id_entity_1) private entity1 entity1; //getters e setters. } note not exists cascade in @manytomany relati...