Posts

Showing posts from May, 2014

python - Can a matplotlib figure object be pickled then retrieved? -

i trying pickle matplotlib figure object able regenerate graph x , y data , labels , title @ later time. possible? when trying use open , dump pickle traceback: #3rd party imports , built-in import random import matplotlib.pyplot plt import pickle pk #initializing lists x , y values. voltage trim , current measure our x , y in case. voltage_trim = range(100, 150) current_meas = [] # change of parameters modelled multiplier in case multiplier = range(1,4) # initializing lists store output current if wanted current_storage = [] # required matplotlib plt.close() plt.ion() #required method call in order interactive plotting work # specify graph fig1 = plt.figure() ax = fig1.add_subplot(1,1,1) # creates axis in order have multiple lines plt.title('voltage trim vs current \nsome fancy sub-title here') plt.xlabel('voltage trim / v') plt.ylabel('current measured/ a') plt.grid(true) color_choices = ['k', 'g','r',...

android native app testing-appium with saucelabs -

i have created script using selenium (java) testing android native app appium. issue:- unable run script on saucelab emulator. steps:- 1. created free account in saucelabs , uploaded .apk file in temporary storage of saucelabs using command:- curl –u rajeevkumar:d5fd1f02-1b3e-457c-bb82-fc47b7dfc01d –x post –h "content-type: application/octet-stream" https://saucelabs.com/rest/v1/storage/rajeevkumar/xyz.apk?overwrite=true --data-binary @xyz.apk .apk file uploaded on saucelabs. i copy paste desired capabilities saucelab code (on emulator want run). when run code app gets installed on saucelabs emulator (i can check in saucelab dashboard page unnamed job) throws exception while finding elements. do need add more stuff saucelabs script? running app on saucelabs.

openerp - How to change timezone when printing time in qweb report? -

<b>date:</b><span t-esc="time.strftime('%d-%m-%y %h:%m:%s')"/> this attempted code.i want print current date , time in report page.i live in india , our timezone 5.30 hrs ahead of gmt.i changed timezone in odoo user settings.but still printing time in gmt , not in ist(gmt+5.30) checkout module https://apps.openerp.com/apps/modules/8.0/qweb_usertime/ adds tag specify time of report based on usertime, internally uses pytz module so can roll implementation if don't want install it, how you'll use in case <b>date:</b><span t-usertime="%y-%m-%d %h:%m:%s" />

android - unable to set vector drawable on KITKAT -

i using vector drawable,it causes exception on api 19 android.content.res.resources$notfoundexception: resource id in gradle have added vectordrawables.usesupportlibrary = true in defaultconfig . this code doesn't work version: imageview imageview = (imageview) view.findviewbyid(com.yarolegovich.lovelydialog.r.id.ld_icon); imageview.setimageresource(r.drawable.ic_my_location_black_24dp); make sure u have gradle version 2.0 or above if not add along current gradle configs build.gradle android { defaultconfig { generateddensities = [] } // handled 2.0+ gradle plugin aaptoptions { additionalparameters "--no-version-vectors" } } and use app:srccompat="@drawable/ic_add" in imageview

Javascript and function complexity -

i wondering complexity (in big o notation) of functions of prototypes (in best , worst case) in javascript ? can't find document listing these informations concerning : object.assign edit : previous cases covered in (except object.assign) what performance of objects/arrays in javascript? (specifically google v8) can me ? thanks help since object.assign looping array once , assigning value object, think it's safe complexity o(n). check out polyfill version here: https://developer.mozilla.org/en/docs/web/javascript/reference/global_objects/object/assign it show nested loop, since 1 of loops linked length of argument passed, notation still o(x*n) => o(n)

rust - What is the difference between using a type as a different name and a type alias? -

what difference between use hyper::status::statuscode error; and type error = hyper::status::statuscode; are more differences between them except type can pub type ? benefits between using 1 or another? in case of simple types, in example, there doesn't seem semantic difference. moreover, there direct analogue use pub type , it's pub use : // available other modules pub use hyper::status::statuscode error; however, there differences in more complex cases. example, can define generic type aliases or aliases specialized generic types: type result<t> = ::std::result::result<t, myerror>; type optioni32 = option<i32>; the general idea use type aliases because more powerful , suggest intent more clearly, result , , use use .. .. when want import specific name conflicts in current namespace: use std::io::read stdread; trait read: stdread { ... } note using path-qualified identifiers should preferred use renaming. above better wr...

Remove a parent activity link, Android -

i removed parent activity setting in android manifest of app, when run app on android device, in action bar still shown simbol on right (even if doesn't work if touch on it). how can remove that? here manifest's section activity: <activity android:name=".activities.allsitesactivity" android:label="@string/app_name" android:theme="@style/apptheme"> <intent-filter> <action android:name="android.intent.action.main" /> <category android:name="android.intent.category.launcher" /> </intent-filter> <intent-filter> <action android:name="android.intent.action.send" /> <category android:name="android.intent.category.default" /> <data android:mimetype="text/plain" /> </intent-filter> </activity> and here menu of acti...

Creating a bent line like an arc in Android using xml in drawable -

what did .. <item> <rotate android:fromdegrees="40" android:todegrees="20" android:pivotx="25%" android:pivoty="50%" > <shape android:shape="line" android:top="1dip" > <stroke android:width="1dip" android:color="#ff0000" /> </shape> </rotate> </item> it rotates doesn't bend. needs bent form arc shape any idea? you can draw ring shape, rotate based on preference , use progressbar progressdrawable set progress. drawable.xml <?xml version="1.0" encoding="utf-8"?> <rotate xmlns:android="http://schemas.android.com/apk/res/android" android:fromdegrees="150" android:todegrees="150"> <shape android:shape="ring" and...

csvhelper - C# CSVWriter how to avoid getting empty line at the end of writing all lines to a file -

i using csvwriter write csv using following link: how create csv header , footer using linqtocsv or better in c# but reason getting empty line created @ end. can me doing wrong or how can avoid getting empty line? here code create csv using csvwriter: using (var writer = file.appendtext(outputcsv)) { var csv = new csvwriter(writer); csv.configuration.registerclassmap<custommap>(); csv.configuration.hasheaderrecord = true; csv.configuration.quotenofields = true; csv.configuration.delimiter = "|"; csv.writerecords(asrunlogs.tolist()); csv.writerecord(new csvfooterrecord() { footertext = $"trailer:{"qsaam_promos.csv"}|{datetime.now.tostring("ddmmyyhhmm")}|{asrunlogs.count}" }); } when open file in notepad++, can see empty line @ end. appreciate regard this. th...

paypal - IPN Notification Verfication INVALID -

i keep getting invalid response paypal when sending data verify it's come them. i've read lots of other posts on nothing helping far. can verify: the order of params same. the data same exception of me prepending cmd=_notify-validate& request. this quick hacky code post data up: using (webclient client = new webclient()) { var nvc = new namevaluecollection { {"cmd", "_notify-validate"} }; foreach (var f in formcollectiondata.allkeys) nvc.add(f, formcollectiondata[f]); try { servicepointmanager.securityprotocol = securityprotocoltype.tls | securityprotocoltype.tls11 | securityprotocoltype.tls12; client.headers[httprequestheader.contenttype] = "application/x-www-form-urlencoded"; var response = client.uploadvalues(_urls[paypalresponse.test_ipn], "post", nvc); var result = system.text.encoding.utf8.getstring(response); //returns "invalid" } catch (e...

java - how can i display an object's string method using javafx? -

the main method in calculate extends enemytype class. switch statement has 9 cases nested in while loop each instantiating subclass constructs enemytype. (should uml diagram or something?) void calc() method displays result in system output, ending switch statement, returning loop in calculate main() method. this class attempts use javafx.scene.control.combobox; fire nested switch statement. think issue somewhere between descriptionpane, or setall() void method in subclasses. contents of subclass setall() void method display in descriptonpane, or label or something. prints console. @override public void start(stage primarystage) { descriptionpane d = new descriptionpane(); label lbl = new label(); combobox<string> cbotypes = new combobox<>(); observablelist<string> items = fxcollections.observablearraylist ("light grineer", "medium grineer", "heavy grineer", "light corpus", "med...

sql - C# OleDB Update statement not updating -

i'm trying update access database through c# web application i'm facing problem in statement not updating records , not returning errors. i'm trying update text field , condition in statement integer. oledbcommand cmd = new oledbcommand("update data set title = @title id = @id"); cmd.commandtype = commandtype.text; cmd.connection = conn; cmd.parameters.addwithvalue("@title", textbox1.text); cmd.parameters.addwithvalue("@id", param2); i tried doing way oledbcommand cmd = new oledbcommand("update data set title = ? id = ?"); cmd.commandtype = commandtype.text; cmd.connection = conn; cmd.parameters.addwithvalue("?", textbox1.text); cmd.parameters.addwithvalue("?", param2); but it's still not updating! found out trying fix when replace first parameter string between single quotes (see below), updates table. oledbcomm...

php - Auto text woocommerce_short_description hook -

i trying create automatic text in description of woocommerce articles , put "article available in store." i thought putting inside function this: add_filter ('woocommerce_short_description', 'in_single_product', 10, 2); function in_single_product () { echo '<p> my-text-here </ p>'; } but text not appear in front-end. appears if put text on back-end. does know why happens? the correct syntax writing add_filter // define my_editor_content function my_editor_content( $post_excerpt ) { // make filter magic happen here... return $post_excerpt; }; // add filter add_filter( 'woocommerce_short_description','my_editor_content',10, 1 ); well, use code in functions.php of child theme. function my_editor_content( $post_excerpt ) { $content = 'the default text, imposed me, needs here in every product.'; return $content.'<br>'.$post_excerpt; } add_filter('woocommerc...

java - Dailymotion upload error "no content" -

i'm developping web application capable of upload video on dailymotion find during 1 years , have seen error occuring when upload video on dailymotion. { "error": "missing content" "seal": "540f4ad5a0f9c6a7e85a46be98361581" } i use java , lib "org.apache.http" doing call on dailymotion. my code : path temp = files.createtempfile(multipartfile.getname(), "." + suffix); multipartfile.transferto(temp.tofile()); multipartentitybuilder builder = multipartentitybuilder.create(); builder.setmode(httpmultipartmode.browser_compatible); builder.addpart(multipartfile.getoriginalfilename(), new filebody(temp.tofile(), contenttype.application_octet_stream, multipartfile.getoriginalfilename())); httppost.setentity(builder.build()); try (closeablehttpclient httpclient = httpclients.createdefault(); closeablehttpres...

powershell - Script for Azure Backup notifications -

i's basic one, new powershell. trying statement below working. $date = (get-date).adddays(-1) $currentdate = get-date -format d $check = get-winevent -filterhashtable @{logname="cloudbackup";starttime=$date;id=3} *>$null if ($check -eq $true) { write-host "`nok: azure backup successful on $currentdate" exit 0 } else { write-host "`ncritical: problem azure backup - $currentdate" exit 2 } specially if ($check -eq $true) doesn't seem expected. $check checking event id 3 in eventlog, if it's there should return true, if not false. unfortunately it's returning false every time. could please advise? there better way that? $check = get-winevent ... *>$null your redirection suppressing all output, $check always has value $null , interpreted $false in boolean operation. what want use automatic variable $? check if last powershell operation successful. if ($?) { write-host "ok: azure backup su...

c++, boost, store objects in multidimensional array without default constructor -

i want store thousands of interpolation functions in multidimensional array, preferable 1 boost. main problem interpolation function use class not have default constructor. prohibits me initialize multidimensional array. what wish do: double func(const double& x1, const double& x2, const double& x3) { return x1 + x2 + x3; }; int main() { std::vector<double> x1 {0, 1, 2, 3}; std::vector<double> x2 {1.1, 1.2, 1.3, 1.4, 1.5}; std::vector<double> x3 {0, 10, 20, 30, 40}; std::vector<double> y(20, std::vector<double>(5)); boost::multi_array<linear_interp, 2> storage(boost::extents[4][5]); typedef std::vector<double>::size_type vd_sz; int n = 0; (vd_sz i_x1 = 0; i_x1 < x1.size(); ++i_x1) { (vd_sz i_x2 = 0; i_x2 < x2.size(); ++i_x2) { for( vd_sz i_x3 = 0; i_x3 < x3.size(); ++i_x3) { y[n][i_x3] = func(x1[i_x1], x2[i_x2], x3[i_x3]); } linear_interp myinterp(x3, y); stor...

scala - Creating a type class instance for a sealed trait -

say have 'wide' sealed class hierarchy: sealed trait alphabet case class a(word: string) extends alphabet ... case class z(word: string) extends alphabet and have type class instance defined each child class in hierarchy: trait swearwordfinder[t <: alphabet] { def isswearword(x: t): boolean } val swearwordfindera = new swearwordfinder[a] { ... } ... val swearwordfinderz = new swearwordfinder[z] { ... } is there way can define type class instance alphabet trait without having implement pattern matching (as below)? def isswearword(x: alphabet): boolean = x match { case a: => swearwordfindera.isswearword(a) ... case z: z => swearwordfinderz.isswearword(z) } you can represent alphabet shapeless coproduct of a :+: b :+: ... :+: z :+: cnil , if have swearwordfinder instances a , b , ... , define instances cnil , :+: can swearwordfinder[alphabet] using generic representation. import shapeless._ trait swearwordfinder[t] { def isswear...

hibernate - Build failure using maven, servlet, jsp and java -

i error shown below, me trace problem. working on maven project using jsp, servelt wildfly , hibernate. project in initial development. 13:13:15,694 error [org.jboss.msc.service.fail] (msc service thread 1-6) msc000001: failed start service jboss.deployment.unit."kinagroup.war".install: org.jboss.msc.service.startexception in service jboss.deployment.unit."kinagroup.war".install: wflysrv0153: failed process phase install of deployment "kinagroup.war" @ org.jboss.as.server.deployment.deploymentunitphaseservice.start(deploymentunitphaseservice.java:163) @ org.jboss.msc.service.servicecontrollerimpl$starttask.startservice(servicecontrollerimpl.java:1948) @ org.jboss.msc.service.servicecontrollerimpl$starttask.run(servicecontrollerimpl.java:1881) @ java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1142) @ java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:617) ...

java - Single root directed acyclic graph cycle detection -

Image
the graph has 1 root. , saved in following format: 0 -> 1, 0 -> 2, 1 -> 3, 1 -> 4, 2 -> 4, 2 -> 5, 4 -> 5, 5 -> 2 (this cycle) what efficient way detect if there exists @ least 1 cycle in graph using java? thanks! as mentioned in comments sort of dfs like set iscyclic false dfs(node) if iscyclic true return each neighbor in node.neighbors if node.visited true set iscyclic true return set neighbor.visited true dfs(neighbor)

java - how do I control where gradle/gradlew files and folders are located -

in new project - in using gradle/gradlew - want set location of various gradle/gradlew files , folders different default behaviour. i talking about: folder gradle, sub folder wrapper (holding gradle-wrapper.jar , gradle-wrapper.properties folder build, sub folders 'classes', 'dependency-cache', 'libs', 'resources' having kinds of xml files individual components, , 'tmp' having sub folders 'compilejava' , 'jar'. but how , configure this? you can change location of wrapper , properties file setting task of type wrapper . example: task wrapper(type: wrapper) { jarfile = file('mywrapper/wrapper.jar') } running gradle wrapper generate following files: . ├── build.gradle ├── gradlew ├── gradlew.bat └── mywrapper ├── wrapper.jar └── wrapper.properties the default build output directory can changed via method project.setbuilddir(object) . example: builddir = file('target') ...

CSS animation for moving div to top and then to center -

i trying make css animation (i can't use javascript) these steps: have div of can't know in advance position or size (in fiddle have set size testing) the div gets resized (width 100% height 50 pixels) , moves top of page while content disappears the div turns circle , moves center of page this have attempted far: https://jsfiddle.net/v3bt1mar/5/ .turning { width: 80%; height: 120px; background-color: #00ff00; } .turning:active { background: red; animation: 10.5s; display: block !important; position: fixed; content: ""; overflow: hidden; animation: resizelist 10.5s forwards; } .turning:active * { animation: fadecontent 1s forwards; } @keyframes fadecontent { 0% { opacity: 1; } 50% { opacity: 0; } 100% { opacity: 0; } } @keyframes resizelist { 25% { width: 100%; height: 50px; top: 10px; left: 0%; // transform: translate(0%, 0%) rotatey(0deg); border-radius: 0%; } 1...

Can AWS Lambda be used in conjunction with services in other regions? -

i'm interested in using lambda few projects i"m working on, it's not available in asia pacific/singapore region we're hosting our stuff in. would possible set in, example, us-west region (oregon) , interact infrastructure in other regions such sns , and couple of sqs queues? you can use api gateway create endpoint lambda function , call region (or outside aws). or, according answer ( aws lambda & sns: invoke lambda cross-region ) can create sns topic in region , subscribe lambda function , should work.

c - unexpected results on simple string reverse algorithm -

i'm relatively new c. wanted lern language bit solving coderbyte challenges . but i'm stucked @ first. supposed simple string reverse algorithm. when input things "asdf" or "1234567" output correct ("fdsa", "7654321"). when type "12345678" or "thisiscool" "87654321▒@"/"loocsisiht@" result. don't know @ comming from. this code: #include <stdio.h> #include <string.h> void firstreverse(char str[]) { int len = strlen(str); char nstr[len]; int i; for(i = 0; < len; i++) { nstr[i] = *(str+len-1-i); } printf("%s\n", nstr); } int main(void) { char str[100]; firstreverse(gets(str)); return 0; } can please tell me can find error? in advance :) as other answers have mentioned, you're missing terminator. should noted it's bad practice allocate strings way did. array should have fixed size if create way. you should inste...

html - How to get a warning that a class name is not recognized? -

today wrote code: <div class="container"> <form class="form-inline" role="form"> <div class="form-group"> <label for="first">first</label> <input class="form-control" id="first" ng-model="???" ng-readonly="true" /> </div> <div class="form-group"> <label for="second">second</label> <input class="form-control" id="second" ng-model="???" ng-readonly="true" /> </div> <div class="form-group"> <label for="third">third</label> <input class="form-control" id="third" ng-model="???" ng-readonly="true" /> </div> <div class="form-group"> <label for="fourth">fourth</label> ...

c++11 - How to pass fields from a class to function in c++? -

in words: how can pass various fields custom class single function? now in details: have std::vector containing class, example customclass have extract result field class criteria fields in class , combine somehow data. my first approach problem use function accepts parameter std::vector of class in order extract data , return std:map . key in map type of criteria data should combined , value int combined data members of vector. the problem criteria not 1 - more 1 field class may used criteria (let easiness of criteria std::string , if not - make function templated). the easiest way me make dozens of functions identical code , each of them extract simple concrete field class. changes might require similar changes of dozens of functions maintenance headache. in stage cannot think how pass single function field class... here's example code class: // class data , criteria class customclass { public: std::string criteria1; std::string criteria2; std::str...

android implicit intent edit failed to load image -

this implicit intent invoke image editing apps on device: startactivity(new intent(intent.action_edit).setdataandtype(myuri, getmimetype(myuri)).setflags(intent.flag_grant_read_uri_permission | intent.flag_grant_write_uri_permission)); and how getmimetype: public string getmimetype(uri uri) { string mimetype = null; if (uri.getscheme().equals(contentresolver.scheme_content)) { contentresolver cr = getcontentresolver(); mimetype = cr.gettype(uri); } else { string fileextension = mimetypemap.getfileextensionfromurl(uri .tostring()); mimetype = mimetypemap.getsingleton().getmimetypefromextension( fileextension.tolowercase()); } return mimetype; } for apps crashes load: on app sketch_camera invisible page loads , disables interaction app. on app airbrush loads app crashes message "failed load image". is related minimum sdk version mine 16? i've tested on minimum ...

Appcelerator controller appear/disapear methods -

i'm pretty new appcelerator , wondering listeners view life cycle are? for example, if wanted detect ios viewwillappear , viewdiddisappear methods, or androids onresume, onpause methods, how "appcelerator" way? i've searched around on web, able find in titanium documentation info application state such active, suspended, ect. need controller, or window, specific listener react to. thanks! titanium abstracts events - don't have worry writing them ios/android each. check out titanium.app documentation ( http://docs.appcelerator.com/platform/latest/#!/api/titanium.app ). can see events available @ app level (of course, each titanium components has it's own events - @ app level). if understand question, relevant events paused , resumed - when app goes in background , foreground.

excel vba - Referencing specific visible cells after using the Autofilter in VBA -

i trying refer specific visible cells after using autofilter function. although autofilter appears working correctly, unable refer specific visible cells afterwards. code follows: cells.autofilter range("a1:zz100") .autofilter field:=j, criteria1:=i1, operator:=xlor, criteria2:=i2 end msgbox range(.cells(1, 2), .cells(100, 2)).specialcells(xlcelltypevisible).cells(2, 50) msgbox autofilter.range.specialcells(xlcelltypevisible).cells(2, 50) both msgbox give me hidden values. please assist

java - how put image view to right to row of listview -

Image
how can put image view right of row of list view ?(square image right of row) i hope can me! thanks in advance everybody!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! this xml: <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal" > <checkbox android:id="@+id/chk_box" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignparentleft="true" /> <linearlayout android:id="@+id/linearlayout1" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_marginleft="5dp"...

Dynamic value graph creation in yii2 using GoogleChart? -

Image
here wanna draw line chart graph dynamic value.but in case every value of array created different different graph...please me first time task.thanks in advances <?php $modelemployee=employee::find()->select(['id','sales','expenses'])->all(); $arr = array('id'=>array(), 'sales'=>array(), 'expenses'=>array()); for($i = 0, $modem = $modelemployee; $i < sizeof($modelemployee); $i++){ $arr['id'] = $modem[$i]['id']; $arr['sales'] = $modem[$i]['sales']; $arr['expenses'] = $modem[$i]['expenses']; print_r($arr); echo googlechart::widget(array('visualization' => 'linechart', 'data' => array( array('year', 'sales', 'expenses'), array($arr['id'],$arr['sales'],$arr['expenses']), ), 'options' ...

javascript - Sane approach to build and deploy typescript/node.js application -

i'm working on node.js app written in typescript, means needs compiled js before running. i'm coming java/jvm background ship prebuilt package server , gets run there i'm bit afraid of way of deployment push code git , it's being built/compiled on server first , run. i don't 2 main reasons: dev dependencies need installed on server deployment depends on external resources availability (npm etc). i found nar https://github.com/h2non/nar more or less wanted has drawbacks (doesn't work deps have native extensions). my question is: there other "sane" way of doing deployment node.js deployment risky combination of npm install , tsc on server? or should let sink in , way? to honest don't believe there no more sane/reliable options that. what can (but there other valid approaches) building project locally (or on ci service), , deploy built version when consider valid (tests, etc.). this way, if bad happens, npm fails, or co...

php - How to change the content of wordpress lostpassword mail? -

how edit content of wordpress lostpassword mail myself. please tell me file should change or how this? thank much. here content now: 有人申请了修改密码: 站点:www. .com 用户名: 点击http:www.***.com/wp-login.php?action=rp&key=5mab8ojzkvy7yp6kgmw9&login=*** you might wanna @ link: https://wordpress.stackexchange.com/questions/103299/customizing-lost-password-email

iphone - How to validate iOS app source code before uploading to app store? -

Image
i have app developed in ios.i have developed app client.i send him code & prepares ipa & upload app store can't uplaod app app store.now when client uplaod app gets error while uploading app such missing icon,missing launch screen file size etc.now want validate code @ end can sure there no errors when uploading app binary app store there way can validate thing? thanks you need create archive. you can validate build.

node.js - How to copy existing local database to Heroku? -

i've deployed node.js app heroku. next goal copy local mongo database can have initial data. how can accomplish that? i've went through heroku docs , there nothing mentions that. on heroku using mlab mongodb add-on. to restore mongodb mlab, need use mongo restore command issued on local dev system mongorestore -h host.mlab.com:13024 -d databasename -u <user> -p <password> <input db directory>

Scala sealed trait as key on map throws mismatch error -

would me understand why not work? scala version 2.10 object colorenum { sealed trait color case object red extends color case object blue extends color case object green extends color } create map accepts color key , string value val colormap = mutable.hashmap[colorenum.color, string]() put item on map using colorenum key colormap.put(colorenum.red, "foo") this throws exception error: type mismatch found: colorenum.red.type required: colorenum.color i must missing understanding of how should work. thanks summary: of scala 2.11 (and preceding versions of scala 2.8) map 's key type a in map[a, +b] . , map doesn't allow covariance when specifying key; i.e. notice how doesn't have plus (+) sign preceding it. here's specific stackoverflow answer addresses details: https://stackoverflow.com/a/678637/501113 details: trait, color , type defining map . , define 3 descendants of color trait. then, attempting insert these ...

c# - Custom WPF MessageBox text is empty -

Image
i have custom wpf messagebox , upon specific message caption appearing in random location of parent window. custom messagebox looks this: public static class wpfmessagebox { public static messageboxresult show(string messageboxtext) { return showcore(null, messageboxtext); } public static messageboxresult show(string messageboxtext, string caption) { return showcore(null, messageboxtext, caption); } public static messageboxresult show(window owner, string messageboxtext) { return showcore(owner, messageboxtext); } public static messageboxresult show(string messageboxtext, string caption, messageboxbutton button) { return showcore(null, messageboxtext, caption, button); } public static messageboxresult show(window owner, string messageboxtext, string caption) { return showcore(owner, messageboxtext, caption); } public static messageboxresult show(string messageboxtext, str...

html - CSS - Positioning one element around another. To float around each other -

Image
i'm building events site , working on index page styling. plan have site logo , sign-in / create event link sat central @ top of page , each event represented box shape image date/title sat on top of link through more event details. i've pretty got done except can't image links float/position around logo. i've attached screenshot below illustrate how looks. want event images filter along side of logo rather how looks blank space on either side of logo. here's code - index.html.erb <div class="category"> <ul> <li> <a href="#">categories</a> <ul> <% category.all.each |category| %> <li><a href="#"><%= link_to category.name, events_path(category: category.name) %></a></li> <% end %> ...

c# - Iterate over Database table row and store values in a Dictionary? -

Image
i want implement dictionary cache in program. how can store database result seen in image below in dictionary collection ? i want iterate on database table , store content of languagename , isocode columns in dictionary dictionary<languagename,isocode> . my database (ctlang) looks this: here code: private string getlanguageforisocode(string isocode) { //check isocode column , return corresponding language using (var unitofwork = dataaccessunitofworkfactory.create()) { //need call every time sql query string query = "select languagename ctlang isocode='" + isocode + "'"; list<string> result = unitofwork.owentities.database.sqlquery<string>(query).tolist(); if (result.firstordefault() != null) { return result.firstordefault(); } //if language not available in database, fallback german default langu...