Posts

Showing posts from August, 2015

css - Display two UL elements side by side, centered vertically and horizontally -

i've been struggling while , couldn't find right solution. at bottom of page i've footer that's full width. inside want display list of messages , right next left icon, in case it's font awesome icon. message list needs centered both vertically , horizontally , icon has centered vertically. i've tried doing using ul elements display: inline-block , text-align: center. messages displays correctly icon stuck in same place no matter size of container. here's i've far: <div class="error-message-container"> <ul class="error-message-bell"> <li aria-hidden="true" class="fa fa-bell-slash-o"></li> </ul> <ul class="error-message-list"> <li>lorem ipsum dolor sit amet, consectetur adipiscing elit</li> <li>consectetur adipiscing elit</li> <li>lorem ipsum dolor sit amet</li> <li>lorem ipsum dolor sit ame

mysql - How can I write a trigger that can copy new row from a table on insertion to another table? -

i have 2 tables, creds , users. users email password fullname contact city creds email password i need trigger can copy email , password users creds upon insertion of new rows. hope following trigger works you. more or less this create trigger user_trigger on creds insert begin insert users(email, password, fullname, contact, city) select distinct u.email, u.password inserteduser u left join creds c on u.email = c.email , u.password = c.password end;

java - I can not figure out why my GridBagLayout is not following the rules -

Image
i've been working on making styling work, can not figure out why gridbagconstraints supposed exist doesn't work. works degree, won't work... specific code here: private void initcomponents() { usernamelabel = new jlabel(); schedule = new courselist(); addcoursebutton = new jbutton(); deletecoursebutton = new jbutton(); printschedulebutton = new jbutton(); feesbutton = new jbutton(); helplink = new swinglink("help", "http://java.sun.com"); logoutbutton = new jbutton(); string u = getusername(); gridbaglayout gridbag = new gridbaglayout(); gridbagconstraints gbc; //set layout this.setlayout(gridbag); //row 1 usernamelabel.settext("welcome " + u); gbc = new gridbagconstraints(); gbc.gridheight = 1; gbc.gridwidth = 6; gbc.gridx = 0; gbc.gridy = 0; gbc.insets = new insets(20,10,10,10); //top, left, bottom, right gbc.anchor = gbc.line_end; gbc.fill

multithreading - need suggestions for java code editor using swing -

i planning program java code editor using swing , main feature highlighting code segments keywords , strings , variables . need suggestions on how should implement program, 1 of friend told use 2 separate threads, 1 editing , 1 highlighting code, how establish communication between 2 threads ? if don't use separate threads, have impact on program ? i'm confused. please me, suggestions . edit: 1 more question should use jeditorpane or jtextpane purpose ? from docs swing object methods not "thread safe": invoking them multiple threads risks thread interference or memory consistency errors. http://docs.oracle.com/javase/tutorial/uiswing/concurrency/dispatch.html

scala.swing: Trying to scale images to window size, but size returns 0 -

it should go without saying, i'm new swing. i'm trying make simple little thing display 2 images side side, large window allow. in theory happening is: we imageicon, in case 001.jpg. we figure out ratio of width/height of imageicon. we turn imageicon image. we turn image new correctly sized image. we turn image image icon. this breaks down because way i've found window size size , keeps returning 0s. this code have right now: class ui extends mainframe { title = "matt's window header" preferredsize = new dimension(1920, 1080) var imageicon = new imageicon("001.jpg") val imgratio = imageicon.geticonwidth.todouble / imageicon.geticonheight.todouble println(size) pack() println(imgratio) val image = imageicon.getimage() val newimg = image.getscaledinstance(size.width, (size.width * imgratio.toint), java.awt.image.scale_smooth) imageicon = new imageicon(newimg) contents = new label {

javascript - Why would I get different results from a function due to the position of number 1 in an array? -

i have few problems stopping me proceeding on blackjack 21 game. first when open site in browser acecard function invoked supposed called if deal 1 (an ace card). below have written problems noticed acecard function. when number 1 in userarray need call acecard(); in console. or @ least haven't got call automatically. 1.when number 1 in position 0 in array javascript don't recognize 1. 2.when number 1 in position 1 in array acecard function work , change value 1 11 3.when number 1 in position 2 in array see's value 1 in array, won't change value 1 11. if array position 0 = 1 won't see position 2 in array. any great, have no idea why works differently depending number 1 positioned in userarray. var userarray = []; var computerarray = []; var = userarray.indexof(1); function random_number() { var randnum = math.floor(math.random() * 10 + 1); return randnum; } document.getelementbyid('dealbutton').onclick = function() { use

c++ - Storing EAX register in a variable -

i working on bonus assignment class in have rip out keygen executable , use __asm directive in c++ straight insert assembly code (with little editing). the result follows: int main(int argc, char** argv) { char username[] = "username"; int sernum; __asm { lea edx, [username]; //put user name in edx lea eax, dword ptr[edx]; //put user name in eax lea ebx, dword ptr[username + 1]; // put "sername" in ebx mov ecx, 0x00000000; // random initializing mov ebp, 0x00000000; mov esi, 0x00000000; mov edi, 0x00000000; count_loop:; mov cl, byte ptr ds : [eax]; // code length of user name inc eax; test cl, cl; jnz short count_loop; sub eax, ebx; mov ebx, eax; sar ebx, 1; movsx ebp, byte ptr ds : [ebx + edx]; imul ebp, ebp, 0x3e8; xor eax, eax; cmp ebx, 2; jl s

i need help in php sending form to send multiple rows -

i have api of sms <?php // configuration variables $type = "xml"; $id = "92300xxxxxxx"; $pass = "xxxxxxxxxxxx"; $lang = "english"; $mask = "outreach"; // data text message $to = "$_post['to']"; $message = "$_post['message']"; // prepare data post request $data = "id=".$id."&pass=".$pass."&msg=".$message."&to=".$to."&lang=".$lang."&mask=".$mask."&type=".$type; // send post request curl $ch = curl_init('http://www.outreach.pk/api/sendsms.php/sendsms/url'); curl_setopt($ch, curlopt_post, true); curl_setopt($ch, curlopt_postfields, $data); curl_setopt($ch, curlopt_returntransfer, true); $result = curl_exec($ch); //this result outreach curl_close($ch); ?> now make form <form method="post"> <input type="text" name="message"> <input

Facebook login progressbar on android -

Image
i implement facebook login on android app, login progressbar old style progress bar,i want make material style progress bar, called facebooksdk.setwebdialogtheme(r.style.mydialogstyle); after this, progress bar updated material style, there black background behind progress bar, how can hide background or make white color? on right way or can me?

jquery - Printing css background-image using JS -

can kindly give me hand. need second pair of eyes. im trying print css using js. this.$el.find(".button").css({ 'border': 'none', 'box-shadow': box_shadow, 'background-color': params.button_bg_color, 'background-image': 'linear-gradient(to bottom, ' + params.button_bg_color + ', ' + params.button_hvr_color + ')', 'background-image': '-webkit-gradient(linear, left top, left bottom, from(' + params.button_bg_color + '), to(' + params.button_hvr_color + '))', 'background-image': '-webkit-linear-gradient(top, ' + params.button_bg_color + ', ' + params.button_hvr_color + ')', 'background-image': '-moz-linear-gradient(top, ' + params.button_bg_color + ', ' + params.button_hvr_color + ')', 'background-image': '-webkit-linear-gradient(top, ' + params.button_bg_color + ', ' + params

html - Content expands container -

i have 3 columns page-proofs on div display table. first here jsfiddle https://jsfiddle.net/9mzuxza9/2/ inside left side placed table many rows example , result of when content inside col become higher container , container spreads height want container keep in same height screen no content. css html,body{ width: 100%; height: 100%; } .row{ table-layout: fixed; display: table; height: 100%; width: 100%; border: 1px solid grey; } .left { width:300px; height:100%; display: table-cell; } .middle { height:100%; display: table-cell; width:100%; } .right { height:100%; width:300px; display: table-cell; } html <div class="row"> <div class="left"> content <table border=&qu

Objective-c creation of PublicKey -

will (anyone) please let me know how create publickey using modulus , exponent(only 2 values whatever have). in java simple. rsapublickeyspec spec = new rsapublickeyspec(modulus, publicexponent); keyfactory factory = keyfactory.getinstance("rsa"); publickey pub = factory.generatepublic(spec); i want know how done in objective-c. i managed achieve same using ideawu rsa libraies , had issues encoding of public key libraries assume need footer , headers in key (i.e. begin public key , end public key) , don't url encode result required, modified 1 of methods , worked, perfectly: + (nsstring *)encryptstring:(nsstring *)str publickey:(nsstring *)pubkey{ nsdata *decodeddata = [[nsdata alloc] initwithbase64encodedstring:pubkey options:0]; nsstring *decodedkey = [[nsstring alloc] initwithdata:decodeddata encoding:nsutf8stringencoding]; decodedkey = [decodedkey stringbyr

libgdx - Java does not cast over to TextureRegion -

i trying draw multiple animations using hashmaps switch between them. part of code using. batch.draw((textureregion)hashmap.get(whichhashmap).get(c),x,y); when run code error @ line. error follows. error:(162, 54) java: incompatible types: java.util.arraylist cannot converted com.badlogic.gdx.graphics.g2d.textureregion edit: here decloration hash maps: arraylist<arraylist> whichhashmap; arraylist<textureregion> animation1; arraylist<textureregion> animation2; animation1 = new arraylist<textureregion>(); animation2 = new arraylist<textureregion>(); whichhashmap.add(animation1); whichhashmap.add(animation2); region = new textureregion(powerpuff,1,55,41,44); animation1.add(region); region = new textureregion(powerpuff,47,54,41,45); animation1.add(region); region = new textureregion(powerpuff,1,55,41,44); animation2.add(region); region = new textureregion(powerpuff,47,54,41,45

Android Programming error in json convertion -

http://codeoncloud.blogspot.in/2013/07/android-mysql-php-json-tutorial.html used above link. same coding error error parsing data org.json.jsonexception: value you getting exception(jsonexception) because php service not return valid json , said in comment seems php service returning html snippet <br> instead of proper json string.

sstable2json in cassandra 3.5, -

in 2.x versions of cassandra can view sstable content bin/sstable2json sstable.db proper way of checking sstable data in new version.3.x(currently 3.5). check out sstabledump . has replaced sstable2json in cassandra 3.x. http://www.datastax.com/dev/blog/debugging-sstables-in-3-0-with-sstabledump

ios - 'NSInvalidArgumentException', reason: '-[__NSCFString encodeString:]: unrecognized selector sent to instance -

i making encoding nsstring value entered in textfield in ios app. this code nsstring *encodedstrr = [mytextfeild.text encodestring:nsutf8stringencoding]; nsstring *encodedurlstrr = [nsstring stringwithformat: @"http://www.damain.com:8080/app/f/query?from=%@", encodedstrr]; nsurl *urlr11 = [nsurl urlwithstring: encodedurlstrr]; i getting following error, 2016-04-19 11:45:46.186 factualnote[3137:11303] -[__nscfstring encodestring:]: unrecognized selector sent instance 0x71c5100 2016-04-19 11:45:46.187 factualnote[3137:11303] *** terminating app due uncaught exception 'nsinvalidargumentexception', reason: '- [__nscfstring encodestring:]: unrecognized selector sent instance 0x71c5100' *** first throw call stack: (0x1c93012 0x10d0e7e 0x1d1e4bd 0x1c82bbc 0x1c8294e 0x30ff 0x10e4705 0x182c0 0x18258 0xd9021 0xd957f 0xd86e8 0x47cef 0x47f02 0x25d4a 0x17698 0x1beedf9 0x1beead0 0x1c08b

asp.net mvc - how to set Enum in DropDownListFor and keep selectet item when back to this page in mvc? -

when use code in firstpage , go other page , , come page passing model first page, selected value in dropdownlist not found @html.dropdownlistfor(model => model.supplementary.bloodgroup, enumhelper.getselectlist(typeof(azarweb.domain.hrm.providingstaff.core.enumeration.bloodgroupenum)), "please select 1 item", new { @class = "form-control" }) how set selectet value in dropdownlistfor when come page? there 2 ways, depending on doing. if calling server controller, , on return want "remember" dropdownlist selected value, you'll need pass view in model. the best option create dropdownlist control through selectlist object passed in model. 1 of parameters of selectlist constructor selected value. https://msdn.microsoft.com/es-es/library/system.web.mvc.selectlist(v=vs.118).aspx the other way around not having remember because don't reload whole page. depending how managing webpage browsing, when send info server can use ajax c

angularjs - How to use select statement with where condition on node.js -

Image
> trying provide login credentials email , password using postgres database table. postgres database tables. when records should send 200 status page.am getting error on query. kindly me out how use select condition. missing syntax. getuser : function(req, res) { var pg = require('pg'); var constring = process.env.database_url || "postgres://test:test@localhost:5432/wallet"; var client = new pg.client(constring); client.connect(); console.log(req.query.email_id); console.log(req.query.user_password); var query = client.query("select * pp_user_profile email_id ="+req.query.email_id+ "and" + "user_password=" +req.query.password); query.on("end", function (result) { client.end(); res.writehead(200, {'content-type': 'text/plain'}); res.write

c# - .HasRequired Unable to work in Model -

i've been searching around answer, , unable find suitable 1 works. have 2 models 1:* relationship start with: namespace test.models { public class blog { public int id { get; set; } public string title { get; set; } public string bloggername { get; set; } public virtual icollection<post> posts { get; set; } } } namespace test.models { public class post { public int id { get; set; } public string title { get; set; } public datetime datecreated { get; set; } public string content { get; set; } public int blogid { get; set; } public blog blog { get; set; } } } and applicationdbcontext is: namespace test.models { public class applicationdbcontext : identitydbcontext<applicationuser> { public dbset<post> post { get; set; } public dbset<blog> blog { get; set; } protected override void onmodelcreating(modelbuild

load owl file java code using jena api -

i have code in package oopn.ontology public class ontology { private static ontology ontology = new ontology(); public static ontmodel ontologymodel; //this main of ontology model public static file ontologyfile; //this file of owl public static string ontologyfilepath; //this path of owl file public static jtree ontologymodeltree; public static int saveaction; public static string copiedtext; public static jtree tree; private ontology() { } public static ontology getinstance() { return ontology; } public void resetontology() { ontologymodel = null; ontologyfile = null; ontologyfilepath = null; ontologymodeltree = null; } then code create ontology model: public ontmodel createontologymodelfromfile(string owlfile) { inputstream in; in = filemanager.get().open(owlfile); ontmodel model1 = modelfactory.createontologymodel(pelletreasonerfactory.the_spec); ontmodel model2 = modelfactory.createontologymodel(ontmodelspec.owl_mem); model1.read(in, "

Understand the Spring ecosystem and differences with JSF/Primefaces -

i know java jee , primefaces. i never read on spring or struts, want understand new project. spring framework used achieve loose coupling between modules , used dependency injection. i suggest first read spring dependency injection , inversion of control topics better understanding of framework. go through spring documentation more details of concepts.

ruby - Rails 4 - Route error for video_tag -

in rails 4.2.4, using paperclip gem video file uploads. after uploads video file, getting 1 route error while displaying it. no route matches [get] "/videos/user_1/3/sample.webm" actual file path /home/shruthi/projects/test/videos/user_1/3/sample.webm below lines added config/application.rb config.assets.enabled = true config.assets.paths << "#{rails.root}/videos" in model, has_attached_file :document, :path => "#{rails.root}/videos/:user_id/:event_id/:basename.:extension", :url => "/videos/:user_id/:event_id/:basename.:extension", :storage => :filesystem validates_attachment_presence :document validates_attachment :document, :content_type=>{:content_type=>/^(video\/(mp4|avi|mpeg|ogg|quicktime|webm|x-matroska|x-ms-wmv|x-flv|3gpp))/}, :size => { :less_than =>5.megabytes } validates :event, :presence=>true in views, <%= video_tag video.document.url, type: video.document_content_type %> ple

Can we configure both set and list types for different multimaps in hazelcast? -

i using multimap set in hazelcast there requirement use of multimap both list , set(two different multimaps same client).changing hazelcast.xml can either have set type multimap or list type multimap.is there way have both types? it's absolutely possible. include in hazelcast.xml <multimap name="set*"> <value-collection-type>set</value-collection-type> </multimap> <multimap name="list*"> <value-collection-type>list</value-collection-type> </multimap> all multimaps name starting prefix "set-" use set store elements , multimaps starting prefix "list" use list.

How to detect the events using NLP and Machine learning? -

i have text describing events such birth , new job , wedding , death etc .. or no event . how detect these events ? my approach form set of words , search them in text corresponding event . or use bayesian classifier . bayesian classifier requires training on classes , require method can classify without giving types of examples ? possible ? what performance requirements? low recall ok? need high precision? based on question, i'm guessing want reasonable recall (reading classified ads send out spam?) don't have training data. you want method can classify documents (using events named entity recognition algorithm features) without providing training data. supervised methods (including bayesian ones) require training data, asking/wishing not possible. need labelled data in case, otherwise how can tell how detection process working? at stage should not worried classifier use - suggest writing handful of regular expressions see how hard problem / performance ge

c# - Stung by using Linq deferred execution with async/await -

i new async/await , tinkering execute operation on list of objects using list of tasks. used linq generate both list of objects , list of tasks. example below looks little contrived, simplified version of actual code. i found when code executed shown, after tasks have completed (after await), none of object's properties have been updated, , of tasks still have status of running. i found eliminating linq deferred execution converting both objects , tasks actual lists via .tolist<>(), code worked expected (objects populated, tasks run completion). i familiar linq deferred execution i'm confused (isn't) going on in code. i'm making noob mistake async/await...what it? private class foo { public datetime { get; set; } } private void button_click( object sender, eventargs e ) { populatedates(); } private async void populatedates() { var ordinals = new list<int>() { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, }; var foos = ordinals.select( o =>

java - Edit row and validate -

i want edit row in datatable, have problem. have validator checks whether there social security number in database. when add ok. problem occurs when i'm editing. below code fragment edit page: <h:form> <div id="userpanel"> <p:panel id="paneluser" header="edytuj administratora" > <div id="panelimage"> <img src="./../../images/person4.png" alt="person" width="150px" height="130px"/> </div> <h:inputhidden value="#{usermb.user.id}" /> <h:panelgrid columns="3"> <p:outputlabel for="firstname" value="#{msg.firstname}"></p:outputlabel> <p:inputtext id="firstname" value="#{usermb.user.firstname}" label="#{msg.firstname}" required="true">

sql - Queries Ruby on Rails? -

how select in rails? select women.phone, users.name women, users (users.cellid = women.cell_id); model/user.rb class user < activerecord::base attr_accessible :cellid, :name belongs_to :woman end model/woman.rb class woman < activerecord::base attr_accessible :cell_id, :phone has_many :users end controller/index.rb def index @variables = user.all @phones = woman.all end your select statement implies user , woman linked fields cellid , cell_id, have specify in belongs_to , has_many directives: class user < activerecord::base attr_accessible :cellid, :name belongs_to :woman, foreign_key: :cellid, primary_key: :cell_id end class woman < activerecord::base attr_accessible :cell_id, :phone has_many :users, foreign_key: :cellid, primary_kay: :cell_id end while possible, it's better use rails conventions , use :id primary key , woman_id foreign key, if possible. then in controller can like: @users= user.all

Spring Security + Ldap authentication -

This summary is not available. Please click here to view the post.

php - Fatal error: Call to undefined method Model_...::function() on controller -Codeigniter -

i got message fatal error: call undefined method model_...::function() happened on 1 function so here's code controller : function paidgen(){ $reportcode=$this->input->get('paid'); $data = array( 'status' => 'proccess' ); $getcode= $this->model_expreport->changestat($data,$reportcode); $data['getcode2'] = $getcode; $this->loadpage($data); } function loadpage($data){ parent::header(); $this->load->view('reportlands',$data); parent::footer(); } view : <input name="paid[]" value="<?php echo $o->reportcode ?>" type="checkbox" class="checkpaid" /> <span class="cr"><i class="cr-icon glyphicon glyphicon-ok"></i></span> <form method="get" action="<?php echo site_url()? >cexpreport/paidgen" class="pull-right"> <input name="pa

jquery - Access data in model from JavaScript in view -

my knowledge of asp.net limited , new, please correct i've failed understand. i'm current generating collection of graphs using google charts, each time i'm querying database same set of data. i'd store somewhere or retrieve data once improve performance. i looked caching, every time script moved onto next chart, data no longer in cache. other idea data once, generate json strings charts, , store them in model. data going 'model.chart1 - model.chart2' etc. however, cannot seem access data javascript in view. able there html placing '@model.chart1' inside div container. the desired behaviour access data inside jquery function shown below. instead of calling method controller, directly access model field 'var chart1 = @model.chartone' <script type="text/javascript"> google.charts.load('current', { 'packages': ['corechart'] }); google.charts.setonloadcallback(drawchartone); google.ch

How do I document PHPUnit Tests Results? -

other use of --testdox documenting, there way can give more detailed report phpunit tests? maybe not direct answer question consider using bdd framework behat . tests written in plain human language express system behaviour , can read non-technical people. example introducing bdd article : story: account holder withdraws cash account holder want withdraw cash atm can money when bank closed scenario 1: account has sufficient funds given account balance \$100 , card valid , machine contains enough money when account holder requests \$20 atm should dispense \$20 , account balance should \$80 , card should returned scenario 2: account has insufficient funds given account balance \$10 , card valid , machine contains enough money when account holder requests \$20 atm should not dispense money , atm should there insufficient funds , account balance should \$20 , card should returned scenario 3: card has been disabled given card disabled when account holder requests \$20 a

C# Save from list -

hello have 1 class called animal.cs , in program.cs have created animals.. class program { static void main(string[] args) { var animallist = new animsllist(); animallist.add(new animal{ active = true, name = "bob", photo = "espanha" }); animallist.add(new animal { active = false, name = "robby", photo = "portugal" }); animallist.add(new animal { active = true, name = "snoop", photo = "uk" }); } } and have 1 class animallist.cs , in class added animal list, , im getting active animals code: class animallist : list<animal> { public list<animal> getactiveanimals() { return this.findall(p => p.active); } } and problem in class called event.cs in event.cs want results getactiveanimals() because want active animals event can me please? class event { private animallist _contestants; } i should activ

python - Python3: Files organizing -

i got path of file on unix system: folder1/folder2/text.txt folder1 contains folder2, , folder2 contains file. path file test.txt can shorter -> folder1/text.txt, need universal solution: if(folder contains 1 subfolder)-> move files subfolder folder , del subfolder from comment see want move files in folder3 folder2. here program move files in folders below folder1, delete folders (but not folder1.) first have change directory folder1. , if of files want move exist in folder1 already, error message. can fix though. put in print statements can see working. import os, shutil p = os.path._getfullpathname("folder1") print p root, dirs, files in os.walk(p, topdown=false): file in files: k = os.path.join(root,file) print k shutil.move(k, p) dir in dirs: k = os.path.join(root,dir) print k os.rmdir(k)

html - How to add a backdrop over a div (lightbox effect)? -

Image
i'm editing angularjs project , want add backdrop (like bootstrap modal) on main div when users click on search input box. here html code: <div class="main-box"> <div class="search-function" ng-click="showinputform()"> <img src="../images/my_project/search.png"> </div> <div class="search-form" ng-if="showform"> <form ng-submit="textsearch()"> <input type="text" autofocus class="search-input" ng-model="text.value" /> </form> </div> </div> as can see white box appears when users click on search icon , want add backdrop on main div, except on white box. here less code: .search-function { margin-left: 30%; } .search-form { padding-left: 15%; padding-right: 15%; position: relative; z-index: 0; .search-input {

Rotation Matrix Java -

i've been following tutorial creating game engine , when got calculating 3d rotation matrix ran problem believe matrix isn't being calculated properly. when try rotate matrix 0 degrees on x, y, , z axis, should getting identity matrix rotation matrix should this: rotation matrix: 1.0 0.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 0.0 1.0 but end matrix looks this: rotation matrix: 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 here code calculating rotation matrix directly tutorial: public class matrix4f { private float[][] m; //generate 4x4 array inital matrix represent homogeneous //coordinates: x, y, z, w public matrix4f() { m = new float[4][4]; } public matrix4f initrotation(float x, float y, float z) { //generate rotation matrices x, y, , z matrix4f rx = new matrix4f(); matrix4f ry = new matrix4f(); matrix4f rz = new matrix4f(); //convert x,y, ,

c# - Mvc identity: Adding UserId to another table -

i have model called sammanhang [key] public int sammanhangsid { get; set; } public string namn { get; set; } and want include id of users foreign key can dropdown-list of users in database. i attepmted doing public class sammanhang { [key] public int sammanhangsid { get; set; } public string namn { get; set; } public string userid { get; set; } [foreignkey("userid")] public virtual applicationuser applicationuser { get; set; } } and inside identitymodels public class applicationuser : identityuser { public virtual sammanhang sammanhang { get; set; } } but without no success, there anyway achieve user dropdownlist? try using selectlistitem , anonymous types if needs setup quickly. @html.dropdownlist("users", new list<selectlistitem> { new selectlistitem { text = "john" }, new selectlistitem { text = "frank" }, new selectlistitem { text = "joe" } }, "select user&quo

pre-load a webview on android so user doesn't have to wait for the slow loading time -

i'm making app main content te user wants view in form of html pages, i'm porting app on iphone , want reuse pages because there 100 of them , recreating them android layouts quite time consuming. problem on android webview takes 4-5 seconds load first time open page , couple seconds each subsequent time. i searched , found similar answer don't know if work situation( preload webview ). answer suggests using viewflipper multiple webviews loaded when switch between them instantly loaded. don't know if work me because have 100 different pages cache(although optimize down 30 max loading ones user can navigate current page) , because webviews in different activity button user clicks view page. i.e user looking @ listview 30 different options pages view, when click listview entry opens activity webview , have wait until user made click begin loading webviews, theres no way shave off loading time there. i suppose since listview , webview activities same, small view ti

flask - python-couchdb add ViewField to Model after instantiation -

i trying build base model class used couch-views on (mainly crud). i cannot add viewfields base class, since js string inside must changed per model class name. no problem inside base class __init__ reason, viewfield wont work. when using viewfield so: class mymodel(document): only_carrots = viewfield("mymodel", js-string) then if run: mod = mymodel() mod.only_carrots it show: <viewdefinition '_design/mymodel/_view/only_carrots'> but if viewfield added during __init__ , looks this: <flaskext.couchdb.viewfield object @ 0x10fe8f190> the code running on base model this: attr_name in dir(self): if not attr_name.startswith("_") , attr_name not in ["id", "rev"]: attr_val = getattr(self, attr_name) if isinstance(attr_val, couchview): vd = viewfield(self.doc_type, attr_val.template.render(self.__dict__), name=attr_name, wrapper=self.__class__)

python - While n > 1. Decrease n by 1 on each iteration -

i'm working on hackerrank problems , i've looked @ couple of ways take input , loop through it. what best alternative trying decrease n on each iteration below (as doesn't seem possible). first_n = int(raw_input()) def findpercentage(n): if n > 1: studentinfo = raw_input() return studentinfo n = n - 1 result = findpercentage(first_n) print result as i'm knew this, understand logic might flawed. input passed stdin first line listing total number of lines follow. want perform single operation on every line after first line exception of last line i'd perform different operation. n= int(input()) studentinfo= {} in range(n): inputs= raw_input().split(" ") studentinfo[inputs[0]]= inputs[1:]; this create dictionary studentinfo names key , list of marks value.

django - Testing model - how to create records -

according https://docs.djangoproject.com/en/1.9/topics/testing/overview/ : from django.test import testcase myapp.models import animal class animaltestcase(testcase): def setup(self): animal.objects.create(name="lion", sound="roar") animal.objects.create(name="cat", sound="meow") def test_animals_can_speak(self): """animals can speak correctly identified""" lion = animal.objects.get(name="lion") cat = animal.objects.get(name="cat") self.assertequal(lion.speak(), 'the lion says "roar"') self.assertequal(cat.speak(), 'the cat says "meow"') i want create setup model class: class post(models.model): author = models.foreignkey('auth.user') tags = models.manytomanyfield('bloguserplane.tag') title = models.charfield(max_length=200) text = models.textfield()

.net - Possible OWIN Startup and Ninject concurrent request issue ? -

i have created asp.net webapi .net framework 4.5. ninject 3.2.00 microsoft.owin 3.0.10 api deployed iis-7 our owin startup class looks : public class startup { public void configuration(iappbuilder app) { var config = globalconfiguration.configuration; webapiconfig.register(config); ninjectconfig.register(app, config); } } and ninjectconfig.cs like public class ninjectconfig { public static void register(iappbuilder app, httpconfiguration config) { app.useninjectmiddleware(createkernel) .useninjectwebapi(config); } private static ikernel createkernel() { var kernel = new standardkernel(); kernel.load("xyz.*.dll"); return kernel; } } facing following error... if @ least 2 simultaneous calls made api after apppool refresh, 1 of 2 simultaneous calls fails after second error , other succeeds after 3 seconds of startup. subsequent calls succeed, parallel

asp.net mvc - Creating register method for mvc -

made small front end register page, not sure how register users in mongodb. crud methods written, question how take parameters view's text boxes , parse way data layer? button submit register form: <div class="form-group"> <input ="submit" id="padding" value="sign up" class="btn btn-primary" /> <a href="home">or cancel</a> </div> user controller empty now. not sure if in mvc can use onclick="" method button, not, because there no code behind file. @ first thought somehow should able call padding.click() or whatever method, doesn't seem right way. use typed data binding posting data view controller like: poco public class registeruser { [required] [emailaddress] [display(name = "email")] public string email { get; set; } [required] [stringlength(100, errormessage = "the {0} must @ least {2} characters long.&quo

java - Jboss LinkageError: loader constraint violation: when resolving overridden method -

i have 2 war files: , b web services using cxf a uses web service in b. b uses web service in a. everything working fine in tomcat. when deployed in jboss, facing linkage error. caused by: java.lang.linkageerror: loader constraint violation: when resolving overridden method "org.apache.cxf.jaxws.serviceimpl.createdispatch(ljavax/xml/ws/endpointreference;ljavax/xml/bind/jaxbcontext;ljavax/xml/ws/service$mode;[ljavax/xml/ws/webservicefeature;)ljavax/xml/ws/dispatch;" class loader (instance of org/jboss/classloader/spi/base/baseclassloader) of current class, org/apache/cxf/jaxws/serviceimpl, , superclass loader (instance of ), have different class objects type javax/xml/bind/jaxbcontext used in signature i have removed jaxb-api-2.2.3.jar , jaxb-impl-2.2.4-1.jar war , tested. still facing same issue. what reason? in advance. depending on version of jboss using, there version of jaxb jars included it. check jboss_home/modules/system/layers/base folder