Wednesday 15 February 2012

ios - Inheritance of view -



ios - Inheritance of view -

i'm new ios , i'm trying understand how platform works, excuse me if create dumb questions.

my question based on problem nowadays in post: inheritance on view controller objective c

so far, understand can inherit controllers, can inherit view? think reply no. if case, best way solve next problem?

i have card matching game. now, have expand game have similar card game different deck , rules.

therefore, want reuse code , have main controller , 2 inherited controllers redefine creation of deck. need have 2 different views because 2 games have different number of cards. so, best way this? have re-create controls 1 view , modify what's needed?

you can inherit view fine. create subclass of uiview when add together new file , import subclass.

regarding question, sense best way approach have subclass of uiviewcontroller called cardscontroller has deck property , can manage display , alter of cards based on set of rules defined you. then, subclass view controller farther each of 2 games, since both create utilize of cards.

ios objective-c inheritance

c - How to get the initial address of the heap? -



c - How to get the initial address of the heap? -

i'm working on implementation of malloc using sbrk()

if want initial address of heap phone call sbrk(0) , set pointer it?

c memory malloc heap

How to Merge an Indexed Array into an Unordered Associative Array PHP -



How to Merge an Indexed Array into an Unordered Associative Array PHP -

i come here help exercise have been racking brain on 3 hours now. have 2 arrays, $authors , $books.

$authors:

$authors = array( "steinbeck", "kafka", "tolkien", "dickens", "milton", "orwell" );

$books:

$books = array( array( "title" => "the hobbit", "authorid" => 2, "pubyear" => 1937 ), array( "title" => "the grapes of wrath", "authorid" => 0, "pubyear" => 1939 ), array( "title" => "a tale of 2 cities", "authorid" => 3, "pubyear" => 1859 ), array( "title" => "paradise lost", "authorid" => 4, "pubyear" => 1667 ), array( "title" => "animal farm", "authorid" => 5, "pubyear" => 1945 ), array( "title" => "the trial", "authorid" => 1, "pubyear" => 1925 ), );

as can see, $authors two-dimensional indexed array whereas $books multidimensional associative array. task create new key (i think key? vocabulary arrays messes me up..) $books called "authorname", , populate key authors $authors array. grab index authors in $authors array corresponds "authorid" in $books array, ids out of order.

in other words, task pull info $authors array books array ends next data:

$books = array( array( "title" => "the hobbit", "authorid" => 2, "pubyear" => 1937 "authorname" => "tolkien" ), array( "title" => "the grapes of wrath", "authorid" => 0, "pubyear" => 1939 "authorname" => "steinbeck" ), array( "title" => "a tale of 2 cities", "authorid" => 3, "pubyear" => 1859 "authorname" => "dickens" ),

...and on. help appreciated since have absolutely no thought how this.

congrats on learning php! i'll start minor things vocabulary; think it's of import in programming right ;-)

the $authors array not two-dimensional you said out of order, don't think is. maintain in mind array indexes 0-based. yes, "key" okay way describe trying add. more semantically appropriate might "entry", "entry" comprised of "key" , it's "value"

here code. i've chosen more verbose might author code in order clear happening.

foreach($books $book_index => $book_array) { // index of author in $authors array. // value, $authors[$authorid] name of author of book $authorid = intval($book_array['authorid']); // line adds entry current book in $books array. $books[$book_index]['authorname'] = $authors[$authorid]; }

php

ios - Is there a Google Maps equivalent to mkmapsnapshotter? -



ios - Is there a Google Maps equivalent to mkmapsnapshotter? -

i have uitableview may potentially contain big number of cells, , in cells want uiimageview showing map of location, coordinates of known @ runtime.

i want table view scroll smoothly , want maps in cells not scrollable @ all.

i've been directed avoid apple maps. besides, mkmapsnapshotter ios 7 , up. have back upwards ios 6.

so google maps image api best option?

i'm using google maps ios sdk anyway, i'd utilize if possible. have feature? equivalent mkmapsnapshotter? i'm surprised can't find in documentation.

there used gmsscreenshot class in sdk, used take screenshots. in v1.2 google removed this, utilize renderincontext instead. can see background info , sample code here:

google maps ios sdk 1.2 need snapshot of map view

issue taking screen capture of gmsmapview on google maps sdk ios

https://developers.google.com/maps/documentation/ios/releases#version_12_-_april_2013

i think though renderincontext (and gmsscreenshot before it) designed taking screenshot of map view on view, has been displayed while, has downloaded map tiles etc. i'm not sure work if created map view in background, set photographic camera position desired lat/lon, rendered image, , repeated other locations want.

so, suspect google maps image api work improve doing.

ios google-maps uitableview ios6 google-maps-sdk-ios

java - Save Checkbox state in a Panel/Dialog -



java - Save Checkbox state in a Panel/Dialog -

i new swings , have 1 doubt:

i have 1 dialog box, in dialog, there 1 check box, ok , cancel buttons. suppose user selected checkbox , click ok button, when user opens 1 time again dialog box, check box should selected.

can give idea, how implment this.

i know can using setselected(true) , setselected(false) methods.

but how save state of check box.

you can pass components joptionpane , displayed properly.

so illustration if create jcheckbox , pass joptionpane, after dialog closed, can examine state of check box , store anywhere you'd to. next time want display dialog, before passing check box, set state 1 stored lastly time.

for illustration (just demonstration purposes):

final jframe f = new jframe("checkbox test"); f.setdefaultcloseoperation(jframe.do_nothing_on_close); f.addwindowlistener(new windowadapter() { // store checkbox state here in boolean variable: boolean save; @override public void windowclosing(windowevent e) { // user wants close application, inquire confirmation: // create check box initial value of stored state: jcheckbox cb = new jcheckbox("save settings before exit", save); int res = joptionpane.showconfirmdialog(null, new object[] {"are sure want exit?", cb}, "exit?", joptionpane.ok_cancel_option); // dialog closed, can save sate of check box save = cb.isselected(); if (res == joptionpane.ok_option) { if (save) { // settings can saved here. } // , exit (by disposing frame) f.dispose(); } } }); f.getcontentpane().add(new jlabel("try close application")); f.pack(); f.setlocationrelativeto(null); f.setvisible(true);

java swing checkbox dialog

objective c - Custom Facebook iOS request dialog with sdk v3.19 and Graph API v2.1 -



objective c - Custom Facebook iOS request dialog with sdk v3.19 and Graph API v2.1 -

i'm trying figure how custom invite/request dialog can created in new facebook ios sdk.

so far found utilize of fbwebdialogs create request dialog it's not customizable afaik.

in this sample there explanation on how doesn't help me because:

it's java script api. it talks invitable_friends api while "the invitable_friends api available games have facebook canvas app implementation using version 2.0 of graph api" game thingies available in ios.

so questions are:

can requests dialog (fbwebdialogs ) used in ios game has no presence on facebook canvas?

because here says app not have presence on facebook canvas may utilize message dialog on ios, not requests dialog, here doesn't restrict fbwebdialogs in ios games canvas (if restrict happen when utilize fbwebdialogs after apr 2015? exception?!?)

how request dialog customized in facebook ios sdk 3? e.g. in here:

can send request in dialog friends not playing game?

after select them , send request, open send request dialog confirmation? e.g. in here:

thank all!

ios objective-c facebook facebook-graph-api facebook-ios-sdk

testing - Checking for compatible types using reflection in Go -



testing - Checking for compatible types using reflection in Go -

although aware might not idiomatic panic in go, test ensure function panics under conditions , not in others.

an illustration of function.

func paniconerr(potentialerr error) { if potentialerr != nil { panic(potentialerr) } }

the next implementation checking if function panic.

func invocationcausedpanic(f interface{}, params ...interface{}) bool { // obtain function's signature. reflectedfunc := reflect.valueof(f) functype := reflect.typeof(f) if functype.numin() != len(params) { panic("invocationcausedpanic called function , wrong number of parameter(s).") } reflectedparams := make([]reflect.value, len(params)) paramindex, paramvalue := range params { expectedtype := functype.in(paramindex) actualtype := reflect.typeof(paramvalue) if actualtype != expectedtype { errstr := fmt.sprintf("invocationcausedpanic called mismatched parameter type [parameter #%v: expected %v; got %v].", paramindex, expectedtype, actualtype) panic(errstr) } reflectedparams[paramindex] = reflect.valueof(paramvalue) } homecoming invoke(reflectedfunc, reflectedparams) } func invoke(reflectedfunc reflect.value, reflectedparams []reflect.value) (panicked bool) { defer func() { if r := recover(); r != nil { panicked = true } }() reflectedfunc.call(reflectedparams) homecoming }

calling either of next cause type-check fail.

invocationcausedpanic(paniconerr, errors.new("some error.")) invocationcausedpanic(paniconerr, nil)

however, seems possible phone call paniconerr using both nil , generate calling errors.new (seems of type *errors.errorstring).

as such, there way check if type of parameter suitable invoking function?

while know possible utilize defer , recover more test function, curious whether possible write general function can take function , parameters , determine whether resulted in panic (assuming function completes).

relevant go playground: http://play.golang.org/p/qug7oguibd

use function determine if parameter compatible:

func compatible(actual, expected reflect.type) bool { if actual == nil { k := expected.kind() homecoming k == reflect.chan || k == reflect.func || k == reflect.interface || k == reflect.map || k == reflect.ptr || k == reflect.slice } homecoming actual.assignableto(expected) }

playground

testing reflection go

python - Canvas figure not showing title or axis format -



python - Canvas figure not showing title or axis format -

i having problem when ploting graph within main window.

i using qtdesigner main window.

inside 1 of horizontal_layout want disply graph.

here code using generate plot:

def plotdistribution(datatoplot, layout, numrows, nowcols): """ delete previous elements in layout if any""" in reversed(range(layout.count())): layout.itemat(i).widget().deletelater() plt.ioff() """ extract info plot """ xdata = [i[0] in datatoplot] ydata = [i[3] in datatoplot] fig, ax = plt.subplots() """ format label ticks , values x , y""" xtickspos = np.arange(50,(100*numrows)+50,100) xticksvals = ["row "+str(i) in np.arange(1,max(xdata),1) ] plt.xticks(xtickspos ,xticksvals ,rotation=90) ytickspos = np.arange(83,(166*numcols)+83,166) yticksvals = ["column "+str(i) in np.arange(1,max(ydata),1) ] plt.yticks((ytickspos),(yticksvals)) plt.title("rows , cols distributuion") """ create canvas , display in main window """ mycanvas = figurecanvas(fig) layout.addwidget(mycanvas) plt.close(fig)

this programme called main window, giving him info plot , layout want graph displayed.

however, if phone call same routine more 1 time, after first time nil displayed in title, nor in axes.

i not understand rare behaviour.

any help??

python canvas matplotlib

go - goimports behaves differently when called from emacs -



go - goimports behaves differently when called from emacs -

i'm observing puzzling behaviour of goimports command called emacs. i'm using svgo go package, , minimal programme illustration in doc imports "github.com/ajstarks/svgo"

the code works fine. goimports command "tool prepare (add, remove) go imports automatically". since "github.com/ajstarks/svgo" needed, don't expect goimports remove it. , it's true when phone call terminal:

$ head gg.go bundle main import ( "os" "github.com/ajstarks/svgo" ) func main() {

then:

$ goimports gg.go | head bundle main import ( "os" "github.com/ajstarks/svgo" ) func main() {

as expected, rearranged imports next "first standard library, external packages". funny part: when phone call goimports emacs, deletes "github.com/ajstarks/svgo" line! (and programme no longer compiles).

here's (the relevant part of) .init file:

(setq exec-path (cons "/usr/local/go/bin" exec-path)) (add-to-list 'exec-path "~/go/bin") (defun my-go-mode-hook () (setq gofmt-command "goimports") ; utilize goimports instead of go-fmt (add-hook 'before-save-hook 'gofmt-before-save)) (add-hook 'go-mode-hook 'my-go-mode-hook)

if comment (setq gofmt-command "goimports") line, svgo import doesn't deleted.

how's possible?

emacs go

android - Weird Activity Lifecycle. -



android - Weird Activity Lifecycle. -

when first start activity main activity, goes through oncreate() onstart(). while in app, if turn off screen, goes onpause() save data. goes onstop(), ondestroy(), again, without turning on screen oncreate(), onstart(), onpause(). should go oncreate(), onstart() right after ondestroy(), without me doing anything?

@override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); requestwindowfeature(window.feature_no_title); getwindow().setflags(windowmanager.layoutparams.flag_fullscreen, windowmanager.layoutparams.flag_fullscreen); setcontentview(r.layout.activity_timegame); } @override protected void onresume() { super.onstart(); if (checkfirsttimerun()) initializegame(); else resumegame(); } @override protected void onpause() { super.onpause(); savegamedata(); }

shorter explanation(considering not using fragments):

creation of activity oncreate,onstart,onresume when rotate screen onpause,onstop,ondestroy- 1 time again oncreate,onstart,onresumebecause activity destroyed , recreated onorientation change

thus, if won't rotate oncreate,onstart,onresume not fired sec time !

understand events executed , when:

have @ 1 of answers posted in stackoverflow - click here

a utilize case example(considering using fragments):

sample project:

i have opensource project download here , execute , see log understand >the sequence of events executes 1 after another(i have fragment in project exclude >fragment logs if don't need it)

project observations

if path activity-fragmentone , alter orientation first time events fired follows mainactivity-oncreate- fragmentone-onattach- fragmentone-oncreate- fragmentone-oncreateview- fragmentone-onactivitycreated- fragmentone-onstart- fragmentone-onresume

if path activity-fragmentone-orientationchange , alter orientation first time events fired follows

mainactivity-oncreate- fragmentone-onattach- fragmentone-oncreate- fragmentone-oncreateview- fragmentone-onactivitycreated- fragmentone-onstart- fragmentone-onresume- fragmentone-onpause- fragmentone-onsaveinstancestate- fragmentone-onstop- fragmentone-ondestroy- fragmentone-ondetach- mainactivity-oncreate- fragmentone-onattach- fragmentone-oncreate- fragmentone-oncreateview- fragmentone-onactivitycreated- fragmentone-onstart- fragmentone-onresume

if path activity-fragmentone-orientationchange-orientationchange , alter orientation first time events fired follows

mainactivity-oncreate- fragmentone-onattach- fragmentone-oncreate- fragmentone-oncreateview- fragmentone-onactivitycreated- fragmentone-onstart- fragmentone-onresume- fragmentone-onpause- fragmentone-onsaveinstancestate- fragmentone-onstop- fragmentone-ondestroy- fragmentone-ondetach- mainactivity-oncreate- fragmentone-onattach- fragmentone-oncreate- fragmentone-oncreateview- fragmentone-onactivitycreated- fragmentone-onstart- fragmentone-onresume- fragmentone-onpause- fragmentone-onsaveinstancestate- fragmentone-onstop- fragmentone-ondestroy- fragmentone-ondetach- mainactivity-oncreate- fragmentone-onattach- fragmentone-oncreate- fragmentone-oncreateview- fragmentone-onactivitycreated- fragmentone-onstart- fragmentone-onresume

if path activity-fragmentone-orientationchange-orientationchange-fragmenttwo , alter orientation first time events fired follows

mainactivity-oncreate- fragmentone-onattach- fragmentone-oncreate- fragmentone-oncreateview- fragmentone-onactivitycreated- fragmentone-onstart- fragmentone-onresume- fragmentone-onpause- fragmentone-onsaveinstancestate- fragmentone-onstop- fragmentone-ondestroy- fragmentone-ondetach- mainactivity-oncreate- fragmentone-onattach- fragmentone-oncreate- fragmentone-oncreateview- fragmentone-onactivitycreated- fragmentone-onstart- fragmentone-onresume- fragmentone-onpause- fragmentone-onsaveinstancestate- fragmentone-onstop- fragmentone-ondestroy- fragmentone-ondetach- mainactivity-oncreate- fragmentone-onattach- fragmentone-oncreate- fragmentone-oncreateview- fragmentone-onactivitycreated- fragmentone-onstart- fragmentone-onresume- fragmentone-onstop- fragmentone-onattach- fragmentone-oncreate- fragmentone-oncreateview- fragmenttwo-onactivitycreated- fragmentone-onstart- fragmentone-onresume

if path activity-fragmentone-orientationchange-orientationchange-fragmenttwo-orientationchange , alter orientation first time events fired follows

mainactivity-oncreate- fragmentone-onattach- fragmentone-oncreate- fragmentone-oncreateview- fragmentone-onactivitycreated- fragmentone-onstart- fragmentone-onresume- fragmentone-onpause- fragmentone-onsaveinstancestate- fragmentone-onstop- fragmentone-ondestroy- fragmentone-ondetach- mainactivity-oncreate- fragmentone-onattach- fragmentone-oncreate- fragmentone-oncreateview- fragmentone-onactivitycreated- fragmentone-onstart- fragmentone-onresume- fragmentone-onpause- fragmentone-onsaveinstancestate- fragmentone-onstop- fragmentone-ondestroy- fragmentone-ondetach- mainactivity-oncreate- fragmentone-onattach- fragmentone-oncreate- fragmentone-oncreateview- fragmentone-onactivitycreated- fragmentone-onstart- fragmentone-onresume- fragmentone-onstop- fragmentone-onattach- fragmentone-oncreate- fragmentone-oncreateview- fragmenttwo-onactivitycreated- fragmentone-onstart- fragmentone-onresume- fragmentone-onpause- fragmentone-onsaveinstancestate- fragmentone-onsaveinstancestate- fragmentone-onstop- fragmentone-ondestroy- fragmentone-ondetach- fragmentone-ondestroy- fragmentone-ondetach- mainactivity-oncreate- fragmentone-onattach- fragmentone-oncreate- fragmentone-onattach- fragmentone-oncreate- fragmentone-oncreateview- fragmenttwo-onactivitycreated- fragmentone-onstart- fragmentone-onresume

android

java - Initialization in while block? -



java - Initialization in while block? -

isn't there cleaner way of doing next (eliminating need initializing line prior while block)? seems unnecessary intialize variable prior usage instead of doing while ((string line = br.readline) != null) {}. if not, why not?

bufferedreader reader = null; seek { file file = new file("sample-file.dat"); reader = new bufferedreader(new filereader(file)); string line; while ((line = reader.readline()) != null) { system.out.println(line); } } grab (ioexception e) { e.printstacktrace(); } { seek { reader.close(); } grab (ioexception e) { e.printstacktrace(); } }

no, cannot avoid initializing variable. however, can utilize try-with-resources create lot cleaner.

try (bufferedreader reader = new bufferedreader(new filereader("sample-file.dat"))) { string line; while ((line = reader.readline()) != null) { system.out.println(line); } } grab (ioexception e) { e.printstacktrace(); }

java

AngularJS: Access factory from within decorator -



AngularJS: Access factory from within decorator -

i extending 3rd party directive using decorator. access 1 of factories within decorator. how can this?

$provide.decorator( 'multiselectdirective', function( $delegate ) { var directive = $delegate[0], link = directive.link; // wipe out shitty template directive.template = ''; // create new template! directive.templateurl = 'app/partials/filters.template.html'; // hook compile phase of directive directive.compile = function( ) { // function returned compile new link function homecoming function( $scope, el, attrs ) { // run original link function. link.apply(this, arguments); $scope.filterclicked = function( buttonname, selection ) { handlefilterclick( buttonname, selection, jiradata, greygooseapi ); } } }; homecoming $delegate; });

i figured out. able inject dependencies in next way:

$provide.decorator( 'multiselectdirective', [ '$delegate', 'jiradata', 'greygooseapi', function( $delegate, jiradata, greygooseapi ) { var directive = $delegate[0], link = directive.link; // wipe out shitty template directive.template = ''; // create new template! directive.templateurl = 'app/partials/filters.template.html'; // hook compile phase of directive directive.compile = function( ) { // function returned compile new link function homecoming function( $scope, el, attrs ) { // run original link function. link.apply(this, arguments); $scope.filterclicked = function( buttonname, selection ) { handlefilterclick( buttonname, selection, jiradata, greygooseapi ); } } }; homecoming $delegate; }]); });

angularjs decorator

VHDL Factorial calculator -



VHDL Factorial calculator -

i attempting create 16-bit factorial calculator unsigned binary number. in doing have created info path , state machine

a.) outputs final value of 1 if value input 0

b.) displays , overflow flag if input on 8!

c.) calculates value factorial if value input less 8 , not zero.

the scheme seems fall apart if value input on 3 yet still not overflow. think issue somewhere in test3, update 1, update 2 in state machine. help explain going wrong?

state machine:

library ieee; utilize ieee.std_logic_1164.all; entity fact_16_ctrlv2 port( go : in std_logic; clk : in std_logic; clr : in std_logic; overflow : in std_logic; numeqcnt : in std_logic; factzero : in std_logic; flag: out std_logic; xload : out std_logic; cntmux : out std_logic; cntload : out std_logic; factload : out std_logic; factmux : out std_logic; finalload : out std_logic; finalmuxselect: out std_logic; decimalpoint: out std_logic ); end fact_16_ctrlv2; --}} end of automatically maintained section architecture fact_16_ctrlv2 of fact_16_ctrlv2 type state_type (start, input, test1, test2, test3, update1, update2, update3, done); signal present_state, next_state: state_type; begin sreg: process(clk, clr) begin if clr='1' present_state <= start; elsif clk'event , clk='1' present_state <= next_state; end if; end process; c1: process(present_state, go, overflow, factzero, numeqcnt) begin case present_state when start => if go = '1' next_state <= input; else next_state <= start; end if; when input => next_state <= test1; when test1 => if factzero= '1' next_state <= done; else next_state <= test2; end if; when test2 => if overflow = '1' next_state <= done; else next_state <= update3; end if; when update3 => next_state <= test3; when test3 => if numeqcnt = '1' next_state <= done; else next_state <= update1; end if; when update1 => next_state <= update2; when update2 => next_state <= test3; when done => next_state <= done; when others => null; end case; end process; c2: process(present_state, overflow, numeqcnt, factzero) begin xload<= '0'; flag <= '0'; cntmux <= '0'; cntload<= '0'; factload<='0'; factmux<='0'; finalload <='0'; finalmuxselect<='0'; decimalpoint<='0'; case present_state when input => xload<='1'; --cntmux<='1'; --cntload<='1'; when test2 => if overflow ='1' flag <= '1'; finalmuxselect<='0'; finalload<='1'; factload <='1'; decimalpoint <='1'; end if; when test1 => if factzero ='1' flag <= '1'; finalmuxselect <='1'; finalload <='1'; end if; when update3 => cntmux<='1'; cntload<='1'; factmux<= '1'; factload<= '1'; when test3 => if numeqcnt ='1' finalmuxselect<='0'; --finalload<='1'; factload <='1'; cntload<='1'; factmux<='0'; else end if; when update1 => factmux<='0'; factload<='1'; when update2 => cntmux<='0'; cntload<='1'; --factload<='1'; when done => finalload<='1'; when others => null; end case; end process; end fact_16_ctrlv2;

data path

library ieee; utilize ieee.std_logic_1164.all; entity fact_16_dp port( clr : in std_logic; clk : in std_logic; x : in std_logic_vector(3 downto 0); overflow : out std_logic; finalfact : out std_logic_vector(15 downto 0); cntload, cntmult, factload, factmult, xload, finalload :in std_logic; equalone, numcnt : out std_logic; finalmuxselect, flagin: in std_logic ); end fact_16_dp; --}} end of automatically maintained section architecture fact_16_dp of fact_16_dp -- component declaration of "mult16b(mult16b)" unit defined in -- file: "./../src/multiplier.vhd" component mult16b port( : in std_logic_vector(15 downto 0); b : in std_logic_vector(15 downto 0); p : out std_logic_vector(15 downto 0)); end component; all: mult16b utilize entity work.mult16b(mult16b); -- component declaration of "comp(comp)" unit defined in -- file: "./../src/comparitor.vhd" component comp generic( n : integer := 8); port( x : in std_logic_vector(n-1 downto 0); y : in std_logic_vector(n-1 downto 0); gt : out std_logic; eq : out std_logic; lt : out std_logic); end component; all: comp utilize entity work.comp(comp); -- component declaration of "adder(adder)" unit defined in -- file: "./../src/adder.vhd" component adder generic( n : integer := 8); port( : in std_logic_vector(n-1 downto 0); b : in std_logic_vector(n-1 downto 0); y : out std_logic_vector(n-1 downto 0)); end component; all: adder utilize entity work.adder(adder); -- component declaration of "reg(reg)" unit defined in -- file: "./../src/reg.vhd" component reg generic( n : integer := 8); port( load : in std_logic; clk : in std_logic; clr : in std_logic; d : in std_logic_vector(n-1 downto 0); q : out std_logic_vector(n-1 downto 0)); end component; all: reg utilize entity work.reg(reg); -- component declaration of "mux2g(mux2g)" unit defined in -- file: "./../src/mux21.vhd" component mux2g generic( n : integer); port( : in std_logic_vector(n-1 downto 0); b : in std_logic_vector(n-1 downto 0); s : in std_logic; y : out std_logic_vector(n-1 downto 0)); end component; all: mux2g utilize entity work.mux2g(mux2g); -- component declaration of "mux4g(mux4g)" unit defined in -- file: "./../src/mux4to1.vhd" component mux4g generic( n : integer); port( : in std_logic_vector(n-1 downto 0); b : in std_logic_vector(n-1 downto 0); c : in std_logic_vector(n-1 downto 0); s : in std_logic_vector(1 downto 0); y : out std_logic_vector(n-1 downto 0)); end component; all: mux4g utilize entity work.mux4g(mux4g); --signal cntload, cntmult, numcnt, factload, factmult, xload, numload, equalone, finalload :std_logic; signal adderout, cntregout, cntregin, x2 :std_logic_vector(3 downto 0); signal xin, factregin, factregout, overin, factmout, checkzero, numregout, flag, finalmuxout, cntregoutb :std_logic_vector(15 downto 0); begin x2 <= x; xin <= "000000000000" & x2; --change 4 bit number input 16 bit number cntregoutb <= "000000000000" & cntregout; --change count 4 bit value 16 bit value flag <= "000000000000000" & flagin; cntreg : reg --4-bit counter register generic map( n => 4 ) port map( load => cntload, clk => clk, clr => clr, d => cntregin, --not in drawing q => cntregout ); factreg : reg --16-bit fact register generic map( n => 16 ) port map( load => factload, clk => clk, clr => clr, d => factregin, q => factregout ); --numreg : reg --16-bit num register --generic map( --n => 16 --) --port map( --load => numload, --clk => clk, --clr => clr, --d => xin, --q => numregout --); xreg : reg --4-bit initial x vlaue register generic map( n => 4 ) port map( load => xload, clk => clk, clr => clr, d => x, --x(3:0) q => x2 ); finalreg : reg --16-bit final fact register generic map( n => 16 ) port map( load => finalload, clk => clk, clr => clr, d => finalmuxout, q => finalfact ); cntmux : mux2g --4-bit cnt mux generic map( n => 4 ) port map( b => "0001", --initial value set => adderout, --value after initial run through s => cntmult, y => cntregin --cntregin not in drawing ); factmux : mux2g --16-bit fact mux generic map( n => 16 ) port map( b => "0000000000000001", --initial value set => factmout, --value after initial run through s => factmult, y => factregin ); add1 : adder --increment counter 4-bit generic map( n => 4 ) port map( => cntregout, --add 1 b => "0001", --1 y => adderout --out of adder ); multiplier : mult16b --multiply cnt , fact 16-bit port map( => factregout, b => cntregoutb, --cnt plus 12 zeros 16-bit p => factmout --multiplier out ); greater8 : comp --16-bit check x overflow if greater 8 generic map( n => 16 ) port map( x => xin, --check value 8 y => "0000000000001000", gt => overflow --send overflow flag --eq => eq, --lt => lt ); check0 : comp --16-bit check x not equal 0 generic map( n => 16 ) port map( x => xin, y => "0000000000000000", --gt => gt, eq => equalone --lt => lt ); numeqcnt : comp --16-bit check if num equals cnt generic map( n => 16 ) port map( x => xin, y => cntregoutb, --need 16 bit --gt => gt, eq => numcnt --not in drawing --lt => lt ); finalmux: mux2g generic map( n => 16 ) port map( => factregout, b => flag, s => finalmuxselect, y => finalmuxout ); end fact_16_dp;

connected

------------------------------------------------------------------------------- -- -- title : fact_16 -- design : lab4 -- author : -- company : -- ------------------------------------------------------------------------------- -- -- file : c:\my_designs\lab4\lab4\src\fact_16.vhd -- generated : tue oct 14 16:40:38 2014 -- : interface description file -- : itf2vhdl ver. 1.22 -- ------------------------------------------------------------------------------- -- -- description : -- ------------------------------------------------------------------------------- --{{ section below comment automatically maintained -- , may overwritten --{entity {fact_16} architecture {fact_16}} library ieee; utilize ieee.std_logic_1164.all; entity fact_16 port( go : in std_logic; clk : in std_logic; clr : in std_logic; x : in std_logic_vector(3 downto 0); overflowb : out std_logic; factout : out std_logic_vector(15 downto 0) ); end fact_16; architecture fact_16 of fact_16 -- component declaration of "fact_16_dp(fact_16_dp)" unit defined in -- file: "./../src/fact_16_dp.vhd" component fact_16_dp port( clr : in std_logic; clk : in std_logic; x : in std_logic_vector(3 downto 0); overflow : out std_logic; finalfact : out std_logic_vector(15 downto 0); cntload : in std_logic; cntmult : in std_logic; factload : in std_logic; factmult : in std_logic; xload : in std_logic; finalload : in std_logic; equalone : out std_logic; numcnt : out std_logic; finalmuxselect : in std_logic; flagin : in std_logic); end component; all: fact_16_dp utilize entity work.fact_16_dp(fact_16_dp); -- component declaration of "fact_16_ctrlv2(fact_16_ctrlv2)" unit defined in -- file: "./../src/fact_16_ctrlv2.vhd" component fact_16_ctrlv2 port( go : in std_logic; clk : in std_logic; clr : in std_logic; overflow : in std_logic; numeqcnt : in std_logic; factzero : in std_logic; flag : out std_logic; xload : out std_logic; cntmux : out std_logic; cntload : out std_logic; factload : out std_logic; factmux : out std_logic; finalload : out std_logic; finalmuxselect : out std_logic; decimalpoint : out std_logic); end component; all: fact_16_ctrlv2 utilize entity work.fact_16_ctrlv2(fact_16_ctrlv2); signal overflow, numeqcnt, factzero, xload, cntmux, cntload, factload, flag, factmux, numload, finalload: std_logic; signal finalmuxselect: std_logic; begin dpath : fact_16_dp port map( clr => clr, clk => clk, x => x, overflow => overflow, finalfact => factout, cntload => cntload, cntmult => cntmux, factload => factload, factmult => factmux, xload => xload, finalload => finalload, equalone => factzero, numcnt => numeqcnt, finalmuxselect => finalmuxselect, flagin => flag ); cunit : fact_16_ctrlv2 port map( go => go, clk => clk, clr => clr, overflow => overflow, numeqcnt => numeqcnt, factzero => factzero, flag => flag, xload => xload, cntmux => cntmux, cntload => cntload, factload => factload, factmux => factmux, finalload => finalload, finalmuxselect => finalmuxselect, decimalpoint => overflowb ); end fact_16;

vhdl

ruby - Mapping a column of a table to different class using Rails -



ruby - Mapping a column of a table to different class using Rails -

is there way specify different table column?

for example, if there class "a" , class "b":

class has column called col , foreign key class b. class b not have foreign key a.

how can define class col of table maps id of table/class b?

rails belongs_to has foreign_key option:

class < activerecord::base belongs_to :b, :foreign_key => :col end

ruby-on-rails ruby activerecord

c# - Compatibility.... Downgrade a project from vs2012 to vs2008 -



c# - Compatibility.... Downgrade a project from vs2012 to vs2008 -

i have project created on own pc visual studio 2012, initialy entity framework 4.5

i made compatible entity framework 3.5 because computers application run vista ones.. ( o_o )

after lot of debug, creating new db compatible, creating model of new database, performed first downgrade , it's working on computer entity framework 3.5 can see in screenshot: http://imagik.fr/view/128976

i can start .exe on computer without problem. have modified app.config connection string give right path database on computer , have tried, insta crash when works on mine..

finally have installed vs 2008 on 1 vista computer , can't import vs 2012 project, recent. if create new project on 2008 , create classes copy/paste, add together libraries , references, have problem db. database.mdf version 706 , can't upper 655.

i'm lost these compatibilities problems... know can upgrate 2008 project 2012, possible in other way? should solution?

if not, supposed do? told me "free technology", isn't free @ all.....

if met kind of problems..

thanks in advance help.

ps: if need other informations, can give screens, inquire me.

ps°2: know there lot of problems mine on web , on stackoverflow, have done said (edit properties of project , create entityframework 3.5, adding .csproj of 2012 on blank vs 2008 project, etc.)

c# entity-framework visual-studio-2012 visual-studio-2008 compatibility

c++ - Is it possible to inject an enum into a classes scope/namespace? -



c++ - Is it possible to inject an enum into a classes scope/namespace? -

with enum foo::values , class bar outside of foo, can inject values of enum class scope without redefining type?

namespace foo{ enum values{ zero, one, 2 }; } struct bar{ typedef foo::values values; //doesn't work, i'd using foo::values; //or }

so these valid:

foo::values val = bar::zero; assert(std::is_same<foo::values, bar::values>::value);

is possible?

this way:

using values = foo::values;

extracting values possible 1 one:

static constexpr values 0 = foo::zero; static constexpr values 1 = foo::one; static constexpr values 2 = foo::two;

check:

#include <iostream> #include <type_traits> namespace foo { enum values { zero, one, 2 }; } struct bar { using values = foo::values; static constexpr values 0 = foo::zero; static constexpr values 1 = foo::one; static constexpr values 2 = foo::two; }; int main() { foo::values val = bar::zero; std::cout << std::is_same<foo::values, bar::values>::value; }

output:

1

c++ c++11 enums typedef using

html - CSS Menu sideways or Horizontal Dropdown -



html - CSS Menu sideways or Horizontal Dropdown -

i creating menu in css, when hover on languages, open sideways instead of downwards.

right doing:

languages en sp fr

i do:

languages en sp fr

here css deck example of below:

class="snippet-code-css lang-css prettyprint-override">ul.countries { text-align: left; display: inline; margin: 0; padding: 15px 4px 17px 0; list-style: none; -webkit-box-shadow: 0 0 5px rgba(0, 0, 0, 0.15); -moz-box-shadow: 0 0 5px rgba(0, 0, 0, 0.15); box-shadow: 0 0 5px rgba(0, 0, 0, 0.15); } ul li { font: bold 12px/18px sans-serif; display: inline-block; margin-right: -4px; position: relative; padding: 15px 20px; background: #fff; cursor: pointer; -webkit-transition: 0.2s; -moz-transition: 0.2s; -ms-transition: 0.2s; -o-transition: 0.2s; transition: 0.2s; } ul li:hover { background: #555; color: #fff; } ul li ul { padding: 0; top: 48px; left: 0; width: 150px; -webkit-box-shadow: none; -moz-box-shadow: none; box-shadow: none; display: none; opacity: 0; visibility: hidden; -webkit-transiton: opacity 0.2s; -moz-transition: opacity 0.2s; -ms-transition: opacity 0.2s; -o-transition: opacity 0.2s; -transition: opacity 0.2s; } ul li ul li { background: #555; display: inline; color: #fff; text-shadow: 0 -1px 0 #000; } ul li ul li:hover { background: #666; } ul li:hover ul { display: inline; opacity: 1; visibility: visible; } class="snippet-code-html lang-html prettyprint-override"><ul class="countries"> <li> languages <ul> <li>en</li> <li>sp</li> <li>fr</li> </ul> </li> </ul>

you should alter display:block; display:inline , delete position absolute in ul li ul

ul li ul li { .... display: inline; /* changed display:block inline

html css

sdk - Ubuntu qml how to populate list items from data model -



sdk - Ubuntu qml how to populate list items from data model -

i trying implement medications page using ubuntu sdk. trying info sql lite db , populate list when load page. can if utilize row text , buttons, not if seek utilize listitem.

this works:

page: page { id: drugpage component.oncompleted: { var d = drugs.getdrugs(); drugs.filldruglist(d); } column { id: lstdrugs anchors { top: parent.top left: parent.left right: parent.right bottom: parent.bottom margins: units.gu(2) } spacing: units.gu(2) listmodel { id: mdldrugs } component { id: deldrugs row { spacing: units.gu(6) //width: parent.width text { id: txtdrug text: name } text { id: txtdose text: dose //width: units.gu(4) } text { id: txfrequency text: frequency } } } listview { id: viewdrugs model: mdldrugs delegate: deldrugs height: parent.height width: parent.width } } }

but doesn't work:

page: page { id: drugpage component.oncompleted: { var d = drugs.getdrugs(); drugs.filldruglist(d); } column { id: lstdrugs anchors { top: parent.top left: parent.left right: parent.right bottom: parent.bottom margins: units.gu(2) } spacing: units.gu(2) listmodel { id: mdldrugs } listitem.subtitled { id: deldrugs visible: true width: parent.width height: units.gu(5) text: "drug:" + name + " " + dose subtext: "frequency: " + frequency } listview { id: viewdrugs model: mdldrugs delegate: deldrugs height: parent.height width: parent.width } } }

a list item nowadays in ui not populated data.

the error is: referenceerror: name not defined referenceerror: frequency not defined missing here?

i found reply in qml documentation here: http://developer.ubuntu.com/api/qml/sdk-14.04/qtqml.listmodel/ trick wrap listitem in repeater so. listview not required.

listmodel { id: mdldrugs } repeater { model: mdldrugs listitem.subtitled { text: "drug:" + name + " " + dose subtext: "frequency: " + frequency } }

ubuntu sdk qml

java - Partially Filled Array Null Values -



java - Partially Filled Array Null Values -

so i've been brainstorming while now, im on lastly , final step of homework. think im done, it's need help getting rid of these null values:

here's code:

public static char[] readarray(char[] words){ char[] letters = new char[words.length]; letters = myinput(); //get input message ( int = 0 ; < letters.length ; i++) letters[i] = words[i] ; //store message array of words homecoming words; } public static char[] myinput(){ // method take message user string mymessage; system.out.print("input message: "); scanner myin = new scanner(system.in); mymessage = myin.nextline();// read line of message homecoming mymessage.tochararray(); } public static void printoneinline(char[] words){ //for every word, print them in line (int = 0 ; < words.length ; i++){ if (words[i] == ' ') // words separated space creates new line system.out.println(); else system.out.print(words[i]); //print word } }

test case:

input = hello world output = hello world nul nul nul nul ...

i know array partially filled , because of i < words.length scheme tries display values of array 0 - 256. suggestions gladly appreciated. ps: new java

it's time simplify this: rid of readarray method, not add together value on top of myinput, , utilize myinput instead. if in main(), work fine:

char[] words = myinput(); printoneinline(words);

the rest of code fine - no other changes necessary (demo).

the instruction says, method readarray should homecoming number of characters stored in array.

you need alter readarray method follows:

public static int readarray(char[] words){ char[] letters = new char[words.length]; letters = myinput(); //get input message ( int = 0 ; < letters.length ; i++) words[i] = letters[i] ; //store message array of words homecoming letters.length; }

now printoneinline need alter - needs take length on side, , utilize in place of words.length know when stop:

public static void printoneinline(char[] words, int len) { //for every word, print them in line (int = 0 ; < len ; i++){ if (words[i] == ' ') // words separated space creates new line system.out.println(); else system.out.print(words[i]); //print character } }

java null

oracle - PL/SQL Trigger Error -



oracle - PL/SQL Trigger Error -

problem: there 3 roles. 1) pupil 2) teaching assistant(ta) 3) teacher. pupil , ta same person different role. both pupil , teacher have unique id called unity id. various courses in courses table students can enroll in , ta's can assist in. various topics associated each course of study can nowadays in multiple course. topics nowadays in different table. rules: 1) ta cannot assist in course of study in he/she student. 2) notification has sent both teachers taking courses.

requirement: whenever ta enrolled(populated in "ta" table), have send notification teacher if topics of same user ta , student(cid in course_roster table corresponds topics in topics table) overlaps.

so, have created notification table gets populated when trigger fired. have created trigger have messed because doing pl/sql first time.

i attaching sample info ta table, course_roster table, topics table, , layout of notification table

class="snippet-code-html lang-html prettyprint-override">course_roster table cid unityid csc440fall14 tregan csc440fall14 mfiser csc440fall14 jander csc440fall14 mjones csc540fall14 aneela csc540fall14 mjones csc540fall14 jmick csc540fall14 tregan ta table cid unityid csc440fall14 aneela csc440fall14 jmick csc540fall14 jharla csc541fall14 jmoyer topics table cid tid topic name csc440fall14 100 introduction database design csc440fall14 101 sql:queries, constraints,triggers csc540fall14 500 introduction database design csc540fall14 501 storing data: disks , files csc540fall14 502 primary file organizations csc540fall14 503 tree structures csc541fall14 502 primary file organizations csc541fall14 503 tree structures notification table t_unityid text s_unityid timestamp

class="snippet-code-html lang-html prettyprint-override">create or replace trigger tr_ta after insert or update on ta each row begin declare tid1 dbms_sql.number_table; declare tid2 dbms_sql.number_table; declare tid3 dbms_sql.number_table; declare @unityid varchar2; declare @unityid2 varchar2; select @unityid= unityid inserted select @unityid2=unityid courses courses.cid=inserted.cid select tid1=t.tid topics t,course_roster c t.cid=c.cid , c.unityid=unityid select tid2=t.tid topics t,inserted t.cid=inserted.cid tid3 := tid2 multiset intersect tid1; if tid3.count > 0 insert notification (unityid, notice, ta_unityid) values(@unityid2, 'subject topic of ta matching course of study topics taken.',@unityid) else print 'ta ok register' end

there many error in code had no thought code going. appreciate help go me through. in advance.

sql oracle plsql triggers

Counting value based on values in mysql table using Java -



Counting value based on values in mysql table using Java -

i have created programme follows:

i have 22000 authors separated 22000 files. each file contains set of keywords (can 1 or hundreds). illustration author-22945.txt consists of keywords follows:

algorithm problem computational solution general application base of operations

and then, have 100 tables in mysql (topic0 until topic99). each table consists of keywords , value. each topic table contains 20 lines. example:

keywords | value 0.021263 base of operations 0.019618 within 0.014545 new 0.010844 apply 0.010296 process 0.010158 propose 0.009199 provide 0.008239 analysis 0.007005 3 0.006594 approach 0.006183 domain 0.005634 structural 0.004126 adapt 0.003989 aspect 0.003989 product 0.003441 efficient 0.003441 info 0.003167 associate 0.003167 class 0.00303

i tried create programme produce set of value each author taken 100 topics. want average value of author topic0 topic99. if keyword author file exists in topic0, take values , sum it. , on until topic99. therefore, author can have output consists of sum of each topic [t0, t1, t2, ..., t99] illustration [0, 0.3452, 0.2343, .... , 0.08342].

currently programme quiet messy way. when tested 1 author data, worked , produced right number. when input 22000 authors produce output, took more 5 days that. , result wrong when took samples , checked them randomly.

i want inquire right algorithm or tools or logical way produce accurate output , not long compiling time it? fyi, have authors info , keywords each author in mysql table. improve using mysql innerjoin or java in situation?

thank much.

fyi, current messy code follows:

bundle counttopicscore; import java.sql.*; import java.io.*; import java.util.arrays; public class counttopicscore{ public static void main(string[] args) { try{ string mydriver = "org.gjt.mm.mysql.driver"; string myurl = "jdbc:mysql://localhost/arnetminer"; class.forname(mydriver); connection conn = drivermanager.getconnection(myurl, "root", "1234"); string query0 = "select distinct author_key authorkeywords"; statement st0 = conn.createstatement(); resultset rs0 = st0.executequery(query0); while(rs0.next()) { string authorkey = rs0.getstring("author_key"); string query = "select keywords authorkeywords author_key ='"+ authorkey +"'"+";"; statement st = conn.createstatement(); resultset rs = st.executequery(query); double value0, value1, value2, value3, value4, value5, value6, value7, value8, value9, value10, value11, value12, value13, value14, value15, value16, value17, value18, value19, value20, value21, value22, value23, value24, value25, value26, value27, value28, value29, value30, value31, value32, value33, value34, value35, value36, value37, value38, value39, value40, value41, value42, value43, value44, value45, value46, value47, value48, value49, value50, value51, value52, value53, value54, value55, value56, value57, value58, value59, value60, value61, value62, value63, value64, value65, value66, value67, value68, value69, value70, value71, value72, value73, value74, value75, value76, value77, value78, value79, value80, value81, value82, value83, value84, value85, value86, value87, value88, value89, value90, value91, value92, value93, value94, value95, value96, value97, value98, value99; double topic0value = 0.000000, topic1value = 0.000000, topic2value = 0.000000, topic3value = 0.000000, topic4value = 0.000000, topic5value = 0.000000, topic6value = 0.000000, topic7value = 0.000000, topic8value = 0.000000, topic9value = 0.000000, topic10value = 0.000000, topic11value = 0.000000, topic12value = 0.000000, topic13value = 0.000000; double topic14value = 0.000000; double topic15value = 0.000000; double topic16value = 0.000000; double topic17value = 0.000000; double topic18value = 0.000000; double topic19value = 0.000000; double topic20value = 0.000000; double topic21value = 0.000000; double topic22value = 0.000000; double topic23value = 0.000000; double topic24value = 0.000000; double topic25value = 0.000000; double topic26value = 0.000000; double topic27value = 0.000000; double topic28value = 0.000000; double topic29value = 0.000000; double topic30value = 0.000000; double topic31value = 0.000000; double topic32value = 0.000000; double topic33value = 0.000000; double topic34value = 0.000000; double topic35value = 0.000000; double topic36value = 0.000000; double topic37value = 0.000000; double topic38value = 0.000000; double topic39value = 0.000000; double topic40value = 0.000000; double topic41value = 0.000000; double topic42value = 0.000000; double topic43value = 0.000000; double topic44value = 0.000000; double topic45value = 0.000000; double topic46value = 0.000000; double topic47value = 0.000000; double topic48value = 0.000000; double topic49value = 0.000000; double topic50value = 0.000000; double topic51value = 0.000000; double topic52value = 0.000000; double topic53value = 0.000000; double topic54value = 0.000000; double topic55value = 0.000000; double topic56value = 0.000000; double topic57value = 0.000000; double topic58value = 0.000000; double topic59value = 0.000000; double topic60value = 0.000000; double topic61value = 0.000000; double topic62value = 0.000000; double topic63value = 0.000000; double topic64value = 0.000000; double topic65value = 0.000000; double topic66value = 0.000000; double topic67value = 0.000000; double topic68value = 0.000000; double topic69value = 0.000000; double topic70value = 0.000000; double topic71value = 0.000000; double topic72value = 0.000000; double topic73value = 0.000000; double topic74value = 0.000000; double topic75value = 0.000000; double topic76value = 0.000000; double topic77value = 0.000000; double topic78value = 0.000000; double topic79value = 0.000000; double topic80value = 0.000000; double topic81value = 0.000000; double topic82value = 0.000000; double topic83value = 0.000000; double topic84value = 0.000000; double topic85value = 0.000000; double topic86value = 0.000000; double topic87value = 0.000000; double topic88value = 0.000000; double topic89value = 0.000000; double topic90value = 0.000000; double topic91value = 0.000000; double topic92value = 0.000000; double topic93value = 0.000000; double topic94value = 0.000000; double topic95value = 0.000000; double topic96value = 0.000000; double topic97value = 0.000000; double topic98value = 0.000000; double topic99value = 0.000000; while (rs.next()) { string keyword = rs.getstring("keywords"); value0 = findtopic0(keyword); value1 = findtopic1(keyword); value2 = findtopic2(keyword); value3 = findtopic3(keyword); value4 = findtopic4(keyword); value5 = findtopic5(keyword); value6 = findtopic6(keyword); value7 = findtopic7(keyword); value8 = findtopic8(keyword); value9 = findtopic9(keyword); value10 = findtopic10(keyword); value11 = findtopic11(keyword); value12 = findtopic12(keyword); value13 = findtopic13(keyword); value14 = findtopic14(keyword); value15 = findtopic15(keyword); value16 = findtopic16(keyword); value17 = findtopic17(keyword); value18 = findtopic18(keyword); value19 = findtopic19(keyword); value20 = findtopic20(keyword); value21 = findtopic21(keyword); value22 = findtopic22(keyword); value23 = findtopic23(keyword); value24 = findtopic24(keyword); value25 = findtopic25(keyword); value26 = findtopic26(keyword); value27 = findtopic27(keyword); value28 = findtopic28(keyword); value29 = findtopic29(keyword); value30 = findtopic30(keyword); value31 = findtopic31(keyword); value32 = findtopic32(keyword); value33 = findtopic33(keyword); value34 = findtopic34(keyword); value35 = findtopic35(keyword); value36 = findtopic36(keyword); value37 = findtopic37(keyword); value38 = findtopic38(keyword); value39 = findtopic39(keyword); value40 = findtopic40(keyword); value41 = findtopic41(keyword); value42 = findtopic42(keyword); value43 = findtopic43(keyword); value44 = findtopic44(keyword); value45 = findtopic45(keyword); value46 = findtopic46(keyword); value47 = findtopic47(keyword); value48 = findtopic48(keyword); value49 = findtopic49(keyword); value50 = findtopic50(keyword); value51 = findtopic51(keyword); value52 = findtopic52(keyword); value53 = findtopic53(keyword); value54 = findtopic54(keyword); value55 = findtopic55(keyword); value56 = findtopic56(keyword); value57 = findtopic57(keyword); value58 = findtopic58(keyword); value59 = findtopic59(keyword); value60 = findtopic60(keyword); value61 = findtopic61(keyword); value62 = findtopic62(keyword); value63 = findtopic63(keyword); value64 = findtopic64(keyword); value65 = findtopic65(keyword); value66 = findtopic66(keyword); value67 = findtopic67(keyword); value68 = findtopic68(keyword); value69 = findtopic69(keyword); value70 = findtopic70(keyword); value71 = findtopic71(keyword); value72 = findtopic72(keyword); value73 = findtopic73(keyword); value74 = findtopic74(keyword); value75 = findtopic75(keyword); value76 = findtopic76(keyword); value77 = findtopic77(keyword); value78 = findtopic78(keyword); value79 = findtopic79(keyword); value80 = findtopic80(keyword); value81 = findtopic81(keyword); value82 = findtopic82(keyword); value83 = findtopic83(keyword); value84 = findtopic84(keyword); value85 = findtopic85(keyword); value86 = findtopic86(keyword); value87 = findtopic87(keyword); value88 = findtopic88(keyword); value89 = findtopic89(keyword); value90 = findtopic90(keyword); value91 = findtopic91(keyword); value92 = findtopic92(keyword); value93 = findtopic93(keyword); value94 = findtopic94(keyword); value95 = findtopic95(keyword); value96 = findtopic96(keyword); value97 = findtopic97(keyword); value98 = findtopic98(keyword); value99 = findtopic99(keyword); topic0value = topic0value + value0; topic1value = topic1value + value1; topic2value = topic2value + value2; topic3value = topic3value + value3; topic4value = topic4value + value4; topic5value = topic5value + value5; topic6value = topic6value + value6; topic7value = topic7value + value7; topic8value = topic8value + value8; topic9value = topic9value + value9; topic10value = topic10value + value10; topic11value = topic11value + value11; topic12value = topic12value + value12; topic13value = topic13value + value13; topic14value = topic14value + value14; topic15value = topic15value + value15; topic16value = topic16value + value16; topic17value = topic17value + value17; topic18value = topic18value + value18; topic19value = topic19value + value19; topic20value = topic20value + value20; topic21value = topic21value + value21; topic22value = topic22value + value22; topic23value = topic23value + value23; topic24value = topic24value + value24; topic25value = topic25value + value25; topic26value = topic26value + value26; topic27value = topic27value + value27; topic28value = topic28value + value28; topic29value = topic29value + value29; topic30value = topic30value + value30; topic31value = topic31value + value31; topic32value = topic32value + value32; topic33value = topic33value + value33; topic34value = topic34value + value34; topic35value = topic35value + value35; topic36value = topic36value + value36; topic37value = topic37value + value37; topic38value = topic38value + value38; topic39value = topic39value + value39; topic40value = topic40value + value40; topic41value = topic41value + value41; topic42value = topic42value + value42; topic43value = topic43value + value43; topic44value = topic44value + value44; topic45value = topic45value + value45; topic46value = topic46value + value46; topic47value = topic47value + value47; topic48value = topic48value + value48; topic49value = topic49value + value49; topic50value = topic50value + value50; topic51value = topic51value + value51; topic52value = topic52value + value52; topic53value = topic53value + value53; topic54value = topic54value + value54; topic55value = topic55value + value55; topic56value = topic56value + value56; topic57value = topic57value + value57; topic58value = topic58value + value58; topic59value = topic59value + value59; topic60value = topic60value + value60; topic61value = topic61value + value61; topic62value = topic62value + value62; topic63value = topic63value + value63; topic64value = topic64value + value64; topic65value = topic65value + value65; topic66value = topic66value + value66; topic67value = topic67value + value67; topic68value = topic68value + value68; topic69value = topic69value + value69; topic70value = topic70value + value70; topic71value = topic71value + value71; topic72value = topic72value + value72; topic73value = topic73value + value73; topic74value = topic74value + value74; topic75value = topic75value + value75; topic76value = topic76value + value76; topic77value = topic77value + value77; topic78value = topic78value + value78; topic79value = topic79value + value79; topic80value = topic80value + value80; topic81value = topic81value + value81; topic82value = topic82value + value82; topic83value = topic83value + value83; topic84value = topic84value + value84; topic85value = topic85value + value85; topic86value = topic86value + value86; topic87value = topic87value + value87; topic88value = topic88value + value88; topic89value = topic89value + value89; topic90value = topic90value + value90; topic91value = topic91value + value91; topic92value = topic92value + value92; topic93value = topic93value + value93; topic94value = topic94value + value94; topic95value = topic95value + value95; topic96value = topic96value + value96; topic97value = topic97value + value97; topic98value = topic98value + value98; topic99value = topic99value + value99; } st.close(); double[] score = new double[100]; score[0]=topic0value; score[1]=topic1value; score[2]=topic2value; score[3]=topic3value; score[4]=topic4value; score[5]=topic5value; score[6]=topic6value; score[7]=topic7value; score[8]=topic8value; score[9]=topic9value; score[10]=topic10value; score[11]=topic11value; score[12]=topic12value; score[13]=topic13value; score[14]=topic14value; score[15]=topic15value; score[16]=topic16value; score[17]=topic17value; score[18]=topic18value; score[19]=topic19value; score[20]=topic20value; score[21]=topic21value; score[22]=topic22value; score[23]=topic23value; score[24]=topic24value; score[25]=topic25value; score[26]=topic26value; score[27]=topic27value; score[28]=topic28value; score[29]=topic29value; score[30]=topic30value; score[31]=topic31value; score[32]=topic32value; score[33]=topic33value; score[34]=topic34value; score[35]=topic35value; score[36]=topic36value; score[37]=topic37value; score[38]=topic38value; score[39]=topic39value; score[40]=topic40value; score[41]=topic41value; score[42]=topic42value; score[43]=topic43value; score[44]=topic44value; score[45]=topic45value; score[46]=topic46value; score[47]=topic47value; score[48]=topic48value; score[49]=topic49value; score[50]=topic50value; score[51]=topic51value; score[52]=topic52value; score[53]=topic53value; score[54]=topic54value; score[55]=topic55value; score[56]=topic56value; score[57]=topic57value; score[58]=topic58value; score[59]=topic59value; score[60]=topic60value; score[61]=topic61value; score[62]=topic62value; score[63]=topic63value; score[64]=topic64value; score[65]=topic65value; score[66]=topic66value; score[67]=topic67value; score[68]=topic68value; score[69]=topic69value; score[70]=topic70value; score[71]=topic71value; score[72]=topic72value; score[73]=topic73value; score[74]=topic74value; score[75]=topic75value; score[76]=topic76value; score[77]=topic77value; score[78]=topic78value; score[79]=topic79value; score[80]=topic80value; score[81]=topic81value; score[82]=topic82value; score[83]=topic83value; score[84]=topic84value; score[85]=topic85value; score[86]=topic86value; score[87]=topic87value; score[88]=topic88value; score[89]=topic89value; score[90]=topic90value; score[91]=topic91value; score[92]=topic92value; score[93]=topic93value; score[94]=topic94value; score[95]=topic95value; score[96]=topic96value; score[97]=topic97value; score[98]=topic98value; score[99]=topic99value; printwriter pr = new printwriter("e:/scoring/"+authorkey+".txt"); (int j=0; j<100 ; j++) { pr.println(score[j]); } pr.close(); } } grab (exception e){ system.err.println("got exception! "); system.err.println(e.getmessage()); } } private static double findtopic0(string keyword) { double value = 0; try{ string mydriver = "org.gjt.mm.mysql.driver"; string myurl = "jdbc:mysql://localhost/arnetminer"; class.forname(mydriver); connection conn = drivermanager.getconnection(myurl, "root", "1234"); statement st = conn.createstatement(); string querytotopictable = ("select value topic0 word="+"'"+keyword+"'"+";"); resultset valueresult = st.executequery(querytotopictable); while (valueresult.next()) { value = valueresult.getdouble("value"); } st.close(); } grab (exception e){ system.err.println("exception"); system.err.println(e.getmessage()); } homecoming value; } private static double findtopic1(string keyword) { double value = 0; try{ string mydriver = "org.gjt.mm.mysql.driver"; string myurl = "jdbc:mysql://localhost/arnetminer"; class.forname(mydriver); connection conn = drivermanager.getconnection(myurl, "root", "1234"); statement st = conn.createstatement(); string querytotopictable = ("select value topic1 word="+"'"+keyword+"'"+";"); resultset valueresult = st.executequery(querytotopictable); while (valueresult.next()) { value = valueresult.getdouble("value"); } st.close(); } grab (exception e){ system.err.println("exception"); system.err.println(e.getmessage()); } homecoming value; } private static double findtopic2(string keyword) { double value = 0; try{ string mydriver = "org.gjt.mm.mysql.driver"; string myurl = "jdbc:mysql://localhost/arnetminer"; class.forname(mydriver); connection conn = drivermanager.getconnection(myurl, "root", "1234"); statement st = conn.createstatement(); string querytotopictable = ("select value topic2 word="+"'"+keyword+"'"+";"); resultset valueresult = st.executequery(querytotopictable); while (valueresult.next()) { value = valueresult.getdouble("value"); } st.close(); } grab (exception e){ system.err.println("exception"); system.err.println(e.getmessage()); } homecoming value; } private static double findtopic3(string keyword) { double value = 0; try{ string mydriver = "org.gjt.mm.mysql.driver"; string myurl = "jdbc:mysql://localhost/arnetminer"; class.forname(mydriver); connection conn = drivermanager.getconnection(myurl, "root", "1234"); statement st = conn.createstatement(); string querytotopictable = ("select value topic3 word="+"'"+keyword+"'"+";"); resultset valueresult = st.executequery(querytotopictable); while (valueresult.next()) { value = valueresult.getdouble("value"); } st.close(); } grab (exception e){ system.err.println("exception"); system.err.println(e.getmessage()); } homecoming value; } // .... until topic99 }

the best way this, maintain info in database , calculate sql. should think table construction again.

you have 1 table store topic, keyword , value combination (you name values, since topic , keyword might foreign keys other tables later on). have table link authors keywords (e.g. author_keyword).

additional tables might hold info topics (name, ...), keywords , authors , referenced respective primary keys in above tables values , author_keyword. don't need want right now, useful in future.

you should read little bit 'database normalization', sense how setup database structure. can start wikipedia.

if setup table structure, able query database efficiently joining 2 tables, grouping , summing up.

(from understand, got author , author_keyword table. need set topicx tables 1 table.)

your query this:

select author_keyword.author, values.topic, sum(values.value) author_keyword left bring together values on author_keyword.keyword = values.keyword grouping author_keyword.author, values.topic

this should lot more efficient, tried far.

java mysql vector io

uml - Class diagram regarding book exchange app -



uml - Class diagram regarding book exchange app -

can searchbook title of class in class diagram? or need set noun? compulsory names of classes should nouns?

uml not specifiy naming conventions @ all. can take names sense audience understand and/or familiar with.

i think reply question help too.

uml class-diagram

How to keep the splash screen until iOS app finished loading data -



How to keep the splash screen until iOS app finished loading data -

my ios app loads info via restkit on startup. takes time main window shows before info loaded. how show splash screen while loading in progress , show main window when info loaded done? can phone call method or generate event when info loaded.

you should create viewcontroller imageview identically splash screen, , in viewdidload() call

self.presentviewcontroller(splashscreenvc, animated: false, completion: nil)

when info loaded dismiss splashscreenvc

self.dismissviewcontrolleranimated(false, completion: nil)

ios

javascript - Floating and fading text? -



javascript - Floating and fading text? -

i had idea. wonder if it's possible accomplish jquery/css3 1 effect: click on element made appear new text on element/cursor position. text sliding , fading out. button/element doesn't change.

it might little bit hard describe in text set within picture:

http://i.imgur.com/9t60eug.png

it quite usual effect in computer games when purchase don't remember i've ever seen on website.

please, know how called , can find solution? or can give me clues accomplish it? thanks.

edit: changed reply after asker explained better

i see want now. here updated jsfiddle: http://jsfiddle.net/d4qgc/667/ appends text , applies animation using css opacity , top positioning appended text afterwards.

html:

<p><br><br><br></p> <!-- pushing button downwards bit --> <div id="content"> <button id="add">add cart</button> </div>

js:

$(function () { $('#add').on('click', function () { $('<p id="message">+$59.99!</p>').appendto('#content'); }); }); $("#add").click(function() { $("#message").animate({ top: -100, opacity: 0 }, 1000,"linear", function() { $(this).remove(); }) });

css:

#message { position: relative; top: -50px; }

javascript jquery html css

puppet auth.conf allow hostname isn't working -



puppet auth.conf allow hostname isn't working -

i've got puppet master set foreman on (say) node vdc1 has ip 10.200.201.191. i've got puppet agent running on vdc2 ip 10.200.201.192. vdc2 can ping vdc1 using both "vdc1" , ip.

in auth.conf of vdc2, have following:

# added enable puppetrun path /run method save auth allow vdc1 # 1 not stricly necessary, has merit # show default policy deny else path / auth

now if puppet kick vdc1 vdc2 with:

puppet kick vdc2

the request fails. however, if alter first allow in auth.conf to:

allow 10.200.201.191

or

allow *

it runs fine. there need can utilize dns entry puppet master instead of specifying ip?

edit: here's error get:

error: host vdc2 failed: error 403 on server: forbidden request: 10.200.201.191(10.200.201.191) access /run/vdcapp2 [save] @ :2

puppet

javascript - Ajax Fuction not collecting data from URL -



javascript - Ajax Fuction not collecting data from URL -

i using ajax function phone call html page showing next error

options file:///d:/my%20web%20sites/bbbb/flair/demos/url net::err_file_not_found

html code :

<li class="cbp-item graphic"> <div class="cbp-caption"> <div class="cbp-caption-defaultwrap"> <img src="img/gallery/thumb/1.jpg" alt="" /> </div> <div class="cbp-caption-activewrap"> <div class="cbp-l-caption-aligncenter"> <div class="cbp-l-caption-body"> <a href="ajax/project1.html" class="cbp-singlepage cbp-l-caption-buttonleft"><i class="fa fa-link"></i></a> <a href="img/gallery/1big.jpg" class="cbp-lightbox cbp-l-caption-buttonright" data-title="project title"> <i class="fa fa-eye"></i> </a> </div> </div> </div> </div> </li>

js code :

singlepagecallback: function (url, element) { var t = this; $.ajax({ url: 'url', type: 'get', datatype: 'html', timeout: 5000 }) .done(function(result) { t.updatesinglepage(result); }) .fail(function() { t.updatesinglepage("error! please refresh page!"); }); } });

javascript html ajax

javascript - How to display RDF data described by Fresnel vocabulary? -



javascript - How to display RDF data described by Fresnel vocabulary? -

i studying semantic web while trying create simple single page application (spa).

the spa should able display various rdf info (and allow user create new ontologies in user friendly way).

i have total controll of format of ontologies (meaning can state if represented rdf/xml, ntripples, turtle etc. , can decide, if want utilize ontologies describe how info should displayed).

from read in fresnel manual think can way describe "look" of ontologies.

i discovered looks jquery fresnel engine, missing examples on how utilize this.

questions:

how can utilize such engine display info below? is fresnel recommended utilize issue? if not, recommend?

an illustration fresnel manual:

rdf object displayed

:chris rdf:type foaf:person ; foaf:name "chris bizer" ; foaf:mbox <mailto:chris@bizer.de> ; foaf:mbox <mailto:bizer@gmx.de> ; foaf:depiction <http://www.wiwiss.fu-berlin.de/suhl/ueber_uns/team/fotos/chrispassbild.jpg> .

fresnel styling information:

:foafgroup rdf:type fresnel:group ; fresnel:stylesheetlink <http://www.example.org/example.css> ; fresnel:containerstyle "background-color: white;"^^fresnel:stylinginstructions ; :foafpersonformat rdf:type fresnel:format ; fresnel:classformatdomain foaf:person ; fresnel:resourcestyle "background-color: gray;"^^fresnel:stylinginstructions ; fresnel:group :foafgroup . :nameformat rdf:type fresnel:format ; fresnel:propertyformatdomain foaf:name ; fresnel:propertystyle "border-top: solid black;"^^fresnel:stylinginstructions ; fresnel:labelstyle "font-weight: bold;"^^fresnel:stylinginstructions ; fresnel:group :foafgroup . :urlformat rdf:type fresnel:format ; fresnel:propertyformatdomain foaf:homepage ; fresnel:propertyformatdomain foaf:mbox ; fresnel:value fresnel:externallink ; fresnel:propertystyle "border-top: solid black;"^^fresnel:stylinginstructions ; fresnel:labelstyle "font-weight: bold;"^^fresnel:stylinginstructions ; fresnel:group :foafgroup . :depictformat rdf:type fresnel:format ; fresnel:propertyformatdomain foaf:depiction ; fresnel:label fresnel:none ; fresnel:value fresnel:image ; fresnel:propertystyle "border-top: solid black;"^^fresnel:stylinginstructions ; fresnel:group :foafgroup .

how can utilize such engine display info below?

use fsl map nodes dom selectors

is fresnel recommended utilize issue?

it seems linked info platform has subsumed effort.

references

rdf visualization rdfscape ldpjs: linked info platform reference implementation

javascript rdf semantic-web fresnel

docusignapi - API to display filled in tags in PNG format -



docusignapi - API to display filled in tags in PNG format -

we looking way have functionality similar next api method returns requested page in png format (non editable format):

https://www.docusign.com/p/restapiguide/restapiguide.htm#rest api references/get page image.htm

but ability display values custom, etc. tags have been filled in. currently, no tags or values displayed regardless of whether have been filled in.

does know way this?

i don't believe can bring tab values page image when envelope still in process, think completed envelopes show info.

you'll have create separate api phone call retrieve recipient entered tab values. have @ get envelope recipient status api call, , more importantly, it's 1 optional parameter. details of phone call are:

url: /accounts/{accountid}/envelopes/{envelopeid}/recipients

http method: get

parameters: the required parameter envelope id. if optional query include_tabs set true, tabs associated recipient returned. if optional query include_extended set true, extended properties returned.

docusignapi

c# - Look at decompiled source and ran across byte* -



c# - Look at decompiled source and ran across byte* -

what in world byte*?

example code:

byte* numpointer = (byte*)0; byte* numpointer1 = (byte*)0; uint* numpointer2 = (uint*)0;

a byte * (same thing byte*) pointer byte variable. never utilize pointers in c#, why have never seen before.

more specifically, pointer variable holds memory location of variable.

regardless, don't worry unless planning go c++ or native language.

see msdn more info.

c# .net

javascript - trigger visibility of sublist on class change -



javascript - trigger visibility of sublist on class change -

i've been trying accomplish lastly 2 days, i'm new javascript, maybe i'm not seeing something.

what i'm trying create sidenavigation, highlights current section at. have found jquery plugin charm http://trevordavis.net/blog/jquery-one-page-navigation-plugin/

but working subitems , trigger visibility of subitem, current section active. ul visible if containing list item has class of .current, , if 1 of sublist's list items has class .current.

i have found out, i'd need trigger event on class change. have tried following, has not yet worked.

markup:

<ul id="nav"> <li class="current"><a href="#section-1">section 1</a></li> <li><a href="#section-2">section 2</a></li> <li class="parent"><a href="#section-3">section 3</a> <ul class="sublist"> <li><a href="#subsection-1">subsection 1</a></li> <li><a href="#subsection-2">subsection 2</a></li> <li><a href="#subsection-3">subsection 3</a></li> </ul> </li> </ul>

for jquery have tried this:

$('#nav').on('event', function(){ $('.parent').addclass('current').trigger('visibility'); }); $('.parent').on('visibility', function(){ $('.parent .sublist').addclass('visible'); });

what trying bootrap in documentation. when scrolling down, can see glyphicons, reached section, subitems pop open (available glyphs, how use, examples) http://getbootstrap.com/components/

sass applied navigation far:

.overview{ transition: .3s all; ul{ margin-left: 10px; ul{ max-height: 0; transition: max-height 1s ease-out; overflow: hidden; } } } .current{ > a{ font-weight: $bold; } ul{ max-height: 9999px !important; transition: max-height 1s ease-out; } }

i have been able show sublist if parent set current, kid current, sublist hidden, figured, i'd need javascript

i see :)

what do, (there's multiple way, i'd do) create function checks on scroll if class nearing top of window, if so, add together class relating item in nav bar.

should relatively simple without plugin, along lines of:

var checkside = function(){ $('.container p').each(function(){ var item = $(this).offset().top, $window = $(window), navitem = $('#nav a[data-id="'+$(this).data('id')+'"]'); if ($window.scrolltop() >= item) { if (!navitem.hasclass('current')) { $('#nav .current').removeclass('current'); navitem.addclass('current'); } } }); }; $(window).scroll(function(){ checkside(); });

see http://codepen.io/jhealey5/pen/gjjfi - should able adapt needs.

assuming understood correctly :)

javascript jquery html css

c# - How Automatically Try again after 2 second if not match abul == abul? -



c# - How Automatically Try again after 2 second if not match abul == abul? -

i trying matching abul == abul until not going matching in name list.

if ("abul" == "abul") { work } else { wait 2 sec seek 1 time again }

how possible idea?

c# webbrowser-control

hl7 fhir - Is it possible to make this query in ONE unique query: all observations for every patient with certain condition? -



hl7 fhir - Is it possible to make this query in ONE unique query: all observations for every patient with certain condition? -

we developing statistics module, based on fhir messaging, receives query making statistics grouping of patients attributes age, location, conditions, etc. . example, want create statistics observations in period grouping of patients in area condition.

is possible create 1 query rest api this: observations patients condition? have tried queries chained , compartment features, cannot it.

i appreciate help master of making fhir queries. if not, know can bring together different queries in _named query.

thanks in advance regards

this not presently possible.

we've done chaining :[find conditions subject refers has property]. needs reverse chaining: [find patients status refers has property]

this candidate future version

hl7-fhir