Wednesday, 15 February 2012

smtp - JavaMail network stutter -



smtp - JavaMail network stutter -

i've been looking @ network chatter between sample javamail send , several mail service servers , have found chatter. code sample can found on net too

package example; import java.util.properties; import javax.mail.message; import javax.mail.messagingexception; import javax.mail.session; import javax.mail.transport; import javax.mail.internet.internetaddress; import javax.mail.internet.mimemessage; public class sender { public static void main(string[] args) { properties props = new properties(); //props.put("mail.smtp.host", "localhost"); // local james props.put("mail.smtp.port", "25"); props.put("mail.smtp.from", "misterunsub@localhost"); props.put("mail.smtp.sendpartial", "false"); props.put("mail.smtp.ehlo", "false"); props.put("mail.debug", "true"); session session = session.getinstance(props,null); seek { message message = new mimemessage(session); //message.setfrom(new internetaddress("misterunsub@localhost")); message.addheader("list-unsubscribe", "<mailto:list-manager@localhost?subject=unsubscribe>"); message.setsubject("fancy mail service unsub"); message.settext("dear mail service crawler," + "\n\nno spam email, please!"); message.savechanges(); internetaddress[] alice = internetaddress.parse("alice@localhost"); transport t = session.gettransport("smtp"); t.connect(); t.sendmessage(message, alice); } grab (messagingexception e) { throw new runtimeexception(e); } } }

i've setup james on localhost receive traffic. (note james uses javamail send/forward mail service too, issue related javamail), james delegates sending javamail. , exhibits problem too. sample above sufficient prove see.

the traffic looks in wireshark

>> helo localhost << 250 localhost hello localhost (127.0.0.1 [127.0.0.1]) >> mail service from:<misterunsub@localhost> << 250 2.1.0 sender <misterunsub@localhost> ok >> rcpt to:<alice@localhost> << 250 2.1.5 recipient <alice@localhost> ok >> rset << 250 2.0.0 ok >> rset << 250 2.0.0 ok >> mail service from:<misterunsub@localhost> << 250 2.1.0 sender <misterunsub@localhost> ok >> rcpt to:<alice@localhost> << 250 2.1.5 recipient <alice@localhost> ok >> info << 354 ok send info ending <crlf>.<crlf> >> info >> . << 250 2.6.0 message recieved >> quit << 221 2.0.0 localhost service closing transmission channel

the oddity of communication first 'mail from:', 'rcpt to:', 'rset' , 'rset' rset rset causes bunch of overhead.

does know how avoid this? can confirm behavior?

update issue appears related vpn usage or loopback/localhost communication on windows. linux doesn't have issue @ all. bill shannon suggests anti-virus or firewall, might that. since anti-virus notice traffic.

thanks bill prompt replies.

javamail should not issuing rset in these cases. version of javamail using? debug output javamail show?

smtp javamail network-protocols

c# - Disabling a dynamic button -



c# - Disabling a dynamic button -

hi have little winforms programme develop more. programme has 2 panels panel1 , panel2 these panels populated dynamically form controls. first panel populated combo-boxes , sec grid of buttons. want accomplish able disable right button depending on user selects combobox. each column of grid represent day of week , combobox used disable wanted day selecting list if like.

to statically straight forward, programme expand can handle big database that's why doing dynamically. i'm stuck @ moment want disable right button.

below interface have far:

and code if help:

public form1() { initializecomponent(); } button[] btn = new button[2]; combobox[] cmb = new combobox[1]; private void form1_load(object sender, eventargs e) { placerows(); } public void createcolumns(int s) { (int = 0; < btn.length; ++i) { btn[i] = new button(); btn[i].setbounds(40 * i, s, 35, 35); btn[i].text = convert.tostring(i); panel1.controls.add(btn[i]); } (int = 0; < cmb.length; ++i) { cmb[i] = new combobox(); cmb[i].selectedindexchanged += new eventhandler(cmb_selectedindexchanged); cmb[i].text = "disable"; cmb[i].items.add("monday"); cmb[i].items.add("tuesday"); cmb[i].setbounds(40 * i, s, 70, 70); panel2.controls.add(cmb[i]); } } void cmb_selectedindexchanged(object sender, eventargs e) { combobox sendercmb = (combobox)sender; if (sendercmb.selectedindex == 1) { //messagebox.show("tuesday"); btn[1].enabled = false; } } public void placerows() { (int = 0; < 80; = + 40) { createcolumns(i); } } }

alternative 1

every command has tag property.

you can set tag property of buttons represent column in.

when selection made in combo box, search through all buttons, , enable or disable button based on whether each button's tag property matches selected text in combo box.

alternative 2

create

dictionary<string, list<button>> buttonmap;

where key value representing column ("tuesday") , value list of buttons tag. when creating buttons initially, populate dictionary.

if go alternative 2, you'll have remember selected value of checkbox can re-enable buttons no longer disabled.

if have lots of buttons, may find alternative 2 noticeably faster.

update

here's finish working sample of alternative 1.

public partial class form1 : form { public form1() { initializecomponent(); } const int rows = 2; const int cols = 2; button[,] btn = new button[rows,cols]; combobox[] cmb = new combobox[rows]; private void form1_load(object sender, eventargs e) { placerows(); } private readonly string[] cbtexts = new string[] { "monday", "tuesday" }; public void createcolumns(int rowindex) { int s = rowindex * 40; // original code kept overwriting btn[i] each column. need 2-d array // indexed row , column (int colindex = 0; colindex < cols; colindex++) { btn[rowindex, colindex] = new button(); btn[rowindex, colindex].setbounds(40 * colindex, s, 35, 35); btn[rowindex, colindex].text = convert.tostring(colindex); btn[rowindex, colindex].tag = cbtexts[colindex]; panel1.controls.add(btn[rowindex, colindex]); } cmb[rowindex] = new combobox(); cmb[rowindex].selectedindexchanged += new eventhandler(cmb_selectedindexchanged); cmb[rowindex].text = "disable"; foreach (string cbtext in cbtexts) { cmb[rowindex].items.add(cbtext); } cmb[rowindex].setbounds(40, s, 70, 70); cmb[rowindex].tag = rowindex; // store row index know buttons impact panel2.controls.add(cmb[rowindex]); } void cmb_selectedindexchanged(object sender, eventargs e) { combobox sendercmb = (combobox)sender; int row = (int)sendercmb.tag; (int col = 0; col < cols; col++) { button b = btn[row, col]; // these 3 lines can combined one. broke out // highlight happening. string text = ((string)b.tag); bool match = text == sendercmb.selecteditem.tostring(); b.enabled = match; } } public void placerows() { (int rowindex = 0; rowindex < 2; rowindex++) { createcolumns(rowindex); } } }

c# arrays winforms

objective c - Only first object of NSMutableArray is stored in NSUserDefaults -



objective c - Only first object of NSMutableArray is stored in NSUserDefaults -

i trying store queue of uilocalnotification solve limit problem. used this approach , archive , unarchive object first one.

how archive objects nsmutablearray?

code // init/unarchive queue if (self.queue == nil) { // seek loading stored array nsuserdefaults *currentdefaults = [nsuserdefaults standarduserdefaults]; nsdata *datarepresentingsavedarray = [currentdefaults objectforkey:@"localnotificationqueue"]; if (datarepresentingsavedarray != nil) { nsarray *oldsavedarray = [nskeyedunarchiver unarchiveobjectwithdata:datarepresentingsavedarray]; if (oldsavedarray != nil) { self.queue = [[nsmutablearray alloc] initwitharray:oldsavedarray]; } else { self.queue = [[nsmutablearray alloc] init]; } } else { self.queue = [[nsmutablearray alloc] init]; } } // add together [self.queue addobject:notif]; // store queue [[nsuserdefaults standarduserdefaults] setobject:[nskeyedarchiver archiveddatawithrootobject:self.queue] forkey:@"localnotificationqueue"];

if add together items 1,2,3. restart , load. have 3.

add 1,2,3. restart , load. have 3, 1, 2.

if matters. phonegap/cordova cdvplugin.

after

[[nsuserdefaults standarduserdefaults] setobject:[nskeyedarchiver archiveddatawithrootobject:self.queue] forkey:@"localnotificationqueue"];

you need phone call

[[nsuserdefaults standarduserdefaults] synchronize]

to save user defaults.

objective-c cordova archive

php - How can i pair images in my DB? -



php - How can i pair images in my DB? -

i had hard time giving question title, hope im clear enough. im using php & html mysql database.

see have fellow member site, every new fellow member gets randomly chosen football game player avatar. football game player avatar assigned folder named 'avatars'. 1 time user registered, avatar moved folder named 'used_avatars'. every image named football game player, because want display name of chosen player on users fellow member page.

here's real question: want add together flag representing players nationality on fellow member site. have several brazilian players , 1 brazilian flag. how pair 5 players 1 flag. thinking of naming images "brazil-ronaldo", "brazil-carlos" , in way in php separating country name , match them flag , avatar. create sense? there improve way of doing this? guess need create new table in database keeps record of flag , avatar match?

hope helps:

you need table players containing field nationality id , table nationalities names flags.

this way can select player , bring together nationality via id.

all have save player id in user "profile".

php html mysql database

ruby - Rails: ActionView::Template::Error - undefined method 'comment' -



ruby - Rails: ActionView::Template::Error - undefined method 'comment' -

i have problem rendering form input data. controller looks this:

class adscontroller < applicationcontroller def new @ad = current_user.ads.build() respond_to |format| format.html { render :layout => 'new' }# new.html.erb format.json { render json: @ad } end end end

in view (the relevant parts):

<%= form_for ([@ad.user, @ad]) |f| %> ... <%= f.label 'description' %></div> <%= f.text_area :comment, cols:35, rows:4 %> ... <% end %>

and model:

class advertisement < activerecord::base attr_accessible :title, :url, :comment, :category_id, :layout, :user_id ... end

when render form, error:

actionview::template::error (undefined method `comment' for

)

it's weird, because on localhost it's working, after uploading app heroku getting error.

where problem?

check migrations:

$ heroku run rake db:migrate:status

confirm you've ran migrations. heroku not automatically run migrations when force new code.

run $ heroku run rake db:migrate run them.

ruby-on-rails ruby heroku

c# - How do I save image URL in database? -



c# - How do I save image URL in database? -

i have tried save image url in sql database path.compain() not work , file name saved in database instead of path. can help me?

if (request.files.count > 0) { httppostedfilebase file3 = request.files[2]; if (request.files.count > 2 && file3.contentlength > 0 && (file3.contenttype.toupper().contains("jpeg") || file3.contenttype.toupper().contains("png") || file3.contenttype.toupper().contains("gif"))) { string filename = path.combine(server.mappath("~/advertimages/cars/mercedes"), path.getfilename(file3.filename)); file1.saveas(filename); modelcar.image3url = filename; } }

you can create new fileinfo object filename

fileinfo fi = new fileinfo(filename);

and utilize fi.fullname();

c# asp.net iis

javascript - when is triggered AJAX success? -



javascript - when is triggered AJAX success? -

i want load html document ajax, want show when images in document loded.

$('.about').click(function () { $(".back").load('tour.html', function () { $(".back").show(); }); });

".back" should visible when images in tour.html loaded, when triggered success event??

$(".back").load('tour.html', function (html) { var $imgs = $(html).find('img'); var len = $imgs.length, loaded = 0; $imgs.one('load', function() { loaded++; if (loaded == len) { $(".back").show(); } }) .each(function () { if (this.complete) { $(this).trigger('load'); }); });

this requires @ to the lowest degree 1 <img> in returned html.

javascript jquery ajax

How to remove end of breadcrumb with CSS / jQuery -



How to remove end of breadcrumb with CSS / jQuery -

i tried up, everywhere find question asked, html code much different , didn't apply problem.

we using ready made e-commerce platform, renders out breadcrumbs in next matter:

[jsfiddle][http://jsfiddle.net/fvhjg/1/]

i still need rid of lastly raquo there (after "suljetut" in case.)

i have managed hide origin element , lastly crumb (a link links same page, stupid). ones left actual categories , "home" of course. have remove lastly raquo (last-child) opposed 4th (nth-child) in case. right raquo gets removed everytime, because product 2 categories deep, , 5 categoeries deep , on.

can please guide me in right direction? if it's possible css great, , i'm trying consider jquery lastly alternative if it's not possible css.

ps. cannot alter how html code renders out in way, no classes/ids can inserted (well jquery can of course).

woah, list crazy. there's no need have many lists within lists:

<ul> <li> <a href="#">link 1</a> <span class="breadcrumb">x</span> </li> <li> <a href="#">link 2</a> <span class="breadcrumb">x</span> </li> <li> <a href="#">link 3</a> <span class="breadcrumb">x</span> </li> <li> <a href="#">link 4</a> <span class="breadcrumb">x</span> </li> </ul>

this how you'd remove lastly breadcrumb:

ul li:last-child .breadcrumb { display:none; }

jsfiddle example.

if in illustration there ever going 4 links (no more, no less), can this:

ul > li > ul > li > ul > li > ul > li .breadcrumbseparator { display:none; }

but that's hardly ideal. otherwise jquery you'd have loop through pull deepest breadcrumb , remove (see select deepest kid in jquery).

css breadcrumbs

html - how to show product info after image in bigger zoom levels -



html - how to show product info after image in bigger zoom levels -

in shopping cart details page product image defined using code below. proportions should preserved.

for bigger zoom levels image hides start of text after it.

how render page in zoom levels?

for unknow reason div #productinfo starts @ left side shoult start after image. tried add together display:inline-block every div not have effect. jquery, jquery ui, fancybox , pikachoose used.

html:

<div style="float: left; width: 30%; margin-right: 1%"> <a href="#" class="details-picture"> <img src="/thumb?product=1308318&amp;size=198" alt=""> </a> </div> <div id="productinfo"> <div> cost <span id="price"> 1.73 </span> </div>

css:

.details-picture { background: none repeat scroll 0 0 #ffffff; border: lean ridge #bbbbbb; display: block; float: left; height: 200px; line-height: 200px; margin: 0 20px 15px 0; overflow: hidden; position: relative; text-align: center; width: 198px; } .details-picture img { border-width: 0; height: auto; max-height: 198px; max-width: 198px; vertical-align: middle; width: auto; }

this seems due inline attributes on top-level div. combination of float: left , width: 30% causes issue experiencing.

<div class="productimage"> <a href="#" class="details-picture"> <img src="/thumb?product=1308318&amp;size=198" alt="" /> </a> </div> <div class="productinfo"> <div> cost <span id="price">1.73</span> </div> </div>

jsfiddle

html css jquery-ui internet-explorer shopping-cart

onclick - jQuery click to change CSS -



onclick - jQuery click to change CSS -

i have simple question don't know how accomplish this. know have utilize click() function.

basically, have div id #box1. applied css style overflow:auto there vertical scroll-bar if table length (a long table within #box1) exceeds width of div #box1.

now wanted add together link below div. link should following:

on-click, add together css div #box1 overflow:auto overflow:visible simultaniously, while changes css above, link should alter display new link (the old 1 disappears) alter css overflow:auto when clicked.

you can utilize css method.

$('#mybutton').click(function(event) { event.preventdefault(); $('#box1').css('overflow', function(i, o) { homecoming o == 'auto' ? 'visible' : 'auto'; }) });

and instead of hiding/showing 2 different buttons, can utilize text method:

$('#mybutton').click(function(event) { // ... $(this).text(function(i, text){ homecoming text == 'show' ? 'hide' : 'show'; }) });

http://jsfiddle.net/u6nc8/

jquery onclick

windows xp - Error attempting to install SQL Server 2008 -



windows xp - Error attempting to install SQL Server 2008 -

when seek run setup.exe start installation, next error in windows_xp:

microsoft .net framework cas policy manager has encountered problem , needs close.

this in error signature: appname: caspol.exe appver: 2.0.50727.3053 appstamp:4889dd08 modname: mscorwks.dll modver: 2.0.50727.3607 modstamp:4add5446 fdebug: 0 offset: 000d0494

i have tried removing , reinstalling of .net installations , didn't resolve issue. it's weird, because 1 time tried run setup got 2 application events subsequent tries did not produce more events.

the first event's id 1023:

.net runtime version 2.0.50727.3607 - fatal execution engine error (7a09795e) (80131506)

it might possible uninstallation did not remove objects such registry keys.

this may of utilize cannot verify success rate having not used myself.

http://www.justanswer.com/computer/5gtob-microsoft-net-framework-cas-policy-manager-encountered.html

sql-server-2008-r2 windows-xp

javascript - How to show welcome message only onetime when visit the home page? -



javascript - How to show welcome message only onetime when visit the home page? -

i working rails applications since couple of months. supposed add together feature show welcome message first time when user visits site home page, , not sec time user reloads same page.

how can accomplish using jquery or javascript?

simply set cookie , check it. if utilize 1 of usual jquery cookie plug-ins, set script @ bottom of page:

(function($) { if (!$.cookie("yourcookiename")) { $("selector message").show(); $.cookie("yourcookiename", "x"); } })(jquery);

that looks cookie and, if not found, shows content you've defaulted beingness hidden.

it's not perfect, because user can clear cookies, it's enough.

javascript jquery ruby-on-rails

unix - Copy the highlighted pattern in gvim -



unix - Copy the highlighted pattern in gvim -

lets say, highlighted (matched) text nowadays in brackets using

/(.*)

now, how re-create highlighted text (i.e matching pattern, not entire line) buffer, paste where.

multiple approaches presented in this vim tips wiki page. simplest approach next custom command:

function! copymatches(reg) allow hits = [] %s//\=len(add(hits, submatch(0))) ? submatch(0) : ''/ge allow reg = empty(a:reg) ? '+' : a:reg execute 'let @'.reg.' = join(hits, "\n") . "\n"' endfunction command! -register copymatches phone call copymatches(<q-reg>)

unix vim

java - Integer Factorization -



java - Integer Factorization -

could explain me why algorithm below error-free integer factorization method homecoming non-trivial factor of n. know how weird sounds, designed method 2 years ago , still don't understand mathematical logic behind it, making hard me improve it. it's simple involves add-on , subtraction.

public static long factorx( long n ) { long x=0, y=0; long b = (long)(math.sqrt(n)); long = b*(b+1)-n; if( a==b ) homecoming a; while ( a!= 0 ) { a-= ( 2+2*x++ - y); if( a<0 ) { a+= (x+b+1); y++; } } homecoming ( x+b+1 ); }

it seems above method finds solution iteration diophantine equation:

f(x,y) = - x(x+1) + (x+b+1)y b = floor( sqrt(n) ) , = b(b+1) - n is, when = 0, f(x,y) = 0 , (x+b+1) factor of n. example: n = 8509 b = 92, = 47 f(34,9) = 47 - 34(34+1) + 9(34+92+1) = 0 , x+b+1 = 127 factor of n.

rewriting method:

public static long factorx(long n) { long x=1, y=0, f=1; long b = (long)(math.sqrt(n)); long = b*(b+1)-n; if( a==b ) homecoming a; while( f != 0 ) { f = - x*(x+1) + (x+b+1)*y; if( f < 0 ) y++; x++; } homecoming x+b+1; }

i'd appreciate suggestions on how improve method.

here's list of 10 18-digit random semiprimes:

349752871155505651 = 666524689 x 524741059 in 322 ms 259160452058194903 = 598230151 x 433211953 in 404 ms 339850094323758691 = 764567807 x 444499613 in 1037 ms 244246972999490723 = 606170657 x 402934339 in 560 ms 285622950750261931 = 576888113 x 495109787 in 174 ms 191975635567268981 = 463688299 x 414018719 in 101 ms 207216185150553571 = 628978741 x 329448631 in 1029 ms 224869951114090657 = 675730721 x 332780417 in 1165 ms 315886983148626037 = 590221057 x 535201141 in 110 ms 810807767237895131 = 957028363 x 847213937 in 226 ms 469066333624309021 = 863917189 x 542952889 in 914 ms

ok, used matlab see going here. here result n=100000: increasing x on each iteration, , funny pattern of a variable related remainder n % x+b+1 (as can see in grayness line of plot, a + (n % (x+b+1)) - x = floor(sqrt(n))). thus, i think finding first factor larger sqrt(n) simple iteration, rather obscure criterion decide factor :d (sorry half-answer... have leave, maybe go on later).

here matlab code, in case want test yourself:

clear close n = int64(100000); histx = []; histdiffa = []; histy = []; hista = []; histmod = []; histb = []; x=int64(0); y=int64(0); b = int64(floor(sqrt(double(n)))); = int64(b*(b+1)-n); if( a==b ) factor = a; else while ( ~= 0 ) = - ( 2+2*x - y); histdiffa(end+1) = ( 2+2*x - y); x = x+1; if( a<0 ) = + (x+b+1); y = y+1; end hista(end+1) = a; histb(end+1) = b; histx(end+1) = x; histy(end+1) = y; histmod(end+1) = mod(n,(x+b+1)); end factor = x+b+1; end figure('name', 'values'); hold on plot(hista,'-or') plot(hista+histmod-histx,'--*', 'color', [0.7 0.7 0.7]) plot(histb,'-ob') plot(histx,'-*g') plot(histy,'-*y') legend({'a', 'a+mod(n,x+b+1)-x', 'b', 'x', 'y'}); % 'input', hold off fprintf( 'factor %d \n', factor );

java

jQuery is Commenting out my PHP Code Snippets -



jQuery is Commenting out my PHP Code Snippets -

i'm building code snippet scheme , using jquery display editor. noticed jquery likes comment out inline php code. there way prevent happening:

<textarea id='beep'></textarea>

jquery code:

var code = "<div>why <?php echo 'hello'; ?> there!</div>"; var parsed = $(code).html(); $('#beep').val(parsed);

this see in textarea:

why <?php echo 'hello'; ?> there!

but instead jquery modifies this:

why <!--?php echo 'hello'; ?--> there!

i understand security measure, there way stop happening?

i know can utilize html entities around this, due nature of tool interfere code snippets beingness posted intentionally include html entities.

jsfiddle: http://jsfiddle.net/yb4fd/1/

additional node: answers suggest utilize javascript handle without jquery, need jquery. string contains dom tree i'm using jquery parse.

try this:

var code = "<div>why &lt;?php echo 'hello'; ?&gt; there!</div>";

php jquery code-snippets

php - Padding zeroes to Price -



php - Padding zeroes to Price -

$price = 10.00; list($dollars, $cents) = explode('.', $price); echo $dollars . '.' . $cents;

... works except zeros omitted. 10.00 becomes 10 , 10.10 becomes 10.1

i see there's padding function strings, numbers or floats?

how prepare this?

use sprintf

$digit = sprintf("%02d", $digit);

for more information, refer documentation of sprintf.

php

how to read and delete a Cookie with javascript? -



how to read and delete a Cookie with javascript? -

allcookies contents list of browser cookies. want delete cookies function delcookie(), delete first cookie, , not others cookies. , how update cookie???

<input type="button" value="delete" onclick="delcookie()"> <input type="button" value="update" onclick="modcookie()"> <select multiple id="allcookies" size="5"> <!-- cookies content--> </select><br> function delcookie() { if (confirm('are u sure?')) { var e = document.getelementbyid("allcookies"); var struser = e.options[e.selectedindex].value; document.cookie = encodeuricomponent(struser) + "=deleted; expires=" + new date(0).toutcstring(); } }

it delete first cookie, , not others cookies.

the selectedindex property of <select> element returns index of first selected option. check of them in multiple select, need iterate options collection:

var os = document.getelementbyid("allcookies").options; (var i=0; i<os.length; i++) { if (os[i].selected) { var struser = os[i].value; … } }

and how update cookie???

just overwrite cookie, i.e. utilize same method when creating them.

javascript cookies

javascript - how to load markers if their location is what is displayed on screen using Google maps api or gmaps.js -



javascript - how to load markers if their location is what is displayed on screen using Google maps api or gmaps.js -

i have bunch of markers want add together map dynamically.

i getting markers database json object , placing them on map, when map loads

the map have in div 300px x 300px.

the issue i'm trying solve want load markers on visible part of map.

i know lat , long of each marker question how find area displayed on screen, , maybe lat , long ranges.

if pan map want update can show more markers...

not sure if makes sense :)

any ideas on issue ?

observe bounds_changed-event of map. when fires , may utilize contains-method of bounds of map(returned mapinstance.getbounds() ) filter markers .

javascript google-maps-api-3 maps google-maps-markers area

select - MySQL: Sum and group multiple fields by date + other field -



select - MySQL: Sum and group multiple fields by date + other field -

i have table 3 columns shown below. summarize cost each type (only 0/1/2), , grouping month , year (of date field), using select statement.

+------------+------+-------+ | date | type | cost | +------------+------+-------+ | feb-1-2003 | 0 | 19.40 | | feb-5-2010 | 1 | 28.10 | | mar-3-2011 | 2 | 64.20 | | sep-8-2012 | 0 | 22.60 | | dec-6-2013 | 1 | 13.50 | +------------+------+-------+

the output like:

+----------+------------+------------+------------+ | period | type0 | type1 | type2 | +----------+------------+------------+------------+ | jan 2003 | 123123.12 | 23432.12 | 9873245.12 | | feb 2003 | 123123.12 | 23432.12 | 9873245.12 | | mar 2003 | 123123.12 | 23432.12 | 9873245.12 | etc... +----------+------------+------------+------------+

can help select statement?

mysql not designed pivot queries. it's improve aggregate in other language.. that's not it's impossible, though:

select concat(month(date), ' ', year(date)) period, sum(if(type = 0, cost, 0)) type0, sum(if(type = 1, cost, 0)) type1, sum(if(type = 2, cost, 0)) type2 t1 grouping period

mysql select group

c# - Call aspx page function from user control -



c# - Call aspx page function from user control -

i creating user command html image button.i want phone call aspx page function javascript when click image button.i using web method not working in user control. please help me prepare issue.

ascx file code :

<input type=\"image\" src=\"plan_search/images/buy.png\" onclick='add_plan();return false;' /> function add_plan() { seek { alert('enter'); pagemethods.add_plan_items(onsucceeded, onfailed); } grab (ex) { alert(ex); } }

in aspx page:

[system.web.script.services.scriptmethod()] [system.web.services.webmethod] public static string add_plan_items() { seek { homecoming "welcome world of ajax.net , value passed : "; } grab (exception e1) { throw; } }

c# asp.net

css - Arrange divs inside parent - align right div to top -



css - Arrange divs inside parent - align right div to top -

i have next want right div align top of parent, it's not happening me..

<div id="container"> <div id="center">center</div> <div id="left">left text here...</div> <div id="right"><img src="image.png" width="75" height="75" /></div> </div>

fiddle @ http://jsfiddle.net/w3gcb/

if swap left div right one, right div goes top: fiddle

css html

php - How to display password in textbox in decrypted format? -



php - How to display password in textbox in decrypted format? -

when user visits login page of website, checking cookie, if cookie available in login controls i.e. username , password text box populate values fetched cookie.

now in case, password value getting display in encrypted way.

i want display password value in decrypted way.

for example: **value of username , password in database:** username = 'kalpana'; password = '9ee10d53349b49fda27aec3da519b912' //actual value=kalpana

now in login page, if cookie available, values of username & password controls specified below:

username = kalpana password = 9ee10d53349b49fda27aec3da519b912 (in dots format)

but here in password want show

password = kalpana (in dots format)

can pls tell me how this?

you can't, not hashed string anyway. if could, incredibly bad idea.

most sites persistent logins utilize cookie identify logged in user , allow them skip login process. why don't that?

php cookies encryption

linux - Error in ruby: cannot load such file -- zlib -



linux - Error in ruby: cannot load such file -- zlib -

when seek install rails in ubuntu 12.10 error:

$ gem install rails error: loading command: install (loaderror) cannot load such file -- zlib error: while executing gem ... (nameerror) uninitialized constant gem::commands::installcommand

so removed rvm:

rvm implode sudo rm -rf ~/.rvm

removed script calls in .bashrc , .bash_profile

and checked if they're removed:

env | grep rvm #no output, rvm removed ruby -v #the programme 'ruby' can found in next packages: blabla

i have these via sudo apt-get install:

curl zlib1g-dev zlib1g libssl-dev build-essential openssl libreadline6 libreadline6-dev curl git-core libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison subversion pkg-config

then proceed install scratch

curl -l https://get.rvm.io | bash -s stable --ruby --auto-dotfiles

then run line , restarted terminal regard message:

* start using rvm need run `source /home/adige/.rvm/scripts/rvm` in open shell windows, in rare cases need reopen shell windows.

then rvm pkg install readline completed error:

... error running 'autoreconf -is --force', please read /home/adige/.rvm/log/readline/autoreconf.log ... please note it's required reinstall rubies: rvm reinstall --force

i think it's installed anyway, right? before reinstall rubies, installed zlib of course:

# w/out verify, gives checksum error rvm pkg install zlib --verify-downloads 1

then run rvm reinstall --force , completed error again:

... install of ruby-1.9.3-p374 - #complete making gemset ruby-1.9.3-p374 pristine. error running '' under , please read /home/adige/.rvm/log/ruby-1.9.3-p374/gemset.pristine.log making gemset ruby-1.9.3-p374@global pristine.

gemset.pristine.log

then reinstall ruby zlib support:

rvm reinstall 1.9.3-p374 --with-zlib-dir=$rvm_path/usr

which returned same error , same log completed anyway.

finally tried install rails gem 1 time again cannot load such file -- zlib !

here rvm info

what doing wrong?

you should not install readline / zlib on ubuntu, follow steps:

rvm head rvm pkg remove rvm requirements run forcefulness rvm reinstall 1.9.3-p374

make sure include output of installation process if fails, include mentioned log files

ruby linux rvm

Using groups in OpenRefine regex -



Using groups in OpenRefine regex -

i'm wondering if possible utilize "groups" in regex used in open refine grel syntax. mean, i'd replace dots followed , preceded character same character , dot followed space , character.

something like:

s.replace(/(.{1})\..({1})/,/(1).\s(2)/)

i think found out how deal this. need set $x in string value address xth capture group.

it should this:

s.replace(/.?(#capcure grouping 1).?(#capcure grouping 2).*?/), " text $1 text $2 text")

openrefine

Creating New Variables Conditional on Others [sas] -



Creating New Variables Conditional on Others [sas] -

the original dataset like:

sub month y 1 1 1 1 2 2 1 3 3 1 5 5

what want previous 3 ys based on month each subject, if y missing @ month, new variable . too. , above example, lag1 previous y lastly month, lag2 previous y 2 months ago, lag3 far forth:

sub month y lag1 lag2 lag3 1 1 1 . . . 1 2 2 1 . . 1 3 3 2 1 . 1 5 5 . 3 2

the thing checked out lag , dif function, in case, want on lag depends on month , there gaps between month, can not utilize previous 1 lag1 function.

also need many subjects too. thanks.

sql solution:

data have; input sub month y; datalines; 1 1 1 1 2 2 1 3 3 1 5 5 ;;;; run; proc sql; create table want select h.sub,h.month, h.y, one.y lag1, two.y lag2, three.y lag3 have h left bring together (select * have) 1 on h.sub=one.sub , h.month=one.month+1 left bring together (select * have) 2 on h.sub=two.sub , h.month=two.month+2 left bring together (select * have) 3 on h.sub=three.sub , h.month=three.month+3 ; quit;

obviously gets bit long if want 36 of them, it's not complex @ least. there sorts of other ways this. don't utilize lag, that's going headache , not appropriate anyway. hash table might more efficient , require less coding, if you're familiar concept of hash.

hash solution:

data want; if _n_ = 1 do; declare hash h(dataset:'have(rename=y=ly)'); h.definekey('sub','month'); h.definedata('ly'); h.definedone(); phone call missing(sub,month,ly); end; set have; array lags lag1-lag3; prevmonth = month-1 month-3 -1; if prevmonth le 0 leave; rc=h.find(key:sub,key:prevmonth); if rc=0 lags[month-prevmonth] = ly; phone call missing(ly); end; run;

this pretty simple expand 36 [or whatever] - alter length of array array lags lag1-lag36 , statement do prevmonth=month-1 month-36 -1; work may have arrange things month works here - either creating integer month, or changing loop criteria work month/year or whatnot. don't show how info specified can't help there.

sas

find - Return a part of a fraction in Calc Openoffice. -



find - Return a part of a fraction in Calc Openoffice. -

what have calc openoffice homecoming value of denominator of cell. right or left, i'm constrained position.

is there way me find denominator of cell irrespective of amount of digits in cell?

so have 3 cells, a1, b1, c1. values 1/3; 13/4; 1/1003, respectively want calc homecoming 3; 4; 1003 in cells a2,b2,c2. cells want values formatted text, preserve original fraction form. fractions represent error/total.

is possible? , how go doing this?

thanks lot!

since no-one responded , did not study found reply either:

fraction info in cell a1:

=left(a1;find("/";a1;1)-1) = numerator =mid(a1;find("/";a1;1)+1;9) = denominator

find return openoffice-calc fractions

c# - Download excel file from page via WebApi call -



c# - Download excel file from page via WebApi call -

i'm trying send 9mb .xls file response web api controller method. user click button on page , trigger download via browser.

here's i've got far doesn't work doesn't throw exceptions either.

[acceptverbs("get")] public httpresponsemessage exportxls() { seek { byte[] exceldata = m_toolsservice.exporttoexcelfile(); httpresponsemessage result = new httpresponsemessage(httpstatuscode.ok); var stream = new memorystream(exceldata); result.content = new streamcontent(stream); result.content.headers.contenttype = new mediatypeheadervalue("application/octet-stream"); result.content.headers.contentdisposition = new contentdispositionheadervalue("attachment") { filename = "data.xls" }; homecoming result; } grab (exception ex) { m_logger.errorexception("exception exporting excel file: ", ex); homecoming request.createresponse(httpstatuscode.internalservererror); } }

here coffeescript/javascript jquery ajax phone call button click in interface.

$.ajax( url: route datatype: 'json' type: 'get' success: successcallback error: errorcallback )

now think perhaps datatype wrong , shouldn't json...

i had create couple of little changes work

first: alter method post

[acceptverbs("post")]

second: alter using jquery ajax lib utilize hidden form, here's service function doing hidden form , submitting it.

exportexcel: (successcallback) => if $('#hidden-excel-form').length < 1 $('<form>').attr( method: 'post', id: 'hidden-excel-form', action: 'api/tools/exportxls' ).appendto('body'); $('#hidden-excel-form').bind("submit", successcallback) $('#hidden-excel-form').submit()

hopefully there's improve way time beingness it's working , downloading excel file nicely.

c# asp.net excel asp.net-web-api xls

javascript - Implementing an array intersection with JSON values -



javascript - Implementing an array intersection with JSON values -

i have array containing json objects such

validtags = [{"tag":"tag1"}, {"tag":"tag2"}];

and

items = [{"id":123456, "tag":"tag1"}, {"id":123456, "tag":"tag2"}, {"id":7890, "tag":"tag1"}];

and i'm trying figure out id's have both 'tags' first array.

e.g. output be:

[{"id":123456, "tag":"tag1 tag2"}]

with both matching tags combined 1 string.

any ideas how should going doing this? chatting users in javascript chatroom , suggested array intersection used, i'm not exclusively sure how utilize intended outcome json :(

all answers/help appreciated!

many thanks

here solution using both objects , arrays:

validtags = [{"tag":"tag1"}, {"tag":"tag2"}]; items = [{"id":123456, "tag":"tag1"}, {"id":123456, "tag":"tag2"}, {"id":7890, "tag":"tag1"}]; accumulate = {}; // create utilize of hashing of javascript objects merge tags. items.foreach(function(e) { if(accumulate[e.id] == undefined) accumulate[e.id] = [e.tag]; else accumulate[e.id].push(e.tag); }); // convert object array. field 'tags' still array. var result0 = []; for(var id in accumulate) result0.push({"id": id, tags: accumulate[id]}); var result = result0.filter( // first cross out not contain every tag. function(e) { homecoming validtags.every( function(e1) { homecoming e.tags.indexof(e1.tag) != -1; }); }) // create 'tags' array string. .map(function(e) { homecoming {"id": e.id, "tags": e.tags.join(" ")}; });

javascript arrays json

PHP mysql insert query not working but not giving any error messages -



PHP mysql insert query not working but not giving any error messages -

i have verified post method working using echo display variables, when utilize insert query below not add together row.

do have ideas?

<?php // 1. create db connection $connection = mysql_connect("localhost","root","p@ssword"); if(!$connection){ die("database connection failed: " . mysql_error()); } ?> <?php $menu_name = $_post['menu_name']; $position = $_post['position']; $visible = $_post['visible']; ?> <?php $query = "insert subjects (menu_name, position, visible) values ('{$menu_name}', {$position}, {$visible})"; $result = mysql_query($query, $connection); if ($result){ header("location:staff.php"); exit; } else { echo "<p> there error when creating subject </p>"; "<p>". mysql_error()."</p>" ; }

?>

confusing code o.o!. been long time since code looked this. hard figure out, lol. but, when comes mysql errors - when not providing me error (when debugging looks this) - read line line. echo query, , test mysqladmin or other sql tool. run $query = mysql_query($query) or die(mysql_error()); on same line quick debugging.

notable issues

a) switch mysqli ready future php changes. familiar mysqli if mysql.

you didn't select database. mysql_select_db important it's post info - means, need filter information. allow entering of database using insert, without escaping unsafe characters - you're leaving lot play ;). even, if you're 1 entering info changed bit below. have '{$menu_name}' single quotes, {$position} , {$visible} without single quotes - inconsistent confusing when go months later.

why ('{$menu_name}', {$position}, {$visible}) not ('{$menu_name}', '{$position}', '{$visible}') ? instead.

more organized <? $host = "localhost"; // hostname $user = "root"; // username $pass = "p@ssword"; // password $db = ""; // database name $connection = mysql_connect($host,$user,$pass) or die("database connection failed: ".mysql_error()); $database = mysql_select_db($db,$connection) or die("db selection error: ".mysql_error()); $menu_name = mysql_real_escape_string($_post['menu_name']); $position = mysql_real_escape_string($_post['position']); $visible = mysql_real_escape_string($_post['visible']); $query = "insert `subjects` (`menu_name`, `position`, `visible`) values ('{$menu_name}', '{$position}', '{$visible}')"; $result = mysql_query($query, $connection) or die(mysql_error()); if ($result){ // utilize mysql_insert_id validation auto_increment tables. header("location:staff.php"); exit; } else { echo "<p> there error when creating subject </p> <p>". mysql_error()."</p>" ; } ?>

php mysql forms insert-update

java - How to JUnit test a iterator -



java - How to JUnit test a iterator -

for example, how test:

arraylist<string> list = new arraylist<string>(); list.iterator();

how test "iterator()" method?

thanks.

the few tests can think of are:

test hasnext on empty collection (returns false) test next() on empty collection (throws exception) test hasnext on collection 1 item (returns true, several times) test hasnext/next on collection 1 item: hasnext returns true, next returns item, hasnext returns false, twice test remove on collection: check size 0 after test remove again: exception final test collection several items, create sure iterator goes through each item, in right order (if there one) remove elements collection: collection empty

you can have @ the tests used in openjdk.

java unit-testing testing junit

if statement - How to assign numbers to words in java? -



if statement - How to assign numbers to words in java? -

i have problem lastly part of code. want assign numbers specific words 0 value, though strings first system.out.println correctly, cannot numerical equivalents of strings @ sec system.out.println.any ideas how solve problem?

public static double number; protected void mymethod(httpservletrequest request, httpservletresponse response) { string speech= request.getparameter("speech"); system.out.println("the recognized speech : "+ speech); // there no problem till here. if(speech == "hi") number = 1 ; if(speech== "thanks") number = 2 ; if(speech== "bye") number = 0 ; system.out.println("the number speech : " + number); }

however here dont right numbers 0 each word!

you can't utilize == operator check if 2 strings have same value in java, need utilize .equals() or equalsignorecase() methods instead:

if("hi".equalsignorecase(speech)) { number = 1; } else if("thanks".equalsignorecase(speech)) { number = 2; } else if("bye".equalsignorecase(speech)) { number = 0; } else { number = -1; }

the reason == operator compares references; homecoming true if , if instance stored in variable speech same instance literal string you've created between double quotes ("hi", "thanks", or "bye").

note utilize equalsignorecase() phone call on literal string i'm declaring, rather variable assigned parameter. way, if speech == null, method phone call still valid ("hi" always string), , won't nullpointerexception, , flow go on until else branch.

java if-statement methods numbers assign

spring - Minimizing the impact of session data on memory usage for a webapp -



spring - Minimizing the impact of session data on memory usage for a webapp -

i looking advice on how minimize impact of session info on memory web application.

most of services webapp provide require user signed in. however, i don't want store session of objects' data (website fellow member entities corresponding relationships).

on other hand, if store website fellow member id session, have fetch info database each time need farther information.

i grateful if provide advice or point me best practices.

for information, utilize java/jpa/mysql , spring framework (but guess that's not relevant).

spring session jpa memory-management session-state

authentication - How do I add something to Django's response context after a successful login? -



authentication - How do I add something to Django's response context after a successful login? -

i have django project in have wrapper around standard login view:

from django.contrib.auth import views auth_views myapp.forms import loginform def login(request, *args, **kwargs): """wrapper auth.login.""" kwargs['template_name'] = 'login.html' kwargs['authentication_form'] = loginform auth_view_response = auth_views.login(request, *args, **kwargs) homecoming auth_view_response

this works fine, want add together response context on next page, if login has been successful. i'm not sure how to:

check user has logged in after auth_views.login() called, or add variable show in context of next page.

speaking first question:

check user has logged in after auth_views.login() called, or

inside view function check request.user.is_authenticated()

speaking of sec question, can add together variable in user session , check on next page:

#in view mentioned above if request.user.is_authenticated(): request.session['some_key'] = "some_var" #in view, represents next page foo = request.session.get('some_key',none) #now can add together foo template context

django authentication

c++ - Returning a different data type from function using a template -



c++ - Returning a different data type from function using a template -

i trying create function parse xml , homecoming either std::string or int using templates. have come next code:

template <class t> t queryxml(char *str) { if (typeid(t) == typeid(int)) homecoming evalulate_number(doc); else homecoming evaluate_string(doc); }

...and calling function this:

queryxml<int>("/people/name"); //i int returned queryxml<std::string>("/people/name"); //i string returned

but errors saying cannot convert pugi::string_t{aka std::basic_string<char>} int in return. there improve , cleaner way using templates? give thanks you!

template specialization.

// general form in algorithm utilize string... template <class t> t queryxml(char *str) { homecoming evaluate_string(doc); } // ...and want special behavior when using int template <> int queryxml(char *str) { homecoming evalulate_number(doc); }

c++ function templates return-value

java - where did i go wrong SQLiteConstraintException: error code 19: constraint failed -



java - where did i go wrong SQLiteConstraintException: error code 19: constraint failed -

i know been asked bunch of times, need help here. i'm trying insert info unfortunately came across problem. please help me. here's codes. here's dbadapter.

public class dbadapter { private static final string database_name = "my3db.db"; private static final string database_table = "classes"; private static final string database_table_student = "student"; private static final int database_version = 2; public static final string tag = "dbadapter"; public static final string key_id = "_id"; public static final string key_subject = "subject"; public static final string key_schedule = "schedule"; public static final string key_room = "room"; public static final string key_note = "note"; public static final string stud_id = "_id"; public static final string stud_name = "name"; public static final string stud_course = "course"; public static final string stud_swrk = "swrk"; public static final string stud_assn = "assn"; public static final string stud_proj = "proj"; public static final string stud_exam = "exam"; public static final string stud_classid = "classid_stud"; public static final string view_stud = "view_stud"; private static final string database_create = "create table classes (_id integer primary key autoincrement, " + "subject text not null, schedule text not null, room text not null, note text not null);"; private static final string database_create_student = "create table pupil (_id integer primary key autoincrement, " + "name text not null, course of study text not null, swrk text not null, assn text not null, proj text not null, exam text not null, classid_stud integer, foreign key(classid_stud) references classes(_id))"; private final context context; private databasehelper dbhelper; private sqlitedatabase db; public dbadapter(context ctx) { this.context = ctx; dbhelper = new databasehelper(context); } private static class databasehelper extends sqliteopenhelper { databasehelper(context context) { super(context, database_name, null, database_version); } @override public void oncreate(sqlitedatabase db) { // todo auto-generated method stub // seek { db.execsql(database_create); db.execsql(database_create_student); db.execsql("create trigger fk_studclass_classid " + " before insert "+ " on "+database_table_student+ " each row begin"+ " select case when ((select "+key_id+" "+database_table+" "+key_id+"=new."+stud_classid+" ) null)"+ " raise (abort,'foreign key violation') end;"+ " end;"); db.execsql("create view "+view_stud+ " select "+database_table_student+"."+stud_id+" _id,"+ " "+database_table_student+"."+stud_name+","+ " "+database_table_student+"."+stud_course+","+ " "+database_table_student+"."+stud_swrk+","+ " "+database_table_student+"."+stud_assn+","+ " "+database_table_student+"."+stud_proj+","+ " "+database_table_student+"."+stud_exam+","+ " "+database_table+"."+key_subject+","+ " "+database_table+"."+key_schedule+","+ " "+database_table+"."+key_room+","+ " "+database_table+"."+key_note+""+ " "+database_table_student+" bring together "+database_table+ " on "+database_table_student+"."+stud_classid+" ="+database_table+"."+key_id ); // } grab (sqlexception e) { // e.printstacktrace(); // } } @override public void onopen(sqlitedatabase db) { // todo auto-generated method stub super.onopen(db); if (!db.isreadonly()) { // enable foreign key constraints db.execsql("pragma foreign_keys=on;"); } } @override public void onupgrade(sqlitedatabase db, int oldversion, int newversion) { // todo auto-generated method stub log.w(tag, "upgrading database version" + oldversion + "to" + newversion + ", destroy old data"); db.execsql("drop table if exists classes"); db.execsql("drop table if exists student"); db.execsql("drop trigger if exists class_id_trigger"); db.execsql("drop trigger if exists class_id_trigger22"); db.execsql("drop trigger if exists fk_studclass_classid"); db.execsql("drop view if exists "+view_stud); oncreate(db); } } public void addclass(string subject, string schedule, string room, string note) { contentvalues cv = new contentvalues(); cv.put(key_subject, subject); cv.put(key_schedule, schedule); cv.put(key_room, room); cv.put(key_note, note); db.insert(database_table, key_subject, cv); db.close(); } public void insertsomestudents() { addstudent("james", "come", "yes", "no", "maybe", "probably"); addstudent("joross", "nursing", "bla", "ba", "black", "sheep"); }

here's code activity. it's not done, insert code there. bear it.

public class overview extends activity { spinner spinner; dbadapter db = null; private simplecursoradapter dataadapter; @override protected void oncreate(bundle savedinstancestate) { // todo auto-generated method stub super.oncreate(savedinstancestate); setcontentview(r.layout.overview); db = new dbadapter(this); spinner = (spinner) findviewbyid(r.id.spinner); listview listview = (listview) findviewbyid(r.id.overlist); loadspinnerclassoverview(); db.open(); //db.deleteallstudents(); db.insertsomestudents(); db.open(); displaylistview(); listview.setadapter(dataadapter); db.close(); } private void displaylistview() { cursor cursor = db.getallstudent(); dataadapter = new simplecursoradapter(this, r.layout.overviewlist, cursor, // string[] columns = new string[] { dbadapter.stud_name, dbadapter.stud_course // dbadapter.stud_swrk, // dbadapter.stud_assn, // dbadapter.stud_proj, // dbadapter.stud_exam, }, // int[] = new int[] { r.id.name, r.id.course, // r.id.swrk, // r.id.assn, // r.id.proj, // r.id.exam }); } private void loadspinnerclassoverview() { // database handler dbadapter db = new dbadapter(getapplicationcontext()); // spinner drop downwards elements list<string> listclass = db.getlistclass(); // creating adapter spinner arrayadapter<string> dataadapter = new arrayadapter<string>(this, android.r.layout.simple_spinner_item, listclass); // drop downwards layout style - list view radio button dataadapter .setdropdownviewresource(android.r.layout.simple_spinner_dropdown_item); // attaching info adapter spinner spinner.setadapter(dataadapter); }

logcat

error inserting course=come swrk=yes exam=probably proj=maybe assn=no name=james android.database.sqlite.sqliteconstraintexception: error code 19: constraint failed

java android sqlite

JavaScript Input Based Background Change? -



JavaScript Input Based Background Change? -

my function used work, won't. i'm trying add together if statement when input left blank, returns default background color.

var path = /^([a-fa-f0-9]{6}|[a-fa-f0-9]{3})$/g; function col(obj) { var val = obj.value; if (path.test(val)) { document.body.style.backgroundcolor = '#' + val; } } window.onload = function () { document.getelementbyid('bgcol').onkeyup = function () { col(this); } if (getelementbyid('bgcol'.value = null || ""){ document.body.style.backgroundcolor = '#000000'; } }

//end javascript, begin html below

<input id="bgcol" placeholder="enter hexadecimal color"></input>

you need document.getelementbyid , clean syntax:

if ( document.getelementbyid('bgcol').value == null || document.getelementbyid('bgcol').value == "")

javascript

C++ .NET WebClient freezes GUI -



C++ .NET WebClient freezes GUI -

i made app using webclient class. started freezing gui on first downloadstringasync method call, other downloadstringasync calls going fine. have read topics webclient's freezing, suggestion set webclient->proxy nullptr. , did month ago , helped! but, today has occured webclient->proxy = nullptr line in form's constructor. here performance wizard's report:

as can see, system.net.webclient.downloadstringasync(class system.uri,object) takes best of time (about 5-7 secs). here execute function calls downloadstringasync method:

void execute(string^ method, string^ params, int userdata) { web1->downloadstringasync(gcnew uri("http://<address>" + method + "?" + params + "&access_token=" + token + "&sig=" + md5("/method/" + method + "?" + params + "&access_token=" + token + secret)), userdata); }

maybe know why happening.

c++ .net webclient

java - Substring part of a string -



java - Substring part of a string -

first, want excuse if problem discussed , i'll glad if point me answered question! couldn't find 1 helps me out.

i have extract lastly part after lastly "/" in such string: /test/test2/test3

i have extract "test3". cannot way myself i'm asking help.

in case need isolate other parts of string, easiest way.

string s="a/b/c"; //works "a b c" , "a/b/c/" string[] parts=s.split("/"); system.out.println(parts[parts.length-1]);

java android string

export - SQL Management Studio Exporting Data -



export - SQL Management Studio Exporting Data -

i have mdf database on management studio , export info sql file. exporting info data-source: sql server native client works fine, have no thought saved exported data. help?

you need go in database->tasks->generate scripts.

select options there , able generate finish db in sql script

sql export mdf

recursion - JAVA Recursive Program logic -



recursion - JAVA Recursive Program logic -

public class prod { public static void main(string[] args) { system.out.println(prod(1, 4)); } public static int prod(int m, int n) { if (m == n) { homecoming n; } else { int recurse = prod(m, n-1); int result = n * recurse; homecoming result; } } }

on running above code , 24 ? don't quite understand how?

my doubts: 1. when m =1 , n=4 , phone call prod until m , n become equal 1. output should n , else block should not executed??

someone please help me understand logic.

just run through numbers, need write downwards see behavior (in future, suggest adding lots of prints code check variables , how alter each pass through).

prod(1,4) m=1,n=4 m != n so, recurse = prod(1, 3) prod(1, 3) m=1,n=3 m != n so, recurse = prod(1, 2) prod(1, 2) m=1,n=2 m != n so, recurse = prod(1, 1) prod(1, 1) m=1,n=1 m == n so, homecoming 1 returns prod(1, 2) recurse = 1 result = 2 * 1 homecoming 2 returns prod(1, 3) recurse = 2 result = 3 * 2 homecoming 6 returns prod(1, 4) recurse = 6 result = 4 * 6 homecoming 24

thus, programme prints 24.

sometimes best way figure out programme mechanically go through steps line line, executing them in head (or on paper track things).

java recursion

objective c - How do you replay missed messages when using STOMP to connect to RabbitMQ? -



objective c - How do you replay missed messages when using STOMP to connect to RabbitMQ? -

i've got ios application uses stomp client talk rabbitmq. application loads lot of state during startup, , keeps state in sync receiving updates published on stomp. of course, if loses connection, can no longer sure it's in sync, , hence has re-load big initial blob. kind of network interruption triggers behavior , makes customers sad.

there lot of big-picture ways prepare (and i'm working on them) in meantime, i'm trying utilize persistent queues solve problem. thought server create queue, bind appropriate topics, , start building big startup bundle. when finished, hand off client. client set startup bundle, open subscription queue, , process updates happened while server getting things ready. similarly, if client should become disconnected, can reconnect , resume reading messages finds in queue.

my problem while client receives messages sent after connects, if there messages in queue before connected, not read. likewise, if client becomes disconnected, when reconnects, won't see messages arrived while away.

can suggest how might client able read missing messages?

it turns out happening stomp adapter consuming messages failing deliver them. thus, when client reconnected, wouldn't have messages waiting it.

to prepare problem, changed "ack" setting on subscribe request "client", meaning stomp shouldn't consider message delivered until client sends ack frame. changing client appropriately, messages delivered after client has been away.

objective-c rabbitmq stomp

javascript - Delaying Query ulSlide plugin -



javascript - Delaying Query ulSlide plugin -

so using fantastic jquery ulslide plugin. have delay on animation. .delay() function doesn't seem work when calling plug-in. suggestions?

site: http://www.carlpapworth.com/friday-quiz/#

html:

<ul id="qbox"> <!--q1--> <li class="qcontainer"> <div class="qquestion">question </div> <ul class="qanswers"> <li><a href="#" class=""><h3>answer a</h3></a></li> <li><a href="#" class=""><h3>answer b</h3></a></li> <li><a href="#" class=""><h3>answer c</h3></a></li> </ul> </li> <!--q2--> <li class="qcontainer"> <div class="qquestion">question ii </div> <ul class="qanswers"> <li><a href="#" class=""><h3>answer 1</h3></a></li> <li><a href="#" class=""><h3>answer 2</h3></a></li> <li><a href="#" class=""><h3>answer 3</h3></a></li> </ul> </li> <!--q3--> <li class="qcontainer"> <div class="qquestion">question iii </div> <ul class="qanswers"> <li><a href="#" class=""><h3>answer 1</h3></a></li> <li><a href="#" class=""><h3>answer 2</h3></a></li> <li><a href="#" class=""><h3>answer 3</h3></a></li> </ul> </li> </ul>

custom-js:

$(document).ready(function() { $('#qbox').ulslide({ effect: { type: 'slide', // slide or fade axis: 'x', // x, y distance: 0 // distance between frames }, duration: 2000, autoslide: 0, width: 500, height: 300, mousewheel: false, nextbutton: '.qanswers a', prevbutton: '#e1_prev' }); });

javascript jquery html-lists

How to assign value to public variable in asp.net at runtime? -



How to assign value to public variable in asp.net at runtime? -

public class index inherits system.web.ui.page dim arr(9) integer protected sub page_load(byval sender object, byval e eventargs) handles me.load arr(0) = 23 end sub protected sub bntinsert_click(byval sender object, byval e eventargs) handles bntinsert.click arr(0) = 999 end sub protected sub bntshow_click(byval sender object, byval e eventargs) handles bntshow.click txtid.text = arr(0).tostring end sub end class

the result when click on bntinsert , after bntshow still show value "23" in txtid. please help me!

1: asp.net stateless. 2: check post-back events?

protected sub page_load(byval sender object, byval e eventargs) handles me.load if page.ispostback arr(0) = 23 end if end sub

asp.net

java - How will I be able to printout the captured packets using pcap.loop() with a parameter of Pcap.LOOP_INFINITE into the JTextArea? -



java - How will I be able to printout the captured packets using pcap.loop() with a parameter of Pcap.LOOP_INFINITE into the JTextArea? -

i'm quite new jnetpcap , i'm still finding way around it, i'm trying build packet sniffer project, lately i'm trying printout packet info jtextarea appending info pcap.loop() using, when set first parameter using specific integer value allow 5 pcap.loop() outputs 5 packets had been captured, want continuously capture , output packet until press button stop. syntax below shows packet handler.

pcappackethandler<string> jpackethandler = new pcappackethandler<string>() { public void nextpacket(pcappacket packet, string user) { // system.out.printf included check if code works in non gui fashion system.out.printf("received packet @ %s caplen=%-4d len=%-4d %s\n", new date(packet.getcaptureheader().timestampinmillis()), packet.getcaptureheader().caplen(), // length captured packet.getcaptureheader().wirelen(), // original length user // user supplied object ); date = new date(packet.getcaptureheader().timestampinmillis()); int b = packet.getcaptureheader().caplen(); int c = packet.getcaptureheader().wirelen(); string d = user; pckttextarea.append("received packet @ " + + " caplen=" + integer.tostring(b) + " len=" + integer.tostring(b) + user + "\n" ); pckttextarea.setforeground(color.red); pckttextarea.setfont(font); } };

now bit here pckttextarea utilize append print out info in textarea:

pckttextarea.append("received packet @ " + + " caplen=" + integer.tostring(b) + " len=" + integer.tostring(b) + user + "\n" ); pckttextarea.setforeground(color.red); pckttextarea.setfont(font);

and pcap.loop having problem with, if replace allow 5 printed in jtextarea when set pcap.loop_infinte prints info through console not in gui jtextarea:

int = pcap.loop_infinite; pcap.loop(i , jpackethandler, " "); /*************************************************************************** * lastly thing close pcap handle **************************************************************************/ pcap.close();

is because has finish loop before printing info out in textarea?

i assume run code in thread. utilize swingutilities.invokeandwait phone call pckttextarea.append() code

java swing pcap libpcap jnetpcap

javascript - FB.login popup no longer working on Safari mac? -



javascript - FB.login popup no longer working on Safari mac? -

anyone else no longer getting popups in safari?

here's sample code not work in safari. launched click on link popup blocker shouldn't block it. ideas why does?

online illustration here:

http://users.telenet.be/prullen/fbtest.html

note not run through expected behavior since it's on domain , has wrong app id. thing matters illustration showing of popup.

<script type="text/javascript"> var fbloaded = false; var dorelogin = true; function createaccesstoken(){ if (!fbloaded) { fb.init({ appid : 'xxx', // app id status : true, // check login status cookie : true, // enable cookies allow server access session xfbml : true // parse xfbml }); } fbloaded = true; fb.getloginstatus(function(response) { if (response.status === 'connected') { getextendedaccesstoken(response.authresponse); } else { fb.login(function(response) { if (response.status == 'connected') { if (response.authresponse && response.authresponse.accesstoken) { getextendedaccesstoken(response.authresponse); } else { alert('you cancelled login or did not authorize.'); } } else { alert('to utilize have create access token.'); } }, {scope: 'read_stream'}); } }, true); } function getextendedaccesstoken() { } </script> <p style="text-align:center;"><a href="#" onclick="createaccesstoken();return false;" class="connect">connect facebook</a></p>

can check settings regarding blocking pop-up window? issue: javascript: facebook login not open in safari/ iphone same have, guess.

javascript facebook facebook-graph-api safari

c# - Printing a pictureBox in a MdiChild -



c# - Printing a pictureBox in a MdiChild -

i'm trying print content of picturebox in mdichild. debugging code looks never triggers printpage event. i've used code project: printing content of picturebox

what wrong ?

here code:

private void stampatoolstripmenuitem_click(object sender, eventargs e) { form2 activechild = this.activemdichild form2; picturebox thebox = (picturebox)activechild.picturebox1; dastampare = thebox.image bitmap; printdocument1.originatmargins = true; printdocument1.documentname = "prova"; printdialog1.document = printdocument1; printdialog1.showdialog(); if (printdialog1.showdialog() == dialogresult.ok) { printdocument1.print(); } } private void printdocument1_printpage(object sender, system.drawing.printing.printpageeventargs e) { e.graphics.drawimage(dastampare, 0, 0); }

in form's constructor, seek wiring eventhandler:

public form1() { initializecomponent(); printdocument1.printpage += printdocument1_printpage; }

c# printing picturebox mdichild

c - I want to make accept system call as non blocking. How can i make accept system call as non blocking? -



c - I want to make accept system call as non blocking. How can i make accept system call as non blocking? -

this statement using:

m_stat_arr_nclient_sockfd[nindex]= accept(nserversocket,(struct sockaddr *)&client_address, (socklen_t *)&client_len);

this blocking call, how can create non-blocking?

you'll have utilize fcntl set nserversocket non blocking;

int flags = fcntl(nserversocket, f_getfl, 0); fcntl(nserversocket, f_setfl, flags | o_nonblock);

once you've done that, calls accept() on socket should no longer block.

c linux

javascript - How to pass value js controller to js controller? -



javascript - How to pass value js controller to js controller? -

i'm new of alfresco framework. pass value js controller other js controller. don't know how pass. example: value of grouping name in workflow-form.js sample-module.js.

please give me instructions. advance.

if want pass variables between controllers, should declare variables in model this:

var newvar = document.properties.name; model.newvar = newvar;

javascript alfresco alfresco-share

two element combinations of the elements of a list inside lisp (without duplicates) -



two element combinations of the elements of a list inside lisp (without duplicates) -

from given list in lisp, want 2 element combinations of elements of list without having duplicate combinations ( meaning (a b) = (b a) , 1 should removed)

so illustration if have list (a b c d),

i want ((a b) (a c) (a d) (b c) (b d) (c d))

assuming i'm understanding correctly, i'd utilize mapcar , friends.

(defun pair-with (elem lst) (mapcar (lambda (a) (list elem a)) lst)) (defun unique-pairs (lst) (mapcon (lambda (rest) (pair-with (car rest) (cdr rest))) (remove-duplicates lst)))

that should allow you

cl-user> (unique-pairs (list 1 2 3 4 5)) ((1 2) (1 3) (1 4) (1 5) (2 3) (2 4) (2 5) (3 4) (3 5) (4 5)) cl-user> (unique-pairs (list :a :b :c :a :b :d)) ((:c :a) (:c :b) (:c :d) (:a :b) (:a :d) (:b :d))

if you're not scared of loop, can write sec 1 more as

(defun unique-pairs (lst) (loop (a . rest) on (remove-duplicates lst) append (pair-with rest)))

instead. i'm reasonably sure loops append directive more efficient function of same name.

list lisp common-lisp combinations

javascript - Access to local storage of active page -



javascript - Access to local storage of active page -

i need access local storage of active web-browser tab script globally loaded. possible? if yes, please provide example? p.s. code "window.localstorage[key]" gets info global storage. web-browser: safari, mac os.

thanks

there no such thing "global storage". localstorage shared across tabs have same domain open, that's it.

i'd suggest adding kind of identifier key, info current tab / window:

var currenttabid = parseint(localstorage.tabids || -1) + 1; localstorage.tabids = currenttabid; localstorage['mykey' + currenttabid] = "some data";

javascript osx safari

forms - How do I tell Play Framework 2 and Ebean to save null fields? -



forms - How do I tell Play Framework 2 and Ebean to save null fields? -

i'm using play framework 2 , ebean. when user submits form edit existing object in database, doesn't save null values. guess prevent overwriting fields aren't in form null. how can allow them set fields in form null if need to?

for example, user edits event object. event.date 1/1/13. user sets event.date field in form empty , submits form. inspecting event.date in debugger shows value null. save event. if @ event in database, value still 1/1/13.

edit: seems there method this. problem doesn't work on nested entities. solutions this?

update(object bean,set<string> properties)

null properties in ebean considered unloaded, prevent accidental nulling properties shouldn't nulled, excluded.

because of reverting date (and other fields) null in ebean is... hard :). lastly time when had same thing (revert date) used sec query just... nulling date (after event.update(object o)):

public static result updateevent(){ form<event> eventform = form(event.class).bindfromrequest(); // validation if required... event event = eventform.get(); event.update(event.id); if (eventform.get().date == null){ ebean .createupdate(event.class, "update event set date=null id=:id") .setparameter("id", page.id).execute(); } }

on other hand, if using comparison, filtering events (always selecting newer x), can set date 'old' value, should trick. in case you'll update object once.

private static final date very_old_date = new gregoriancalendar(1, 0, 1).gettime(); public static result updateevent(){ form<event> eventform = form(event.class).bindfromrequest(); event event = eventform.get(); if (eventform.get().date == null){ event.date = very_old_date; } event.update(event.id); }

in case in html form need clear value of form's field (or send every time date 0001-01-01), can done javascript.

forms playframework save playframework-2.0 ebean

javascript - How to move 1 div faster/over a div when the page is scrolled -



javascript - How to move 1 div faster/over a div when the page is scrolled -

i saw effect here. main content section of page moves on , above div when page scrolled.

i tried recreating effect using parallax effect,but in vain.the issue using parallax,i can alter speed of 2 objects within same div only.also apart that,i have set unncessary tags on page create script work.

is there simpler(or working) way accomplish effect?thanks lot

you can css.

#head, #subhead{ position: fixed; height: 80px; width: 100%; display: block; left: 0; top: 0; z-index: 10; /* on top of */ } #subhead{ z-index: 4; /* below */ top: 80px; /* height of top div */ } #content{ position: relative; z-index: 6; /* below top div, above 1 below */ margin-top: 160px; /* height of 2 divs above combined */ }

and create subhead scroll slower:

window.onscroll = function(ev){ var subhead = document.getelementbyid('subhead'), topheight = document.getelementbyid('head').offsetheight; subhead.style.top = (topheight - document.body.scrolltop / 4) + 'px'; };

jquery:

$(window).on('scroll', function(){ $('#subhead').css('top', ($('#head').height() - $('body').scrolltop() / 4)); });

javascript jquery html css scroll

jquery - Zoom in/out in phonegap app for android and ios using javascript -



jquery - Zoom in/out in phonegap app for android and ios using javascript -

i have went through lot of posts regarding , assume works fine when involving native code need in phonegap.

i have built phonegap application apple/android/blackberry. have used javascript/jquery app. there way other next steps enable zoom in/out feature in app?

i tried:

1.declaring on html pages

<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1.5 user-scalable=yes">`

2.declaring in jquery mobileinit

$(document).bind("mobileinit", function(){ $.mobile.metaviewportcontent = "width=device-width, minimum-scale=1, maximum-scale=2"; });

any ideas or help appreciated

javascript jquery cordova zooming pinchzoom

sas - How to compare date values in a macro? -



sas - How to compare date values in a macro? -

here macro i'm running....

%macro controlloop(ds); %global dset nvars nobs; %let dset=&ds; /* open info set passed macro parameter */ %let dsid = %sysfunc(open(&dset)); /* if info set exists, check number of obs ,,,then close info set */ %if &dsid %then %do; %if %sysfunc(attrn(&dsid,nobs))>0 %then %do;; %local dsid cols rctotal ; %let dsid = %sysfunc(open(&ds)); %let cols=%sysfunc(attrn(&dsid, nvars)); %do %while (%sysfunc(fetch(&dsid)) = 0); /* outer loop across rows*/ /*0:success,>0:nosuccess,<0:rowlocked,-1:eof reach*/ %if fmt_start_dt<=&sysdate9 , fmt_end_dt>=sysdate9 %then %do; %do = 1 %to &cols; %local v t; /*to var names , types using varname , vartype functions in next step*/ %let v=%sysfunc(varname(&dsid,&i)); /*gets var names*/ %let t = %sysfunc(vartype(&dsid, &i)); /*gets variable type*/ %let &v = %sysfunc(getvar&t(&dsid, &i));/*to var values using getvarc or getvarn functions based on var info type*/ %end; %createformat(dsn=&dsn, label=&label, start=&start, fmtname=&fmtname, type=&type); %end; %else %put ###*****format expired*****; %end; %end; %else %put ###*****data set &dset has 0 rows in it.*****; %let rc = %sysfunc(close(&dsid)); %end; %else %put ###*****open info set &dset failed - %sysfunc(sysmsg()).*****; %mend controlloop; %controlloop(format_control);

format_control data:

dsn :$12. label :$15. start :$15. fmtname :$8. type :$3. fmt_start_dt :mmddyy. fmt_end_dt :mmddyy.; ssin.prd prd_nm prd_id mealnm 'n' 01/01/2013 12/31/9999 ssin.prd prd_id prd_nm mealid 'c' 01/01/2013 12/31/9999 ssin.fac fac_nm onesrc_fac_id fac1srnm 'n' 01/01/2013 12/31/9999 ssin.fac fac_nm d3_fac_id facd3nm 'n' 01/01/2013 12/31/9999 ssin.fac onesrc_fac_id d3_fac_id facd31sr 'n' 01/01/2013 02/01/2012 oper.wrkgrp wrkgrp_nm wrkgrp_id grpnm 'n' 01/01/2013 12/31/9999

how can compare fmt_start_dt , fmt_end_dt sysdate ? tried %if fmt_start_dt<=&sysdate9 , fmt_end_dt>=sysdate9 %then %do; in code values not picking in loop....any idea??? in advance....

i'm not exclusively sure want, think might work:

%if &fmt_start_dt <= %sysfunc(today()) , &fmt_end_dt >= %sysfunc(today())

your fetch function re-create dataset variables macro variables, need reference them ampersand. also, should utilize today() function rather sysdate9 macro variable.

macros sas sas-macro do-loops

php - GET request not working -



php - GET request not working -

i trying record link click through jquery execute php file nil hapening.

$('#click').click(function(){ $.get("record.php", { id: "a" }, function(data){}); });

link

<a id='click' href='http://some link' target='_blank'>start download</a>

record

<?php include 'db.php'; if (isset($_get['id'])) { mysql_query("insert clicks values ('','','','','')"); }

running php fron file works jquery doesnt

any help please?

try this:

$('#click').click(function(e){ e.preventdefault(); $.get("record.php", { id: "a" }, function(data){}); });

php jquery

containers - Writing c++ without new and delete keyword? Best approach? -



containers - Writing c++ without new and delete keyword? Best approach? -

i'm trying write c++ code without using keywords new , delete.

first, practice or not ?

one of side effects of coding can't rely on nullptrfor empty values.

for instance:

std::array<std::array<fb::block *, panel::y>, panel::x> blocks;

becomes

std::array<std::array<fb::block, panel::y>, panel::x> blocks;

what best way describe empty block ?

i though using this:

class block { private: protected: public: ... static const block empty; }; } const block empty(0, blocktype::tutorial, 0, 0);

what guys think ? approach ?

if want write safe code , simplify memory management, should indeed avoid delete. there no need discard new. best way go allocate object want new , store in smart pointers std::shared_ptr or std::unique_ptr. can compare pointers nullptr. , objects automatically deleted.

some advise replace raw new make_shared , make_unique calls in scenario.

the related question when utilize t& , when utilize t* passing argument function. rule of thumb is: utilize t* whenever input argument can absent, utilize t& ensure input argument provided.

c++ containers

Having special characters in URLs in CodeIgniter -



Having special characters in URLs in CodeIgniter -

i want have urls like

http://www.example.com/(*.)

but codeigniter not allow me that. when seek access urls 404 error (and requested page exists).

i know can set allowed characters in url, thought encoding it. however, if this:

http://www.example.com/<?php echo rawurlencode(string) ?>

or even:

http://www.example.com/<?php echo rawurlencode(rawurlencode(string)) ?>

i still got 404. why that? '%'s allowed characters, why won't work? , can prepare it?

when trying pass urlencoded strings uri generate error if encoded string has /, codeigniter seek parse segment, rendering 404, need utilize query strings.

$string = rawurlencode(string)

http://www.example.com/class/method/?string=$string

then on method

use get

function method() { $this->input->get('string'); }

codeigniter url encoding routing special-characters

registration - Register custom culture in Windows Azure -



registration - Register custom culture in Windows Azure -

i developing asp.net mvc 4 app african market , hoping register custom civilization using steps detailed in next link http://msdn.microsoft.com/en-gb/library/system.globalization.cultureandregioninfobuilder.register(v=vs.110).aspx. of target countries not in pre-installed cultures sounds need register these cultures. problem is, console app doing registration need admin previlidges finish civilization registration. presuming windows azure not allow developers admin command of cloud service environment.

question: best way register custom civilization in windows azure without admin previlidges. apparently there's way on framework 2.0 using cultureandregioninfobuilder.compile method not supported method. there improve solution? don't want have maintain different project solutions each civilization can back upwards different languages.

thanks in advance.

you create startup task runs elevated priviledges, , run application on limited context. service configuration file should this:

<servicedefinition name="mycloudservice" xmlns="http://schemas.microsoft.com/servicehosting/2008/10/servicedefinition" schemaversion="2012-10.1.8"> <webrole name="mywebrole" vmsize="small"> <runtime executioncontext="limited"> </runtime> <startup> <task executioncontext="elevated" commandline="scripts\setupculture.cmd" tasktype="simple"> <environment> <variable name="culture"> <roleinstancevalue xpath="/roleenvironment/currentinstance/configurationsettings/configurationsetting[@name='culture']/@value" /> </variable> </environment> </task> </startup> ... </webrole> </servicedefinition>

note can specify desired civilization in service configuration file. can utilize environment variable "culture" in .cmd file utilize parameter .net executable doing job.

azure registration culture

ios - remove subview of uiwindow? -



ios - remove subview of uiwindow? -

i want remove view uiwindow,so nslog in appdelegate method,it says window's subviews count 2 nslog(@" %d",[[self.window subviews] count]); how can remove subviews window,if remove subviews have tab bar controller continued...

- (void) getusercompleted { nslog(@" %@",[[self.window subviews] objectatindex:0]); nslog(@" %@",[[self.window subviews] objectatindex:1]); }

you can remove single subview using next code.

[subview_name removefromsuperview];

if want remove subviews form view utilize this.

nsarray *subviewarray = [self.window subviews]; (id obj in subviewarray) { [obj removefromsuperview]; }

ios ios5 window calayer subview

c# - selenium webdriver click javascript link -



c# - selenium webdriver click javascript link -

i using selenium-webdriver c# test website. have issue when utilize click() click link, doesn't work. should open new window when clicked. tool in html structure, found there javascript action on link.

the html following:

<span class="new_doc"> <a style="cursor: pointer;" onclick="javascript:popwinnewproject('pc.aspx?page=docnew2tree&j=p2&grp=actv&t=');"> <img title="new doc" src="http://local:8080/res/icon/new-doc.png"/>

what method should utilize click open new window?

c# javascript selenium

cucumber - DatabaseCleaner strategy transaction is not working -



cucumber - DatabaseCleaner strategy transaction is not working -

in env.rb

before databasecleaner.strategy = :transaction end

also created hook in shared_steps.rb

before('@database_cleaner_before') databasecleaner.start end after('@database_cleaner_after') databasecleaner.clean end

in feature file

@database_cleaner_after @database_cleaner_before scenario: can sign new valid "email" , "username" when come in new valid "email" , come in new "username" , come in "password" , click on "sign up" button should see message word "signed up" , "successfully"

i using gem:

capybara 2.0.2 cucumber 1.2.1 database_cleaner 0.9.1 selenium-webdriver 2.30.0 cucumber-rails 1.3.0 rails 3.1.0

in database.rb

require 'active_record' class activerecord::base mattr_accessor :shared_connection @@shared_connection = nil def self.connection @@shared_connection || retrieve_connection end end activerecord::base.shared_connection = activerecord::base.connection

databasecleaner.strategy = :trancation working fine (delete record database) databasecleaner.strategy = :transaction not rolling database record why?. missing somethings?

cucumber capybara database-cleaner

php - Symfony2 TinymceBundle - CTRL-S does not save after update -



php - Symfony2 TinymceBundle - CTRL-S does not save after update -

i'm working on php-web application, wich uses tinymcebundle style textboxes wysiwyg-editors (i took on project, didn't implement feature initially).

appearantly tinymce editor standard has build in feature captures ctrl+s click event , treats form submission (instead of browser trying save current site).

but did update of vendor libraries, including tinymcebundle , ctrl+s save form doesn't work anymore.

this configuration of widget in app/config.yml how found it:

stfalcon_tinymce: include_jquery: true textarea_class: "tinymce" theme: simple: mode: "textareas" theme: "advanced" width: '728' #firefox on windows made wide reason theme_advanced_buttons1: "mylistbox,mysplitbutton,bold,italic,underline,separator,strikethrough,justifyleft,justifycenter,justifyright,justifyfull,bullist,numlist,undo,redo,link,unlink" theme_advanced_buttons2: "" theme_advanced_buttons3: "" theme_advanced_toolbar_location: "top" theme_advanced_toolbar_align: "left" theme_advanced_statusbar_location: "bottom" plugins: "fullscreen" theme_advanced_buttons1_add: "fullscreen" advanced: language: de theme: "advanced" plugins: "pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,noneditable,visualchars,nonbreaking,xhtmlxtras,template" theme_advanced_buttons1: "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,formatselect,fontselect,fontsizeselect" theme_advanced_buttons2: "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,cleanup,code,|,insertdate,inserttime,preview,|,forecolor,backcolor" theme_advanced_buttons3: "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,|,ltr,rtl,|,fullscreen" theme_advanced_buttons4: "moveforward,movebackward,|,scite,del,ins,|,visualchars,nonbreaking,pagebreak" theme_advanced_toolbar_location: "top" theme_advanced_toolbar_align: "left" theme_advanced_statusbar_location: "bottom" theme_advanced_resizing: true

for can see, there nil enabling ctrl+s save functionality, assumed enabled default, need enable 1 time again (as client missing since update) , didn't find config alternative @ tinymce documentation.

staying old version not option.

does know how enable ctrl+s = form submit functionality hand or did experience behaviour after update of tinymcebundle (if it's bug of tinymce can't much guess)?

thanks in advance!

edit: th next code used in application render editor - unfortunately of js-initialization encapsulated in tinymcebundle, tinymce.init( ... ) phone call - whole configuration supposed work on entries in app/config.ym.

the noticetype class has text field:

class noticetype extends abstracttype { public function buildform(formbuilder $builder, array $options) { $builder ->add('contact') ->add('user') ->add('direction', 'choice', array( 'choices' => array('out' => 'ausgehend', 'in' => 'eingehend', ), 'required' => true, )) ->add('text', 'textarea', array( 'attr' => array('class' => 'tinymce'), )) ->add('customer') ->add('date', 'datetime', array( 'input' => 'datetime', // 'date_format' => \intldateformatter::full, 'widget' => 'single_text', )) ; } public function getname() { homecoming 'evenos_enoticebundle_noticetype'; } }

in template form rendered:

{% extends 'evenosenoticebundle::base.html.twig' %} {% block body %} <h1>neue notiz</h1> {{ tinymce_init() }} <form action="{{ path('notice_create') }}" method="post" {{ form_enctype(form) }}> [...other fields...] {{ form_label(form.text, 'text') }} {{ form_widget(form.text, { 'attr': {'cols': '100', 'rows': 20} }) }} [...] <p> <button type="submit" class="btncreate">anlegen</button> </p> </form> [...] {% endblock %}

updated question: know how can configure tinymce specifically using stfalcon/tinymcebundle symfony2?. grasp it, es meant configured through symfony .yml files, don't allow add together e.g. functions

setup: function (ed) { ... }

configuration tinymce

you implement advised here similar problem.

edit: here first-class tutorial symfone/tinymce. in section "override render method" insert setup configuration parameter follows

tinymce.init({ ... setup : function(ed) { ed.onkeydown.add(function onkeydown(ed, evt) { // shortcut: ctrl+h if (evt.keycode == 72 && !evt.altkey && !evt.shiftkey && evt.ctrlkey && !evt.metakey) { settimeout(function(){ var e = { type : 'keydown'}; e.charcode = e.keycode = e.which = 72; e.shiftkey = e.altkey = e.metakey = false; e.ctrlkey = true; window.parent && window.parent.receiveshortcutevent && window.parent.receiveshortcutevent(e); }, 1); } }); }, });

now insert script tag containing javascript function receive_shortcutevents in template.

php symfony2 tinymce