Sunday, 15 February 2015

c# - Trying to create a dropdown list and textbox, setting list item as data and text box as value - asp.net mvc 4 -



c# - Trying to create a dropdown list and textbox, setting list item as data and text box as value - asp.net mvc 4 -

i trying create search form searches based on server name or printer name. here snippet controller:

list<selectlistitem> items = new list<selectlistitem>(); items.add(new selectlistitem { text = "server name", value = "servername" }); items.add(new selectlistitem { text = "printer name", value = "printername" }); viewdata["newlist"] = items;

here view (which know wrong because doesn't work):

@using (html.beginform("search", "printqueues", formmethod.get)) { <fieldset> <legend> search </legend> @html.dropdownlist("newlist",viewdata["newlist"] selectlist) @html.textbox("newlist") <p> <input type="submit" value="submit" /> </p> </fieldset> }

if pick "server name" , set in value (such "myservernaem" textbox, want url show:

/search?servername=myservername

i'm pretty sure both controller , view incorrect.

not huge fan of approach... http works sending value each input controller. values receive in controller, should able homecoming appropriate page , information.

so if re-named drop downwards list searchtype , textbox searchcriteria you'd have nice query string like: /search?searchtype=printer&searchcriteria=epson. in controller should able receive these , homecoming appropriate page (whether printer or server).

public actionresult search(string searchtype, string searchcriteria) { if(searchtype == "printername") { // search printers using searchcriteria , homecoming appropriate view } else if(searchtype == "servername") { // search servers using searchcriteria , homecoming appropriate view } }

if go approach create enum called searchtype , utilize instead of string, allow do: if(searchtype == searchtype.printer) ...

if want go approach, values inputs when seek search , append url:

@html.dropdownlist("searchtype",viewdata["newlist"] selectlist) @html.textbox("searchcriteria") <button type="button" onclick="gotosearch();">search</button> function search() { // assumption of jquery (use document.getelementbyid otherwise...) var type = $('#searchtype').val(); var searchcriteria = $('#searchcriteria').val(); window.location = '@url.action("search", "printqueues")' + '?' + type + '=' + searchcriteria; }

happy reply questions.

c# asp.net razor asp.net-mvc-4

MATLAB - Using fm demod to decode data -



MATLAB - Using fm demod to decode data -

i trying extract sinusoid has speed changes sinusiodially. form of approximately sin (a(sin(b*t))), a+b constant.

this i'm trying, doesnt give me nice sin graph hope for.

fs = 100; % sampling rate of signal fc = 2*pi; % carrier frequency t = [0:(20*(fs-1))]'/fs; % sampling times s1 = sin(11*sin(t)); % channel 1, generates signal x = [s1]; dev = 50; % frequency deviation in modulated signal z = fmdemod(x,fc,fs,fm); % demodulate both channels. plot(z);

thank help.

there bug in code, instead of:

z = fmdemod(x,fc,fs,fm);

you should have:

z = fmdemod(x,fc,fs,dev);

also see nice sine graph need plot s1.

it looks not creating fm signal modulated correctly, can not demodulate correctly using fmdemod. here illustration correctly:

fs = 8000; % sampling rate of signal fc = 3000; % carrier frequency t = [0:fs]'/fs; % sampling times s1 = sin(2*pi*300*t)+2*sin(2*pi*600*t); % channel 1 s2 = sin(2*pi*150*t)+2*sin(2*pi*900*t); % channel 2 x = [s1,s2]; % two-channel signal dev = 50; % frequency deviation in modulated signal y = fmmod(x,fc,fs,dev); % modulate both channels. z = fmdemod(y,fc,fs,dev); % demodulate both channels.

if find thr answers useful can both up-vote them , take them, thanks.

matlab

ios - How to edit the contents while http Post? -



ios - How to edit the contents while http Post? -

hi friends im getting info ie html contents next code..

-(void)connection:(nsurlconnection *)connection didreceivedata:(nsdata *)data { [receiveddata appenddata:data]; nsstring *htmlstr = [[nsstring alloc] initwithdata:self.receiveddata encoding:nsutf8stringencoding]; nslog(@"%@" , htmlstr); }

if want edit of contents in html page , want post it, how can that?

eg: if im using gmail account, , when html contents of gmail, want come in mail-id , password in html page (without using pre-defined ui) , want post contents.. when click on gmail in alternative should straight log-in without showing log-in page..

can , if yes how in objective c.?

- (void)connection:(nsurlconnection *)connection didreceivedata:(nsdata *)data

method gets called multiple times while web service returning response, improve alter info into:

- (void)connectiondidfinishloading:(nsurlconnection *)connection

you can following:

- (void)connectiondidfinishloading:(nsurlconnection *)connection { nsstring *htmlstr = [[nsstring alloc] initwithdata:self.receiveddata encoding:nsutf8stringencoding]; nsmutablestring *strtobechanged = [nsmutablestring stringwithstring:htmlstr]; // perform changes strtobechanged. }

hope makes sense you.

ios ios5 ios6 ios4 ios-simulator

javascript - Is there any QUnit assertion/function who test whether element in array or not -



javascript - Is there any QUnit assertion/function who test whether element in array or not -

i have array of expected output in qunit function.now want test result of function in array or not.

var =new array('abc','cde','efg','mgh');

now question is there qunit assertion/function can me ??

i know js coding create method check wanna spefic ounit !!!!

if have javascript 1.6 can utilize array.indexof

test("myfunction expected value", function() { var expectedvalues = ['abc','cde','efg','mgh']; ok(expectedvalues.indexof(myfunction()) !== -1, 'myfunction() should homecoming expected value'); });

if want can extend qunit back upwards these kind of assertions:

qunit.extend(qunit, { inarray: function (actual, expectedvalues, message) { ok(expectedvalues.indexof(actual) !== -1, message); } });

then can utilize custom inarray() method in tests:

test("myfunction expected value", function() { var expectedvalues = ['abc','cde','efg','mgh']; qunit.inarray(myfunction(), expectedvalues, 'myfunction() should homecoming expected value'); });

i created a jsfiddle show both options.

javascript unit-testing qunit

jquery - How do i limit the 'click' area? -



jquery - How do i limit the 'click' area? -

i've got construction accordion. got 'work' divs, did hide pictures inside, , want them work gallery.

so when click on 'work' div, div animates , height expands , gallery appears.

but wherever click closes 'work' div again. want is, limit click area , prevent close 'work' users can navigate through images.

i hope made myself clear.

here's image url, see, work images underneath open work, when click on image, closes up. arranged 'gallery' div's z-index 9999 still click called 'work'

http://cl.ly/image/2y3v052t0u43

thanks in advance, cheers, met.

create div.title within work div , bind click event .title. enclose gallery in div.gallery , hide default.

working fiddle

jquery html css interaction

Prevent PHP Interpreting New Lines in Strings in the Source Code -



Prevent PHP Interpreting New Lines in Strings in the Source Code -

i have assign big strings variables. in source code preferably want maintain lines within 80 characters.

ideally want able lay these literal strings out on multiple lines.

what want avoid using concatenation, or function calls (e.g. preg_replace()), bring together multiple strings in one. don't thought have invoke language features in order improve style of code.

example of like:

$text = <<<text line 1 line 2 line 3 text; echo($text);

this should output:

line1line2line3

is possible?

there few options:

just concatenate (preferred)

use array constructs

use sprintf()

just concatenate:

echo 'long long line1' . 'another long line 2' . 'the lastly long line 3';

what efficiency?

the above code compiles next opcodes (which what's run):

5 0 > concat ~0 'long+long+line1', 'another+long+line+2' 1 concat ~1 ~0, 'the+last+very+long+line+3' 2 echo ~1

as can see, builds string concatenating first 2 lines, followed lastly line; in end ~0 discarded. in terms of memory, difference negligible.

this single echo statement like:

3 0 > echo 'long+long+line1another+long+line+2the+last+very+long+line+3'

technically it's faster because there no intermediate steps, in reality won't sense difference @ all.

using array:

echo join('', array( 'line 1', 'line 2', 'line 3', ));

using sprintf():

echo sprintf('%s%s%s', 'line 1', 'line 2', 'line 3' );

php string coding-style string-formatting code-formatting

Kendo UI Mobile - CSS attribute resets on view transition when removed in JQuery -



Kendo UI Mobile - CSS attribute resets on view transition when removed in JQuery -

currently handling flicker of unstyled content of kendo mobile web app applying next css rule within css file:

[data-role="content"] { visibility: hidden; }

this hides of content within kendo views, in jquery "load" event, remove above css attribute:

$(window).bind("load", function () { // flicker of unstyled content $("[data-role=\"content\"]").css("visibility", "visible"); });

all has worked fine , haven't had issues this, except when using kendo's view transitions.

when utilize slide:left transition, original visibility: hidden; defined in css file re-applied, causing invisible.

is there reason why happening, specifically, kendo , how handles views , transitions? understand manually add together class visibility: hidden; each data-role="content" element, , remove class in jquery's "load" event handler, wanted solution bit less "hardcoded."

thank you.

the data-role=content attributes set when view initialised - load event handler won't impact views (unless have data-role=content set manually).

you may consider hiding application container instead.

jquery css kendo-ui