Posts

Showing posts from July, 2013

Change authentication method of FIWARE Business API Ecosystem -

i'm trying integrate fiware business api ecosystem in website uses shibboleth authentication system. it possible change authentication method login shibboleth in components? i'd login shibboleth , stay logged when navigating business api ecosystem components.

ios - Get information of currently playing tracks other than music app in native app objective c -

i want detect playing song in native app ether 1 audio session in app. implemented below , when song playing through phone music app, working fine. -(void)checksession { bool isplayingwithothers = [[avaudiosession sharedinstance] isotheraudioplaying]; if(isplayingwithothers) { _controller = [mpmusicplayercontroller systemmusicplayer]; [_play setenabled:yes]; [_pause setenabled:yes]; [_next setenabled:yes]; [_prev setenabled:yes]; } } but if song playing app pandora app, mpmusicplayercontroller not working. please suggest how can control next, prev, play , pause if song being played via apps rather phone music app. any highly appreciated! in advance! • cannot control playback of other apps own app unless has drastically changed in ios11. • in same vein, cannot info on playing unless using 1 of built-in musicplayers (systemmusicplayer, , maybe applicationmusicplayer) i have not looked on changes in ios11 see i

How to connect java to Ms access Database -

this question has answer here: manipulating access database java without odbc 1 answer i'm trying connect java ms access database didn't work well and got error message this sun.jdbc.odbc.jdbcodbcdriver this code : import java.sql.*; public class main{ public static void main(string[] args) { try{ class.forname("sun.jdbc.odbc.jdbcodbcdriver"); connection con = drivermanager.getconnection("jdbc:odbc:driver={microsoft access driver(*.accdb)};dbq=d:\\andries\\testdatabase.accdb"); statement st = con.createstatement(); }catch(exception ex){ system.out.println(ex.getmessage()); } } } you can use ucanacess.jar connect ms aceess database show example here http://www.benchresources.net/jdbc-msaccess-database-connection-steps-in-java-8/ import ja

ruby - Form Error Messages Not Generating in Rails App -

hi have simple app building , having trouble getting error messages appear when inputs invalid information or no information @ field. the form using sign new user, code associated user , form below; users_controller.rb class userscontroller < applicationcontroller def index @users = user.all end def show @user = user.find(params[:id]) @country = country.all end def new @user = user.new end def create @user = user.new(user_params) if @user.save session[:user_id] = @user.id redirect_to @user else redirect_to '/signup' end end private def user_params params.require(:user).permit(:first_name, :last_name, :email, :password) end end user.rb class user < applicationrecord before_save { self.email = email.downcase } validates :first_name, presence: true, length: { maximum: 25 } validates :first_name, presence: true, length: { maximum: 50 } valid_email_regex = /\a[

python - scp using slave node, jenkins on different vpc than web vpc, for django project -

we using jenkins automate our deployment process jenkins master node on deployment_vpc , have slave on our server_vpc , using ubuntu14.04 only(each machine). slave node can talk our servers in server_vpc. want deploy django project on servers in server_vpc using slave node(only node can communicate servers). did research on same: jenkins trigger build on slave but answer not descriptive enough me. in short want build on jenkins master , scp build on servers using slave node. far can pull code master node , make build , can trigger slave node jenkins web console. how can accomplish this? also suggest me if doing wrong? thanks in advance

Rich media in itext7 -

itext 5 provides number of classes related rich media: richmediaannotation richmediaconfiguration richmediainstance richmediaparams richmediaactivation there example explains how use them insert flash program in pdf: http://developers.itextpdf.com/examples/itext-action-second-edition/chapter-16#608-festivalcalendar1.java however, in itext 7 object found related rich media pdfrichmediaannotation. couldn't find either example shows how use it. how can insert swf program in pdf itext 7?

php - Laravel symbolic link to storage and show the pictures -

in storage have /projects/(nameofproject - not same)/header.jpg , have /projects/(nameofproject - not same)/home.png. how can show them in view? i explain bit more. in past, have projects on /public/assets/img/projects , dynamically. my function create new projects , save images this: public function storeproject(request $request) { $project = new project(); $project->slug = $request->input("slug"); $project->position = $request->input("position"); $project->public = $request->input("public"); $project->pathheader = $request->file('pathheader'); $project->pathhome = $request->file('pathhome'); \storage::disk('projects')->makedirectory($project->slug); \storage::disk('projects')->putfileas($project->slug,$project->pathheader,'header.png'); \storage::disk('projects')->putfi

javascript - how to get element value by knowing parent's name of another parent -

let's have 2 textareas same id , parents have same id, parent forms different names.. , need value of second textarea of second form!!! here's simple code.. var formx = document.getelementsbyname("form2"); for(i = 0; < formx.length; i++){ if(formx[i].type == "textarea"){ var inputval = formx.value; alert(inputval); } } <form name="form1"> <div id="samediv1"> <div id="samediv2"> <textarea id="sameid">value1</textarea> </div> </div> </form> <form name="form2"> <div id="samediv1"> <div id="samediv2"> <textarea id="sameid">value2</textarea> </div> </div> </form> when tried it, no alert appears, , know because loop didn't find text areas because inside element(s) within form.. so, how

python - language translation in TextBlob giving error "returned the input string unchanged" -

i facing problem in language translation in textblob. when give 1000 mandarin comments translates english. when give 200 mixed content of english, german, spanish , mandarin gives me "raise nottranslated('translation api returned input string unchanged" can 1 please me on this. other free api use language detection , translation? tried go-slate gives error.

Python: "de-import", "re-import", "reset import"? -

i debug (in pycharm) script. stop @ breakpoint, go debug console window , there, invoke import line, this: import my_util1 my_utils then call my_util1. far, ok. change in "my_util1". call (updated) my_util1 cannot: system (python? pycharm?) "sees" previous version of my_util1. is there possibility "reset" (refresh) imported earlier, or "re-import" it, other exiting pycharm , restarting project? it not dynamically changing actual code being debugged. task looking simpler - suffice undo 'import' operation, or reset/clear/refresh 'imports' @ once. additionally, action done within debugger window, not in code window. sys.modules can manipulated change python's ideas of what's imported. quote python docs: this dictionary maps module names modules have been loaded. can manipulated force reloading of modules , other tricks. however, replacing dictionary not work expected , deleting essential items dict

cookies - pop-up using javascript with visits and sample rate not working -

i trying make pop-up shows up: after third visit, , 20% of time. i have right now, , i'm not great @ javascript , need figuring out i'm doing wrong. appreciated visits = getcookie('nvisits'); if (!visits) { visits = 1 } if (visits == 3) { deletecookie('nvisits') if (rand(0, 100) <= 20) { window.open("http://mypopup.html", "_blank", "toolbar=yes,scrollbars=yes,resizable=yes,top=500,left=500,width=400,height=400"); } else { if (visits < 3) { ++visits; cookiedata = visits; setcookie('nvisits', cookiedata, expdate) } } } in head of page set cookie: expdate = new date; // in following line, 180 means 180 days. expdate.settime(expdate.gettime() + 180 * 24 * 60 * 60 * 1000); expdate.togmtstring(); function setcookie(name, value, expires, path, domain, secure){ document.cookie= name + "=" + escape(value) + ((expires) ? "; expires=" + expires.togm

c# - unable to populate data of table inside ContentPlaceHolder in aspx page -

i trying populate data of table inside contentplaceholder, not populating. earlier tried same code in aspx page body tag , populating there.here cant place body tag in contentplaceholder.here sending request web api data , getting data in json format. not sure,but feel going bad contentplaceholder. <%@ page title="" language="c#" masterpagefile="~/rlcs_connect/tlconnect_new.master" autoeventwireup="true" codebehind="shownooflocations.aspx.cs" inherits="tlconnect_staffing.rlcs_connect.shownooflocations" %> <asp:content id="content1" contentplaceholderid="head" runat="server"> </asp:content> <asp:content id="content2" contentplaceholderid="contentplaceholder1" runat="server"> <div> <h2><b>location table:</b></h2> <table id="location" cellpadding="3" cellspacing=&

c# - DataContractJsonSerializer and List<Interface> -

in code have serialize list<imodel> imodel interface concrete class model here pseudo code them: public interface imodel { string codice { get; set; } int position { get; } } [datacontract] public class model : imodel { public model(string codice, int position) { this.codice = codice; this.position = position; } [datamember(name = "codice")] public string codice { get; set; } [datamember(name = "position")] int position; public int position { { return position; } } } after reading this post wrote: datacontractjsonserializer jsonserializer = new datacontractjsonserializer(typeof(list<imodel>), new[] { typeof(model) }); using (filestream writer = file.create(@"c:\temp\modello.json")) { jsonserializer.writeobject(writer, mylist); } it works ugly , output contains field type of element, "__type":"model:#someprojectname" . there

php - EXIF Subject and Tags data unreadable -

i trying use "subject" , "tags" (the latter being called "keywords" in exif data believe) sections of exif data .jpg file generate html each image in folder. however when dump exif data image values of both "tags" , "subject" are: ?????????. <?php $imagename = "test.jpg"; $exif = read_exif_data($imagename,"winxp"); print_r($exif); foreach ($exif $key => $val) { if ($key === "subject") { print("key: ".$key." data:".$val); } } results in: array ( [filename] => test.jpg [filedatetime] => 1500976635 [filesize] => 331401 [filetype] => 2 [mimetype] => image/jpeg [sectionsfound] => any_tag, ifd0, exif, winxp [computed] => array ( [html] => width="1500" height="1100" [height] => 1100 [width] => 1500 [iscolor] => 1

Visual Studio Find-Replace tool using Regex Capturing -

i wondering if can use regex expression in visual studio's find , replace tool (edit -> quick replace), find: system.nullable(of x) and replace with: x? where x object type such date, guid, etc... (the code written in visual basic) example 1: regex should able find: system.nullable(of guid) , , replace with: guid? example 2: same regex should able find: system.nullable(of integer) , , replace with: integer? so can use find-replace regex expression change: public property id() system.nullable(of guid) to: public property id() guid? to stop visual studio spamming me "name can simplified" find system\.nullable\(of (\w+)\) , replace $1?

c++ - How to compile Google Protobuf command line interface compile -

i trying raw decode protobuf binary. installed google protobuf library source code https://github.com/google/protobuf able use command line decode raw protobuf binary using command protoc --decode_raw <encodedfile> . want able programmatically using c++ library. similar following example in documentation. https://developers.google.com/protocol-buffers/docs/reference/cpp/google.protobuf.compiler.command_line_interface however trying compile simple piece of code not work. #include <iostream> #include <fstream> #include <string> #include <google/protobuf/compiler/command_line_interface.h> using namespace google::protobuf::compiler; using namespace std; int main(int argc, char* argv[]) { google::protobuf::compiler::commandlineinterface cli_; cerr << "compiled , run" << endl; } compile command c++ my_program.cc -o my_program -pthread -i/usr/local/include -pthread -l/usr/local/lib -lprotobuf -lpthread i see f

c++ - Include fight between data types -

sorry bad title, i'll try describe problem bit better.. i work real-time os. since have task test new feature , our main rtos not support yet, make prototype based on (until not used) rtos. new rtos brings own header files hosts many typedefs generate abbreviations ulong, bool, int, etc... in our code-base there typedefs shall guarantee that, example, unsigned long 4 bytes. , according our styleguide new types shall used interface produce. typedefs unfortunately named same ones new rtos (ulong, int, bool, ...). build-breaking thing is, bool example once declared unsigned char , once int. leads corruption of function-headers bool , other different types used. my question is, how can make 1 of 2 "main" header , prefer it's typedefs on ones of other header-file? , other ways see divide 2 headers? since implement prototype on new rtos, changing our base-types seen less favored solution. appreciated , if need further clarification, let know! edit: ok, he

javascript - getting error "property does not exist" -

i modified question more specific. don't care desired behavior , need correct syntax error i studying this tutorial face error in code. severity: 'error' message: 'property 'offset' not exist on type 'pagerserviceprovider'.' actually have same error 3 variables. that.pagesize,that.offset,that.size public async getpager(tablename:string,pagesize: number = 10) { let pagesize = pagesize; let offset = 0; let limit = pagesize; let size = await this.gettotal(tablename); let = this; return { initialpage:function(){ return new promise((resolve,reject)=>{ var d = []; that.executesql(tablename,limit,offset).then((data)=>{ console.log(json.stringify(data)); for(var = 0 ; < data.rows.length ; i++) { d.push(data.rows.item(i)); } resolve(d); },

Jasper Book Table of content navigation in Docx export -

i generating jasper book table of contents , need export docx. problem when click on first level bookmark in toc, nothing happens. , when click second level label in toc jasper jumps cover page ( in pdf export clicking second level label jumps right anchor in report ). have anchor levels 1 , 2 , link target self type none. toc jrxml <?xml version="1.0" encoding="utf-8"?> <!-- created jaspersoft studio version 6.4.0.final using jasperreports library version 6.4.1 --> <jasperreport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="tocreport"> <property name="com.jaspersoft.studio.data.defaultdataadapter" value="dbone"/> <property name="com.jaspersoft.studio.unit." va

angular - How to act on callback function -

i have script connects server using websocket export class appcomponent { connection_status = false; message = ''; public connect() { this.socket = io('http://localhost:5001'); this.socket.on('connected', this.connection_established); } } i change connection_status variable when connected message received , save content of message message variable. export class appcomponent { connection_status = false; message = ''; public connect() { this.socket = io('http://localhost:5001'); this.socket.on('connected', this.connection_established.bind(this)); } connection_established() { this.connection_established = true; this.message = 'connected'; } }

apostrophe cms - Why inserting a doc result to an array -

using apostrophe tasks purposes, wonder why self.docs['my-module'].insert(...) result array element in third position in callback. expected: plain object directly. steps reproduce : // lib/modules/my-module/index.js module.exports = { construct: (self, options) => { self.apos.modules['apostrophe-tags'].insert({}, { title: 'test' }, {permissions: false}, (err, doc) => { console.log(doc); // [undefined, undefined, the_doc, undefined, undefined] } ); } }; console.log show array data "in middle". my worries behind make safe way : doc[2] . , i'm unable find why in source code ... while insert method of apostrophe-docs deliver doc callback after err argument, insert method of apostrophe-pieces , of subclasses including apostrophe-tags not document arguments callback other err . not necessary because piece object passed same 1 arrive @ callback, have in scope.

visual studio - MSB3644 The reference assemblies for framework were not found -

Image
i getting following msb3644 complication error: the reference assemblies framework ".netframework,version=v4.0" not found. resolve this, install sdk or targeting pack framework version or retarget application version of framework have sdk or targeting pack installed. note assemblies resolved global assembly cache (gac) , used in place of reference assemblies. therefore assembly may not correctly targeted framework intend. from i've read here , due assemblies on machine stored in "program files" , not in "program files (x86)". frameworkpathoverride property on msbuild can fix it. i've tried adding property ( frameworkpathoverride ) csproj: <project sdk="microsoft.net.sdk"> <import project="..\..\tools\common.props" /> <propertygroup> <targetframeworks>net40;net45;netstandard1.2</targetframeworks> <generatepackageonbuild>false</generatepackageonbuild

Reading JSON files in python -

i have json file looks this 20219 {"topic":"electronics","question":"what effective differencial effective of circuit","excerpt":"i'm trying work out, in general terms, effective capacitance of circuit (see diagram: http://i.stack.imgur.com/bs85b.png). \n\nwhat effective capacitance of circuit , ...\r\n "} {"topic":"electronics","question":"heat sensor fan cooling","excerpt":"can know component senses heat or acts heat sensor in following circuit?\nin given diagram, said 4148 diode acts sensor. zener diode , ...\r\n "} {"topic":"electronics","question":"outlet installation--more wires new outlet can use [on hold]","excerpt":"i replacing wall outlet cooper wiring usb outlet (tr7745). new outlet has 3 wires coming out of it--a black, white, , green. each 1 needs attached wire nut ...\r\n

system verilog - Systemverilog property implication with or (||) is not working as expected? -

i trying write sytemverilog assertions determining clock period(140mhz) arbitrary + or - value of 0.001ns, here in systemverilog property used "or" operator (||) +/- deviations/changes of time periods outputs not expected, can explain exact cause of this?, , value of clk_prd assertion gets asserted not expected, please mention optimal solution this? code snippet below, module clock_gen(); timeunit 1ns; timeprecision 100ps; bit clk; realtime clk_prd =1000/340.0ns; //2.9411764 //realtime clk_prd =1000/140.0ns; //7.1428571 property sva_clk(real clk_prd); time current_time; (('1,current_time=$realtime) |=> (clk_prd <= $realtime-(current_time - 0.001ns)) || (clk_prd >= $realtime-(current_time + 0.001ns))); endproperty assert_period:assert property (@(posedge clk)sva_clk(clk_prd)) $display("clk pass : %0t ",$realtime); else $warning("clk fail : %0t",$realtime);

Jenkins displays an error, java.io.exception. Access Denied and cannot create a temporary file -

i able run builds in jenkins. all of sudden encounter error when try run,configure or delete build java io exception. access denied cannot create temp files ­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­

multithreading - Does my ruby thread code will run in parallel automatically when use jRuby -

i have code require 'thread' work_q = queue.new (0..50).to_a.each{|x| work_q.push x } workers = (0...4).map thread.new begin while x = work_q.pop(true) 50.times{print [128000+x].pack "u*"} end rescue threaderror end end end workers.map(&:join) i know if run using mri, it's run concurently. but if run on jruby run concurently , parallel, or concurently is mandatory write thread code using java on jruby achieve parallel process? in short, yes, parallel. jruby ships custom thread library written in native java, when put require 'thread' @ top of file, you're using java library, not ruby library. as long java installation supports parallel threads (and modern ones do), , long operating system supports parallel threads (most mordern ones do), jruby code has potential run in parallel well.

reactjs - How to Access the State of the reducer in other reducer in reat redux -

i have login page component have state boolean called isuserauthenticated, when i'm clicking on login button checks userslist wheather user exists or not. users list in signupreducer, how can access users list in loginreducer , return isuserauthenticated flag it. loginpage component export const mapstatetoprops = (state) => { return { isuserauthenticated: state.reducer.isauthenticated.isuserauthenticated, users: state.signupreducer.users } } export const mapdispatchtoprops = (dispatch) => { return { checklogin: (credentials) => dispatch({ type: 'check_login', credentials }) } }; loginpage = connect(mapstatetoprops, mapdispatchtoprops)(loginpage); export default loginpage; login reducer const initialstateauth = { isuserauthenticated: false }; export const isauthenticated = (state = initialstateauth, action) => { switch (action.type) { case 'check_login': return object.assi

python - Transforming mjpg-streamer into window stream -

i need convert website stream project https://github.com/jacksonliam/mjpg-streamer/tree/master/mjpg-streamer-experimental windows stream. im building pyqt interface few buttons , need convert stream interface. any ideas how thing using python, never did thing before. or other ideas?

java - Can't bring the user to Notifications settings -

so in app @ moment when user first loads prompt go notification access menu. if select yes redirects it, if no go go onto apps page. private alertdialog buildnotificationservicealertdialog() { final alertdialog.builder alertdialogbuilder = new alertdialog.builder(this); alertdialogbuilder.settitle("one"); alertdialogbuilder.setmessage("two"); alertdialogbuilder.setpositivebutton("yes", new dialoginterface.onclicklistener() { public void onclick(dialoginterface dialog, int id) { startactivity(new intent(action_notification_listener_settings)); } }); alertdialogbuilder.setnegativebutton("no", new dialoginterface.onclicklistener() { public void onclick(dialoginterface dialog, int id) { } }); return (alertdialogbuilder.create()); } when click "yes" closes app , when press "

php - Failed to open stream: HTTP request failed!? -

i need here, http request failed error give me lot of headache. try in local server , online server still didn't work, trying export table data .pdf or .xls format. controller. public function export() { $format = input::query('type'); $filename = carbon::now()->format('ymd_') . "productslist"; $file = excel::create($filename, function ($excel) { $excel->sheet('product cost , amount', function ($sheet) { $sheet->setfittopage(0); $sheet->setfittowidth(0); $sheet->setfittoheight(0); $sheet->freezefirstrowandcolumn(); $sheet->setorientation('landscape'); $products = $this->report->getproductlevels(); $sheet->loadview('reports.product_report.product_level_report', compact('products')); }); $excel->sheet('product locations', function ($sheet) { $sheet

scala - Why is my Scalacheck test with a custom Generator failing after discarding many cases, and how do I fix this? -

i newbie scala , writing first scalacheck suite. i have data structure in program looks (list[double], list[double]) well-formed if each element of _1 strictly greater corresponding element of _2 . since it's more complicated in practice (although purpose of mwe can pretend there's there it), i've written custom generator it. i added 2 trivial tests (including trivial of all, 1 == 1 ) , in both cases tests fail, message gave after xx passed tests. yyy tests discarded. why it, , how fix it? attached test suite , output. package com.foo.bar import org.scalacheck._ import prop._ import arbitrary._ object foospecification extends properties("foointervals") { type foointervals = (list[double], list[double]) /* supposed tuple of lists s.t. each element of _1 * < corresponding element of _2 * * e.g. (list(1,3,5), list(2,4,6)) */ implicit def arbinterval : arbitrary[foointervals] = arbitrary { /** * yields

angular - hostCompFixture.detectChanges break my test -

i test toast component have add console log display if use hostcompfixture.detectchanges have nothing test failed directy , if delete hostcompfixture.detectchanges component this test : @component({ template: ` <mae-toast [toast]="toast"></mae-toast> ` }) class testtoastcomponent { toast: toast severity? : severity id?: heading?: string content: string icon?: string color?: string actions?: actionlistitem[] } describe('toastcomponent', () => { beforeeach(() => { testbed.configuretestingmodule({ declarations: [toastcomponent, testtoastcomponent], imports: [linkmodule, routertestingmodule,browseranimationsmodule] }) fixture = testbed.createcomponent(toastcomponent) comp = fixture.componentinstance hostcompfixture = testbed.createcomponent(testtoastcomponent) hostcomp = hostcompfixture.componentinstance }) it('should check severity property', ()=> { h

php - Where is generated MySQL Schema located in directory structure with Doctrine? -

i trying learn doctrine orm association mapping in symfony using following reference: http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/association-mapping.html i assume mysql schema generated after executing entity. there clue located? i think in general setup, not stored. why use doctrinemigrationsbundle in projects. after installation, every migration stored in migrations_directory , see generated sql migrate , undo.

autohotkey - RegEx: find and replace EOL between quotes -

in multi-line string this: she loves [mono],"past masters, vol. 1",4,"she loves you, yeah, yeah, yeah loves you, yeah, yeah, yeah loves you, yeah, yeah, yeah, yeah" 8 days week,beatles sale,8,"eight days week love you. 8 days week not enough show care." i want replace eol (\r\n) between quotes replacement character "¶" (ascii code 182) make string single-line. the result be: she loves [mono],"past masters, vol. 1",4,"she loves you, yeah, yeah, yeah¶she loves you, yeah, yeah, yeah¶she loves you, yeah, yeah, yeah, yeah" 8 days week,beatles sale,8,"eight days week¶i love you.¶eight days week¶is not enough show care." i tried various regex related solutions found on stackoverflow not able adapt them want. i use regex expression in ahk function: regexreplace(haystack, needleregex [, replacement = "", outputvarcount = "", limit = -1, startingposition = 1]) regexreplace(mytext, needle

c++ - Integrating third party SDK Makefile into Qt -

i have u.are.u 4500 fingerprint reader has code in c , integrate qt. code looks readable i'm having problems integrating makefile .pro qt file fingerprint's sdk recognised. could incorporating fingerprint demo makefile qt project. exe_name = uareusample sdk_includes = ../../../include out_dir ?= . lib_out_dir ?= /usr/lib ccflags = -g -wall -i$(sdk_includes) $(cflags) # $(call getlink, linkname) getlink = $(shell cygpath -wm `readlink -f $(1)`) ifeq ($(findstring arm, $(cflags))$(findstring cygwin, $(shell uname)),armcygwin) #code sourcery toolchain under cygwin cannot dereference symbolic links, need specify actual library linking ldflags = -lpthread -lm -lc $(cflags) $(call getlink, $(lib_out_dir)/libdpfpdd.so) $(call getlink, $(lib_out_dir)/libdpfj.so) else ldflags = -lpthread -lm -lc $(cflags) -l $(lib_out_dir) -ldpfpdd -ldpfj endif objs = sample.o menu.o helpers.o selection.o verification.o ide

sql - Renaming a table and a foreign key fails using ef6 -

i use ef6 , code first migrations. have 2 tables public class team { public int id { get; set; } public string name { get; set; } } public class teammember { public int id { get; set; } public string name { get; set; } public team team { get; set; } public int teamid { get; set; } } i want rename teammember teammemberdeprecated , add new tabled named teammember differences table layout. main reason creating new table data. want save of data in current teammember table need rename it, , want transfer specific data need new teammember table. when add migration looks this renametable(name: "dbo.teammember", newname: "teammemberdeprecated"); what doesn't change name of foreign key property fk_dbo.teammember_dbo.team_teamid fk_dbo.teammemberdeprecated_dbo.team_teamid. this presents problem when go create new teammember table because foreign key fk_dbo.teammember_dbo.team_teamid exists in database. i tried dropping f

java - regular expression retrieve a portion of a string that not contain a string -

i have strings following: it.mycompany.db.beans.str1.pd_t_class it.mycompany.db.beans.join.pd_t_class it.mycompany.db.beans.str2.pd_t_class_1 it.mycompany.db.beans.join.pd_t_class_1 pd_t_class myvar = new pd_t_class(); myvar.setpd_t_class(something); and want select "pd_" part substitute "" (the void string) inf entire line not contain string ".join." what want achieve is: it.mycompany.db.beans.str1.t_class it.mycompany.db.beans.join.pd_t_class it.mycompany.db.beans.str2.t_class_1 it.mycompany.db.beans.join.pd_t_class_1 t_class myvar = new t_class(); myvar.sett_class(something); the substitution not problem since i'm using eclipse search tool , hit replace show me right result. i have tried: ^((?!\.join\.).)*(pd_)*$ // whole string selected ^((?!\.join\.).)*(\bpd_\b)*$ // whole string selected i start getting frustrated since i've searched bit around (the ^((?!join bla bla come searches) can me? you may use followin

python - How to extract the <span> tag contents using the Beautiful Soup? -

i'm trying extract span tag content google translate website. content translated result has id="result_box". when tried print contents, returns none value. please check image here import requests bs4 import beautifulsoup r = requests.get("https://translate.google.co.in/?rlz=1c1chzl_enin729in729&um=1&ie=utf-8&hl=en&client=tw-ob#en/fr/good%20morning") soup = beautifulsoup(r.content, "lxml") spanner = soup.find(id = "result_box") result = spanner.text requests doesn't execute javascript, use selenium , phantomjs headless browsing this: from bs4 import beautifulsoup selenium import webdriver url = "https://translate.google.co.in/?rlz=1c1chzl_enin729in729&um=1&ie=utf-8&hl=en&client=tw-ob#en/fr/good%20morning" browser = webdriver.phantomjs() browser.get(url) html = browser.page_source soup = beautifulsoup(html, 'lxml') spanner = soup.find(id = "result_box") re

Java sorting numbers using algorithm -

i have task sort ints in ascending order. task designed practice algorithms... used basic array sort method this: bufferedreader reader = new bufferedreader(new inputstreamreader(system.in)); int = integer.parseint((reader.readline())); int b = integer.parseint((reader.readline())); int c = integer.parseint((reader.readline())); int d = integer.parseint((reader.readline())); int e = integer.parseint((reader.readline())); int[] ints = {a, b, c, d, e}; arrays.sort(ints); for(int = 0; i<5;i++) { system.out.println(ints[i]); } its not algorithm sure. how without sort method? you use selection sort: public static void selectionsort ( int [ ] num ){ int i, j, first, temp; ( = num.length - 1; > 0; -- ){ first = 0; for(j = 1; j <= i; j ++) { if( num[ j ] < num[ first ] ) first = j; } temp = num[ first ]; num[ first ] = num[ ]

r - incorrect grouping in plotting longitudinal data with ggplot -

Image
i trying plot longitudinal dataset ggplot. here example data illustrate problem. library(mass) library(ggplot2) library(dplyr) # create data dat.tx.a <- mvrnorm(n=250, mu=c(30, 20, 28), sigma=matrix(c(25.0, 17.5, 12.3, 17.5, 25.0, 17.5, 12.3, 17.5, 25.0), nrow=3, byrow=true)) dat.tx.b <- mvrnorm(n=250, mu=c(30, 20, 22), sigma=matrix(c(25.0, 17.5, 12.3, 17.5, 25.0, 17.5, 12.3, 17.5, 25.0), nrow=3, byrow=true)) dat <- data.frame(rbind(dat.tx.a, dat.tx.b)) names(dat) = c("measure.1", "measure.2", "measure.3") dat <- data.frame(subject.id=factor(1:500), tx=rep(c("a", "b"), each=250), dat) rm(dat.tx.a, dat.tx.b) dat <- reshape(dat, varying=c("measure.1", "measure.2"

dataframe - Choosing different amount of elements from each group in R -

i working on kaggle instacart competition, quite new r , have run can not figure out. i have dataset 4 columns. first column order id (id1). second column product id (id2). third column probability want select product id2 order id1 can consider ranking, higher probability selected on smaller probability. finally, fourth column amount of products want select given order (a feature of order). example, have here first 12 rows of dataframe df: id1 id2 prob num 1 17 13107 0.4756982 3 2 17 21463 0.3724126 3 3 17 38777 0.3534422 3 4 17 21709 0.3364623 3 5 17 47766 0.3364623 3 6 17 39275 0.3165896 3 7 34 16083 0.4093785 4 8 34 39475 0.3892882 4 9 34 47766 0.3892882 4 10 34 2596 0.3837562 4 11 34 21137 0.3762758 4 12 34 477

Laravel Dusk: The correct localhost port for APP_URL on a remote server? -

i trying install dusk on laravel @ remote host , @ point need change .env file this app_url=http://localhost:8000 another tutorial suggested app_url=http://localhost:9515 for remote host, need put " http://localhost :????" , if need how find port number? not leave "/"? by way, have tested several options , non have worked far not sure causes trying pint point problem. set app_url same url using in browser local development environment. can http://localhost custom url: app_url=http://dusk.local for laravel homestead can manage sites within homestead.yaml file. the app_url somehow important commands terminal require information pointed out in detail in this answer . the port 9515 default port number of selenium server url provided in dusktestcase.php . there's no need change @ beginning should work out of box . by default, ports forwarded homestead environment.

c# - Sine wave clicking with Beep.BeepBeep -

originally, project make song in windows console using c# used console.beep(freq,time); , unreliability of caused desyncs. i changed using beep beep class. problem when playing baseline, there audible click @ end of every note. here's example . single note it's not bad, many consecutive notes it's unbearable. even when opened in wave editor, no matter cropped it clicked. how can rid of clicking, without installing bulky libraries c# console project? have tried ramping amplitude @ start of sound , down again @ end. so, modify inner loop of beep beep class, reads... (int t = 0; t < samples; t++) { short sample = system.convert.toint16(a * math.sin(deltaft * t)); bw.write(sample); bw.write(sample); } could modified this (int t=0; t < samples; t++) { double ampramp = 1.0d; if (t<1000) { ampramp = ((double) t) / 1000.0d; } else if (t > samples - 1000) { ampramp = ((double) (sa

jquery - JS checkbox enable/disable groups of inputs NOT working when inputs wrapped in DIVs -

i've been looking way enable/disable groups of inputs corresponding checkbox. found 1 answer works me here . however, works when inputs not wrapped in divs. when add bootstrap-classes divs, script stops working. here script: $('input[type="checkbox"]').change(function(){ $(this).nextuntil(':not(input:text)').prop('disabled', !this.checked) }).change() not acquainted jquery, i've found out nextuntil() method include until next element not "input:text". so, tried expanding follows: $(this).nextuntil(':not(input:text, div)').prop('disabled', !this.checked) or $(this).nextuntil(':not(input:text), :not(div)').prop('disabled', !this.checked) or $(this).nextuntil(':not(input:text)', ':not(input:text)').prop('disabled', !this.checked) nothing works. did read listing multiple selectors apparently don't understand how correctly it. here html (dynamically gener

python - Select a specific object from a queryset django -

is there way select specific object found in results of queryset selecting item in array. in arrays, can select specific item based on position: arrayname = {55, 33, 34, 23} arrayname[2] result = 34 i want accomplish same thing queryset results users in database = {steve, chris, jame, cole, casper, courtney} query filter names start c result = {chris, cole, casper, courtney} after results, want select casper results... there way array. something results[2] update so have part of view working specify specific record. my other question see if possible same thing in html tempalte file... here have in view , html file. there way same thing ht ehtml file... view.py i=0 form in formset: cd = form.cleaned_data currentamount = cd['amount'] currentdescription = cd['description'] print(currentamount)