Saturday, 15 May 2010

how to create sectionised listview like instagram in android -



how to create sectionised listview like instagram in android -

i have searched lot create sections in listview instagram

edit profile edit find friend search ------------------------------ friend request ------------------------------ kumar take sheila take ------------------------------ ------------------------------

i have below examples:

example 1

example 2

i haven't found want. have been through many blogs , github repository, until haven't gotten exact method. thankful if help me.

you should read sectionindexer.

this helpful:

android: how utilize sectionindexer

http://bartinger.at/listview-with-sectionsseparators/

android android-listview

javascript - Independent button -



javascript - Independent button -

i have javascript code creates buttons onload attributes beingness values asp page fetches database. whatever event want each button do, other buttons , executes before buttons displayed. please help...

function createbuttons(tbid, tbclass, tbtype, tbvalue, onclick) { homecoming '\n<input' + (tbid ? ' id=\'' + tbid + '\'' : '') + (tbclass ? ' class=\'' + tbclass + '\'' : '') + (tbtype ? ' type=\'' + tbtype + '\'' : '') + (tbvalue ? ' value=\'' + tbvalue + '\'' : '') + (onclick ? ' onclick=\''+ onclick + '\'':'') + '>'; } function displaybuttons(cabledata) { var newcontent = ''; $.each(cabledata, function (i, item) { newcontent += createbuttons(item.commoncable, null, "submit", item.commoncable,alert("clicked")); }); $('#categories').html(newcontent);

}

do not phone call "alert('clicked')" (or whatever action want execute when button clicked) in function phone call creates button, or executed right away. instead, create anonymous function , wrap phone call in it. e.g.

newcontent += createbuttons(item.commoncable, null, "submit", item.commoncable,"alert('clicked')");

edit: didn't notice build button html text. in case pass code want execute (function call) text. edited code above reflect this.

javascript

javascript - parsing user input to date -



javascript - parsing user input to date -

i have form users insert date (edit: input copied form documents "as is" formatting vary)

"2012 12 01"

"2012-12-01"

"2012.12.01"

"01.15.2012"

also not friendly (but fast typing!) inputs like:

"01122012" // 01 12 2012

"011212" // 01 12 2012

the input format not fixed should create bast out of ...

of course of study there priority:

"12.12.12" should parsed yy.mm.dd if valid, or dd.mm.yy sec option.

most of ready functions work "properly formated" content .. need alghorithm (or illustration code parsers in other lanuages)

you "straight forward" like:

var datestring; // user input date if(datestring.split(" ").length == 3){ // have "yyyy mm dd" format } else if(datestring.split("-").length == 3){ // have yyyy-mm-dd format } else if(datestring.split(".").length == 3){ // have "yyyy.mm.dd" or "mm.dd.yyyy" format } else { // suppose have "yyyymmdd" or "mmddyyyy" format }

in cases can have 2 different formats have check day, year , month values if valid year. if so, can build date, otherwise seek other way.

for yyyymmdd , mmddyyyy combinations can utilize substr() function on string extract day, year , month.

however, have take business relationship user input can wrong "12 march 2012" or "abcdefg", wrap whole functionality try-catch block.

javascript

wpf - Entity Framework Mapping, Annotations and general inforation -



wpf - Entity Framework Mapping, Annotations and general inforation -

i have (i hope) basic problem in using entity framework wpf application.

i followed msdn walkthrough : http://msdn.microsoft.com/en-us/data/jj200620 , says:

many developers rather utilize info annotations fluent api perform configuration.

what understand in mapping "folder" mapping classes useless , people prefere using annotion straight in model classes.

so here, either i'm right , want rid of mapping classes

or i'm wrong , maybe, need kind of guid line start using entity framework

i take code first approche because work on existing database. problem many approach work ef i'm quite confused.

some people using edmx files others utilize reverse engineering annotation fluent api

i can't find finish book, or documentation, fundamental guide of kind latest version of ef .

thank

well basic starter suggest seek code first easy start with, define entities c# classes , later when included in info context automatically create database. codefirst easy mutual cases , quick implement. migration has automation. suggest read blog.

wpf entity-framework annotations

jsf 2 - jsf2 template and adding style sheet -



jsf 2 - jsf2 template and adding style sheet -

trying utilize jsf2 templates feature.the base.xhtml page looks below

<?xml version="1.0" encoding="utf-8"?> <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:ui="http://java.sun.com/jsf/facelets" > <h:head> <h:outputstylesheet name="test.css" library="style" target="head"/> </h:head> <h:body> <div id="page"> <div id="header"> <ui:insert name="header" > <ui:include src="/layout/header.xhtml" /> </ui:insert> </div> <div id="content"> <ui:insert name="content" > ??? </ui:insert> </div> <div id="footer"> <ui:insert name="footer" > <ui:include src="/layout/footer.xhtml" /> </ui:insert> </div> </div> </h:body> </html>

trying inherit template page (testpage.xhtml)

<?xml version="1.0" encoding="utf-8"?> <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:ui="http://java.sun.com/jsf/facelets" > <h:body> <ui:composition template="/layout/base.xhtml"> <ui:define name="content"> default page content!!!! <h:outputtext value="foo bar" style="green"/> </ui:define> </ui:composition> </h:body> </html>

the test.css file available under folder webcontent/resources/style , content of css file follows

.green{ color:#0000ff; }

now problem when seek run testpage stylesheet adding page (with view source able identify) not reflecting in ui.

is wrong in above code? help on appreciated.

you should utilize styleclass attribute (equivalent class attribute of plain html)

replace

<h:outputtext value="foo bar" style="green"/>

with

<h:outputtext value="foo bar" styleclass="green"/>

jsf-2

asp.net - SimpleMembership Presents Login Form to Authenticated User -



asp.net - SimpleMembership Presents Login Form to Authenticated User -

developing asp.net mvc 4 website simplemembership, login controller called though user logged in. far has happened during development (we're not in qa yet), , after modifying .cshtml page. happens once in while after modifying .cshtml page, not consistently.

i have added logging login() method provided template , see user indeed authenticated, , has roles logged-in user should have.

[allowanonymous] public actionresult login(string returnurl) { if (user.identity.isauthenticated) { logger.error("user " + user.identity.name + " authenticated shown login form. roles: " + string.join(", ", roles.getrolesforuser(user.identity.name))); // temporary work-around: websecurity.logout(); } viewbag.returnurl = returnurl; homecoming view(); }

questions

what causing behavior? can happen in production system, e.g. if app domain recycled? is work-around of calling websecurity.logout() before returning login view sound security perspective?

if want check if user logged in, instead of user.identity seek this:

if(request.isauthenticated) {...}

this true if user logged in @ moment. hope reply looking for!

asp.net asp.net-mvc simplemembership

How to: multidimensional arrays in vhdl -



How to: multidimensional arrays in vhdl -

i'm trying create 5 dimensional array in vhdl i'm unsure how set , initialize bits.

here have far:

type \1-line\ array (4 - 1 downto 0) of unsigned (32 - 1 downto 0); type square array (4 - 1 downto 0) of \1-line\; type cube array (4 - 1 downto 0) of square; type hypercube array (4 - 1 downto 0) of cube; type \5-cube\ array (4 - 1 downto 0) of cube; signal mega_array : \5-cube\; begin process (clock, reset) begin if (reset == '1') mega_array <= '0'; end if; end process; end behv;

a way '(others =>'0')'. clean , safe way set bits of vector @ '0'. have every layer of array.

library ieee; utilize ieee.std_logic_1164.all; utilize ieee.numeric_std.all; entity test port ( clock : in std_logic; reset : in std_logic); end entity test; architecture behv of test type \1-line\ array (4 - 1 downto 0) of unsigned (32 - 1 downto 0); type square array (4 - 1 downto 0) of \1-line\; type cube array (4 - 1 downto 0) of square; type \5-cube\ array (4 - 1 downto 0) of cube; signal mega_array : \5-cube\; begin process (clock, reset) begin if (reset = '1') -- note: not '==' mega_array <= (others => (others => (others => (others => (others => '0'))))); end if; end process; end architecture behv;

note although \1-... naming right vhdl, not utilize avoid nasty tools issues. i'm not sure come, avoiding them improve solving them. utilize t_1line instead.

arrays vhdl

get values of nested query in mysql -



get values of nested query in mysql -

select *, count(idwallhaswallpost) republish admin_pw.wall_has_wallpost wallpost_idwallpost in (select wallpost_idwallpost wall_has_wallpost wall_idwall in (select wall_idwall follower user_iduser=1)) grouping wallpost_idwallpost having republish>1;

i have nested query in mysql. there anyway acces values nested queries higher in query.

i access wall_idwall in lastly select. select query lowest , see wall_idwall used in operator.

try:

select w.*, count(w.idwallhaswallpost) republish, v.all_wall_idwall admin_pw.wall_has_wallpost w bring together (select h.wallpost_idwallpost, group_concat(distinct h.wall_idwall) all_wall_idwall wall_has_wallpost h bring together follower f on h.wall_idwall = f.wall_idwall , f.user_iduser=1 grouping h.wallpost_idwallpost) v on w.wallpost_idwallpost = v.wallpost_idwallpost grouping wallpost_idwallpost having republish>1;

mysql nested

c# - How to apply padding for Base64 -



c# - How to apply padding for Base64 -

i have next code works fine when utilize 4 letter word input, e.g. “test”. when input not multiple of 4, fails e.g. “mytest”.

eexception: invalid length base-64 char array.

questions

is guaranteed encrypted result compatible unicode string (without loss). if yes can utilize utf encoding instead of base64? what's difference between utf8/utf16 , base64 in terms of encoding how can add together padding right result (after decryption) if input not multiple of 4?

main prgoram

class programme { static void main(string[] args) { string valid128bitstring = "aaecawqfbgcicqolda0odw=="; string inputvalue = "mytest"; string keyvalue = valid128bitstring; byte[] bytevalforstring = convert.frombase64string(inputvalue); encryptresult result = aes128utility.encryptdata(bytevalforstring, keyvalue); encryptresult encyptedvalue = new encryptresult(); string resultingiv = "4uy34c9sqoc9rbv4gd8jra=="; if (string.equals(resultingiv,result.iv)) { int x = 0; } encyptedvalue.iv = resultingiv; encyptedvalue.encryptedmsg = result.encryptedmsg; string finalresult = convert.tobase64string(aes128utility.decryptdata(encyptedvalue, keyvalue)); console.writeline(finalresult); if (string.equals(inputvalue, finalresult)) { console.writeline("match"); } else { console.writeline("differ"); } console.readline(); } }

aes crypto utility

public static class aes128utility { private static byte[] key; public static encryptresult encryptdata(byte[] rawdata, string strkey) { encryptresult result = null; if (key == null) { if (!string.isnullorempty(strkey)) { key = convert.frombase64string((strkey)); result = encrypt(rawdata); } } else { result = encrypt(rawdata); } homecoming result; } public static byte[] decryptdata(encryptresult encryptresult, string strkey) { byte[] origdata = null; if (key == null) { if (!string.isnullorempty(strkey)) { key = convert.frombase64string(strkey); origdata = decrypt(convert.frombase64string(encryptresult.encryptedmsg), convert.frombase64string(encryptresult.iv)); } } else { origdata = decrypt(convert.frombase64string(encryptresult.encryptedmsg), convert.frombase64string(encryptresult.iv)); } homecoming origdata; } private static encryptresult encrypt(byte[] rawdata) { using (aescryptoserviceprovider aesprovider = new aescryptoserviceprovider()) { aesprovider.key = key; aesprovider.mode = ciphermode.cbc; aesprovider.padding = paddingmode.pkcs7; aesprovider.iv = convert.frombase64string("4uy34c9sqoc9rbv4gd8jra=="); using (memorystream memstream = new memorystream()) { cryptostream encstream = new cryptostream(memstream, aesprovider.createencryptor(), cryptostreammode.write); encstream.write(rawdata, 0, rawdata.length); encstream.flushfinalblock(); encryptresult encresult = new encryptresult(); encresult.encryptedmsg = convert.tobase64string(memstream.toarray()); encresult.iv = convert.tobase64string(aesprovider.iv); homecoming encresult; } } } private static byte[] decrypt(byte[] encryptedmsg, byte[] iv) { using (aescryptoserviceprovider aesprovider = new aescryptoserviceprovider()) { aesprovider.key = key; aesprovider.iv = iv; aesprovider.mode = ciphermode.cbc; aesprovider.padding = paddingmode.pkcs7; using (memorystream memstream = new memorystream()) { cryptostream decstream = new cryptostream(memstream, aesprovider.createdecryptor(), cryptostreammode.write); decstream.write(encryptedmsg, 0, encryptedmsg.length); decstream.flushfinalblock(); homecoming memstream.toarray(); } } } }

dto

public class encryptresult { public string encryptedmsg { get; set; } public string iv { get; set; } }

references:

how create byte[] length 16 using frombase64string getting wrong decryption value using aescryptoserviceprovider

base64 way of representing binary values text not conflict mutual command codes \x0a newline or \0 string terminator. not turning typed text in binary.

here how should passing text in , getting out. can replace utf8 whatever encoding want, need create sure encoding.whatever.getbytes same encoding encoding.whatever.getstring

class programme { static void main(string[] args) { string valid128bitstring = "aaecawqfbgcicqolda0odw=="; string inputvalue = "mytest"; string keyvalue = valid128bitstring; //turns our text in binary info byte[] bytevalforstring = encoding.utf8.getbytes(inputvalue); encryptresult result = aes128utility.encryptdata(bytevalforstring, keyvalue); encryptresult encyptedvalue = new encryptresult(); //(snip) encyptedvalue.iv = resultingiv; encyptedvalue.encryptedmsg = result.encryptedmsg; string finalresult = encoding.utf8.getstring(aes128utility.decryptdata(encyptedvalue, keyvalue)); console.writeline(finalresult); if (string.equals(inputvalue, finalresult)) { console.writeline("match"); } else { console.writeline("differ"); } console.readline(); } }

c# .net encryption cryptography

.htaccess - Custom 404 error page is generating a 500 error -



.htaccess - Custom 404 error page is generating a 500 error -

for security reasons, making php files generate 404 error, using custom 404 error page, so:

rewritecond %{the_request} \.php[\ /?].*http/ rewriterule ^.*$ - [r=404,l] errordocument 404 /error.html

any php script go returns custom 404 error page, like, below says:

additionally, 500 internal server error error encountered while trying utilize errordocument handle request.

but when go page doesn't exist (lets http://localhost/hello/world.html) error page want.

i'm confused, doing wrong. also, able utilize php pagefor custom errordocument, i'm not sure if that's possible.

you should seek redirect match:

redirectmatch 404 ".*\.php"

this pass not found error, , throw appropriate errordocument.

.htaccess http-status-code-404 errordocument custom-error-handling

Faceted search engine with scoring -



Faceted search engine with scoring -

i'm looking search engine solution whereby there attributes each document can filtered against, not absolutely - scored.

doc1 has attributes a, b , c doc2 has attributes b , c

if user chooses attribute "a" only, won't remove doc2, it'll score doc1 higher...

are there search engines can that?

you can build solr. wouldn't utilize built-in facets; instead, expose attributes links (perhaps in facet-like way) , utilize them add together scoring weight attribute, can sent parameter in solr query on fly.

search faceted-search

sql - Is it a slow query? Can it be improved? -



sql - Is it a slow query? Can it be improved? -

i going through sqlzoo "select within select tutorial" , here's 1 of queries did job (task 7)

world(name, continent, area, population, gdp)

select w1.name, w1.continent, w1.population world w1 25000000 >= all(select w2.population world w2 w2.continent=w1.continent)

my questions effectiveness of such query. sub-query run each row (country) of main query , repeatedly re-populating list given continent.

should concerned or oracle optimization somehow take care of it? can reprogrammed without correlated sub-query?

if want rewrite query without correalted subquery, here 1 way:

select w1.name, w1.continent, w1.population world w1 bring together ( select continent, max(population) max_population world grouping continent ) c on c.continent = w1.continent 25000000 >= c.max_population ;

i not imply faster. oracle's optimizer pretty , simple overall query, write it. here's simplification:

select w1.name, w1.continent, w1.population world w1 bring together ( select continent world grouping continent having max(population) <= 25000000 ) c on c.continent = w1.continent ;

sql oracle query-optimization subquery correlated-subquery

matlab - Subscript indices must either be real positive integers or logicals Error + Code -



matlab - Subscript indices must either be real positive integers or logicals Error + Code -

i wondering if can explain me error means. and, if possible, how resolve it? ??? subscript indices must either real positive integers or logicals.

error in ==> interp2>linear @ 344 f = ( arg3(ndx).*(onemt) + arg3(ndx+1).*t ).*(1-s) + ... error in ==> interp2 @ 220 zi = linear(extrapval,x,y,z,xi,yi); error in ==> snake @ 71 ssx = gamma*xs - kappa*interp2(fx,xs,ys);

this finish code:

image = imread('image.jpg'); %parameters alpha = 0.001; beta = 0.4; kappa=0.0001; gamma = 100; n = 100; wl = 10; = 10; wt = 10; smth = rgb2gray(image); % calculating size of image [row col] = size(image) eline = smth; %eline image intensities [grady,gradx] = gradient(double(smth)); eedge = -1 * sqrt ((gradx .* gradx + grady .* grady)); %eedge measured gradient in image m1 = [-1 1]; m2 = [-1;1]; m3 = [1 -2 1]; m4 = [1;-2;1]; m5 = [1 -1;-1 1]; cx = conv2(smth,m1,'same'); cy = conv2(smth,m2,'same'); cxx = conv2(smth,m3,'same'); cyy = conv2(smth,m4,'same'); cxy = conv2(smth,m5,'same'); = 1:700 j= 1:900 % eterm deined in kass et al snakes paper eterm(i,j) = (cyy(i,j)*cx(i,j)*cx(i,j) -2 *cxy(i,j)*cx(i,j)*cy(i,j) + cxx(i,j)*cy(i,j)*cy(i,j))/((1+cx(i,j)*cx(i,j) + cy(i,j)*cy(i,j))^1.5); end end eext = (double(wl.*eline) + double(we.*eedge -wt) .* eterm); %eext weighted sum of eline, eedge , eterm [fx, fy] = gradient(eext); %computing gradient xs=1:900; xs=xs'; ys=repmat(242,1,900); ys=ys' [m n] = size(xs); [mm nn] = size(fx); %populating penta diagonal matrix = zeros(m,m); b = [(2*alpha + 6 *beta) -(alpha + 4*beta) beta]; brow = zeros(1,m); brow(1,1:3) = brow(1,1:3) + b; brow(1,m-1:m) = brow(1,m-1:m) + [beta -(alpha + 4*beta)]; % populating template row i=1:m a(i,:) = brow; brow = circshift(brow',1)'; % template row beingness rotated egenrate different rows in pentadiagonal matrix end [l u] = lu(a + gamma .* eye(m,m)); ainv = inv(u) * inv(l); % computing ainv using lu factorization %moving snake in each iteration i=1:n; ssx = gamma * xs - kappa * interp2(fx,xs,ys); %this receive error ssy = gamma * ys - kappa * interp2(fy,xs,ys); %calculating new position of snake xs = ainv * ssx; ys = ainv * ssy; %displaying snake in new position % imshow(image,[]); % hold on; plot([xs; xs(1)], [ys; ys(1)], 'r-'); % hold off; % pause(0.001) end;

sounds trying access position 0 or non-integer (0.1) of array, matlab arrays start @ position 1.

>> a=[1,2,3]; >> a(0) ??? subscript indices must either real positive integers or logicals. >> a(1) ans = 1

matlab

vb.net - Auto split text the numbers -



vb.net - Auto split text the numbers -

i'm trying past ip in 1 textbox , when press ok must split in 4 pieces like:

123.123.123.123

and split in textbox1,2,3,4 [123] [123] [123] [123] ok if set more numbers 123.123.123.123.123.123.123 errors.

dim str string = textbox1.text dim splitstr string() = str.split(".") textbox1.text = splitstr(0).tostring() textbox2.text = splitstr(1).tostring() textbox3.text = splitstr(2).tostring() textbox4.text = splitstr(3).tostring()

this covers input errors:

private sub button1_click(byval sender system.object, byval e system.eventargs) handles button1.click textbox2.text = "" textbox3.text = "" textbox4.text = "" dim str string = textbox1.text str = str.trim dim splitstrs string() = str.split("."c) if splitstrs.length <> 4 msgbox("not valid ip format") exit sub end if each value string in splitstrs if value.length < 1 orelse value.length > 3 msgbox("not valid ip format") exit sub end if if not integer.tryparse(value, 0) msgbox("not valid ip format") exit sub end if if value.contains(" ") msgbox("not valid ip format") exit sub end if next textbox1.text = splitstrs(0).tostring() textbox2.text = splitstrs(1).tostring() textbox3.text = splitstrs(2).tostring() textbox4.text = splitstrs(3).tostring() end sub

vb.net textbox

Prevent eclipse from removing whitespaces -



Prevent eclipse from removing whitespaces -

how can prevent eclipse removing whitespace within line?

example:

final map<string, string> capitalof = new hashmap<string, string>(); capitalof.put("france", "paris"); capitalof.put("italy", "rom"); capitalof.put("switzerland", "bern");

gets becomes after calling format (ctrl-shift-f)

final map<string, string> capitalof = new hashmap<string, string>(); capitalof.put("france", "paris"); capitalof.put("italy", "rom"); capitalof.put("switzerland", "bern");

you can edit behavior of java formatter in white space section of preferences (java - code style - formatter).

in case have rely on formatter tags turn off formatting of code:

@formatter:off capitalof.put("france", "paris"); capitalof.put("italy", "rom"); capitalof.put("switzerland", "bern"); @formatter:on

for work, off/on tags have enabled shown below:

eclipse

jquery - How do I apply this javascript to the selected image? -



jquery - How do I apply this javascript to the selected image? -

i have javascript applied webpage:

$(function() { $('img.gallery_left').mouseover(function(){ $('img.gallery_left').animate({ borderwidth: '10px', width: '750px', height: '500px', marginleft: '1px', zindex: '15'}, 'default'); }); $('img.gallery_left').mouseout(function(){ $('img.gallery_left').animate({ borderwidth: '4px', width: '300px', height: '200px', marginleft: '1px'}, 'default'); }); });

i have gallery_left class applied number of images , when hover on 1 of images, makes every single image class gallery_left increment in size, border, etc. how create only image beingness hovered on applied, or have create every single image it's own class? (which i'd rather not have do...)

p.s. i'm not fluent in javascript, (i'm surprised made far!!) heads if don't understand you're trying across.

within event handlers, replace $('img.gallery_left') $(this), e.g.:

$('img.gallery_left').mouseover(function() { $(this).animate({...}); });

they impact specific element saw event, instead of entire class of elements.

javascript jquery class jquery-animate mouseover

bash - Variable expansion in comments -



bash - Variable expansion in comments -

is possible expand variables in comments within bash script?

i want write script feed sge. qsub syntax allows me pass additional parameters grid engine using lines within bash script begin #$. example,

#$ -q all.q #$ -s /bin/bash #$ -v #$ -m beas #$ -o run_20120103.out

what want -o parameter dynamically set variable, $1. naively write

#$ -o run_${1}.out

however, since line starts #, bash ignores , variable $1 not expanded.

any ideas? bash preprocessor? other way?

edit chose $1 example. $foo or $bar.

variable expansion happens in shell memory, doesn't impact file. therefore, doesn't matter bash expands.

instead, can generate script run on fly, expanded in place:

cat << eof | qsub [options] - #$ -o run_$1.out cmds eof

bash preprocessor sungridengine

html - css: How to horizontal align fonts with different sizes -



html - css: How to horizontal align fonts with different sizes -

first question on !

im trying "pixel perfect" horizontal align 2 lines of text , each line different font-size.

<style type="text/css"> * { font-family: sans-serif;} div { float: left;} h1 { font-size: 150px; margin-bottom:-30px; } </style> <div> <h1> b </h1> <h6> b-l.align </h6> </div> <div> <h1> l </h1> <h6> l.align </h6> </div>

sample here: http://jsfiddle.net/jgybd/1/

if @ sample , notice larger font has more "?padding?" smaller font. making them misaligned few pixels.

im looking way or formula left align them ,without using trial , error on margin-left!

all ideas appreciated , thanks.

what seeing not padding, kind of "kerning" of font. not that, sort of. big big problem is different every font, , every letter. seek replacing

<h1>b</h1>

by

<h1>j</h1>

now space much smaller !

this space depends of font, size , letter. so, don't think can command that

html css font-size alignment

mysql - Reboot under Win7 when C# program exits -



mysql - Reboot under Win7 when C# program exits -

i need help on this. have c# programme using .net 4.0, mysql database , dx code. when programme exits, computer reboots. no entries in event log, have no thought can cause reboot. happens on win7 (32 bit) machines, never yet under xp, never yet on win7 (64 bit) developer machine.

any pointers how can start tackle problem? i'm kinda lost without event logs...

ok, ran memory.dmp through dumpchk.exe , got answer: "probably due epsce.sys."

that makes sense, utilize epson's virtual port driver talk pos printer. update driver (it's outdated, version 5) , re-open question if problem persists.

thanks replies!

c# mysql windows-7 directx reboot

asp.net - Get attribute from DropdownList SelectedItem -



asp.net - Get attribute from DropdownList SelectedItem -

i have dropdownlist need store more info standard list item allows. approach i've taken add together attribute each of listitems.

i monitor changes , can homecoming selectedindex, i'm not sure how attribute there, or whether there easier ways of achieving this.

any ideas?

try this:

ddl.selecteditem.attributes["key"];

asp.net drop-down-menu attributes listitem

mvvm - Bind to selected items in WPF DataGrid -



mvvm - Bind to selected items in WPF DataGrid -

i want know selected items in datagrid (insert them collection in viewmodel).

when bind selected item changed when click on row (1 row), when press ctrl + clicking remains first item, why happening , possible link selected items?

here datagrid:

<datagrid selectedindex="{binding selectedxindex}" datacontext="{binding xviewmodel}" selecteditem="{binding currentx}" itemssource="{binding listx, mode=twoway}" autogeneratecolumns="false" > <datagrid.columns> ... </datagrid.columns> </datagrid>

in xviewmodel have:

selectedxindex (int) selected index

currentx (object of class x) current selection

listx - list of class x

the first suggestions made did not work. leave them historical reasons.

i think problem want kind of unusual - or error prone. set bind selecteditem (one item) while want able select multiple.

i set no binding @ in xaml (except itemssource of course) , track selection changes selectionchanged event in end code. link similar problem supporting method found here

hope find improve solution

old suggestions:

this should solve issue seem treating single mode selection datagrid nto explicitely define such:

<datagrid selectionmode="single"

if want selection mode multiple should not bind selectedindex

i wonder why have both selectedindex binding , selecteditem binding. in case 1 should needed.

keep selecteditem binding set selectionmode extended , seek again

wpf mvvm datagrid selecteditem

reporting services - SSRS 2008 Multiple X-Axis Categories - Remove Brackets -



reporting services - SSRS 2008 Multiple X-Axis Categories - Remove Brackets -

i trying add together multiple x-axis categories ssrs 2008 line chart, default adding these brackets each additional category. there way remove these brackets? trying display 50 info points , brackets causing info in categories cutting off/squished/un-readable. or if there improve way of displaying multiple x-axis data. help appreciated! thanks.

brackets in question: http://i44.photobucket.com/albums/f39/sethmo38/ssrslinechart3_zps348f76b8.jpg

you should able click on axis x or y till see selected block outline , click 'delete' on keyboard , removed. if want perform operations outside norm maintain of options click properties instead.

the default pane axis options , can alter 'category' 'scalar' if want numbers. set expressions instead of auto here if want. if don't want want custom labeling go pane 'labels' instead. can hide labels or take look determine when hidden. may wish mess major , minor tick marks well. when want highly customize axis may wish mess hiding of major marks , potentially turn off 'category' axis type , set manually. sorry can't see image @ work more understanding of situation forgive me if missed something.

reporting-services categories brackets

php - Database script for Joomla upgrade from 1.7 to 2.5? -



php - Database script for Joomla upgrade from 1.7 to 2.5? -

i looking script database changes , upgrades joomla installation joomla 1.7 joomla 2.5. not looking changes in code can check svn. having access script can allow me run these scripts on server cannot run automatic upgrade joomla admin.

update: @elin indicated. snapshot of sql folder under com_admin. sql queries executed here?

thanks.

look in sql folder of com_admin.

php joomla joomla2.5 joomla1.7

c# - How to set javascript variables using MVC4 with Razor -



c# - How to set javascript variables using MVC4 with Razor -

can format code below can set srcript variables c# code using razor?

the below not work, i've got way create easy help.

@{int proid = 123; int nonproid = 456;} <script type="text/javascript"> @{ <text> var nonid =@nonproid; var proid= @proid; window.nonid = @nonproid; window.proid=@proid; </text> } </script>

i getting design time error

you should take @ output razor page resulting. actually, need know executed server-side , client-side. seek this:

@{ int proid = 123; int nonproid = 456; } <script> var nonid = @nonproid; var proid = @proid; window.nonid = @nonproid; window.proid = @proid; </script>

the output should this:

depending version of visual studio using, point highlights in design-time views razor.

c# javascript asp.net-mvc razor

git fetch - Retrieve specific commit from a remote Git repository -



git fetch - Retrieve specific commit from a remote Git repository -

is there way retrieve 1 specific commit remote git repo without cloning on pc? construction of remote repo absolutely same of mine , hence there won't conflicts have no thought how , don't want clone huge repository.

i new git, there way?

you clone once, if have clone of remote repository, pulling won't download again. indicate branch want pull, or fetch changes , checkout commit want.

fetching new repository very inexpensive in bandwidth, download changes don't have. think in terms of git making right thing, minimum load.

git stores in .git folder. commit can't fetched , stored in isolation, needs ancestors. interrelated.

to cut down download size can inquire git fetch objects related specific branch or commit:

git fetch origin refs/heads/branch:refs/remotes/origin/branch

this download commits contained in remote branch branch (and ones miss), , store in origin/branch. can merge or checkout.

you can specify sha1 commit:

git fetch origin 96de5297df870:refs/remotes/origin/foo-commit

this download commit of specified sha-1 96de5297df870 (and ancestors miss), , store (non-existing) remote branch origin/foo-commit.

git git-fetch

permissions - Open remote location from PowerShell as different user -



permissions - Open remote location from PowerShell as different user -

i need open remote folder lot of times, , utilize start in powershell way

start \\myserverxxx\some_hidden_drive$\some_folder

sometimes need utilize administrator account, , expect prompted insert different credential, error instead. missing something?

use credential alternative follows

start \\myserverxxx\some_hidden_drive$\some_folder -credential $(get-credential)

this prompt come in different credentials

powershell permissions active-directory

Is it possible to cascade Wiki pages in Tiki? -



Is it possible to cascade Wiki pages in Tiki? -

i'm documenting objects in tiki , cascade descendants objects (wiki pages) @ end of current wiki page.

so far have seen how create link wiki pages, want embed total wiki page.

you can cascade wiki pages in tiki using structures feature. see http://doc.tiki.org/structures

to display table of contents of construction can utilize {toc} syntax.

to "embed" total wiki page one, can utilize include wikiplugin: http://doc.tiki.org/plugininclude

cascade tiki-wiki

sql server - Generate Group/Segment Identity with CTEs -



sql server - Generate Group/Segment Identity with CTEs -

the problem having generate serial groupid in column a(segment) starts identify rows till next c of column b(indicator) segment. column b indicator of segment start(a) , segment end (c).. in between (b or x) should marked segment id including rows , c. hope clear enough.

file received

processed file generated group/segment identity

i need suggestions best solution problem. have .net loop doing experimenting ctes. please help.

if table has id column, , table called [stuff], works:

-- set segment values rows indicator = 'a' update [stuff] set segment = s.row (select row_number() over(order id) row, id [stuff] indicator = 'a' ) s s.id = [stuff].id -- update other rows update [stuff] set segment = ( select top 1 segment [stuff] s1 s1.segment not null , s1.id <= [stuff].id order id desc ) update [stuff] set segment = -1 indicator = '#' update [stuff] set segment = 0 indicator = '##'

sql-server tsql recursion sql-server-2012 common-table-expression

cordova - when i click button, it will trigger twice(in mobile phone)(jquery+phonegap) -



cordova - when i click button, it will trigger twice(in mobile phone)(jquery+phonegap) -

when utilize tap event in application, trigger more 1 time when click it. want know how solve it(using jquery+phonegap). in word, whether find way , using way, trigger event 1 time in little time interval,

$('.a').live('tap',function(){...});

try

$('.a').live('tap',function(e){ e.preventdefault(); });

or

$('.a').live('tap',function(e){ e.stoppropagation(); });

or

use .one.

$('.a').one('click', function() { // other code });

op comment response.

try using:

$('.a').live('vclick', function() { console.log("works once"); )};

also can test event firing

$('.a').live('click tap', function(e) { console.log("which event: "+e.which + " event type: "+e.type); )};

for more refer jquery mobile events

cordova jquery

asp.net - Making a specific label in a repeater visible after binding -



asp.net - Making a specific label in a repeater visible after binding -

i'm trying create specific label in repeater visible after binding. don't want labels of every items in repeater visible. 1 click button. when click button update i'm updating info tourney item in db want show label alter success item updated.

here's code behind. [...] update in db

protected void repeattourney_itemcommand(object source, repeatercommandeventargs e) { if (e.commandname == "btnupdate_click") { [...] label lblsuccess= (label)e.item.findcontrol("lblupdatesuccess"); bindrepeater(ddlevents.text); lblsuccess.visible = true; } }

here's aspx. [...] textboxes , other stuff contains info db item.

<asp:repeater id="repeattourney" runat="server" onitemdatabound="repeattourney_itemdatabound" onitemcommand="repeattourney_itemcommand"> <itemtemplate> <div class="form"> [...] <asp:label id="lblupdatesuccess" runat="server" text="update success" visible="false" /> <asp:button id="btnupdate" runat="server" text="update" cssclass="button" commandname="btnupdate_click" /> [...] </div> </itemtemplate> </asp:repeater>

in end should this

item info btnupdate lblsuccess.visible = false item info btnupdate <== clicked lblsuccess.visible = true

thank help provided.

edit : here's bindrepeater code

private void bindrepeater(string name) { list<tourney> list = tourneydal.getbynameevent(name); [...] repeattournois.datasource = list; repeattournois.databind(); [...] }

edit 2 : give thanks thought of id tell 1 need visible after binding.

worked fine. :)

here new code

private void bindrepeater(string name, int index) { list<tourney> list = tourneydal.getbynameevent(name); [...] repeattourney.datasource = list; repeattourney.databind(); [...] if (index != 0) { label lblreussie = (label)repeattourney.items[index].findcontrol("lblupdatesuccess"); lblsuccess.visible = true; } protected void repeattourney_itemcommand(object source, repeatercommandeventargs e) { if (e.commandname == "btnupdate_click") { [...] label lblsuccess= (label)e.item.findcontrol("lblupdatesuccess"); bindrepeater(ddlevenements.text, e.item.itemindex); lblsuccess.visible = true; } } }

you haven't said what's going wrong, exception?

you utilize itemdatabound set visibility. hence have store index/id have updated last, e.g in field:

protected void repeattourney_itemcommand(object source, repeatercommandeventargs e) { if (e.commandname == "btnupdate_click") { updatedid = int.parse(e.commandargument.tostring()); bindrepeater(ddlevents.text); } } private int? updatedid = null; protected void repeattourney_itemdatabound(object sender, repeateritemeventargs e) { if (e.item.itemtype == listitemtype.item || e.item.itemtype == listitemtype.alternatingitem) { var tourney = (tourney) e.item.dataitem; label lblupdatesuccess = (label)e.item.findcontrol("lblupdatesuccess"); lblupdatesuccess.visible = updatedid.hasvalue && tourney.id == updatedid.value; } }

asp.net repeater

php - how to gather the code of a designed banner -



php - how to gather the code of a designed banner -

i have simple form designs banner user website have color schemes, links , link colors horizontal banner or vertical banner etc user selects desired banner selecting values drop downwards boxes , submits info stored in mysql database want collect info , send user display banner on website how create html pack of code know how send email php matter how pack of html code made , send him

any article helpfull

you utilize html template banner. alter depending on values set user.

php html mysql

How to import a java project missing .project .settings .classpath files into eclipse -



How to import a java project missing .project .settings .classpath files into eclipse -

i got java source code opensource project. source code doesn't have eclipse project specific files such .project ,.classpath ,.setting(directory). how can import java source eclipse ?

i don't have pom.xml(mvn) file specify. tried manually.

followed below steps solve

create directory projectname , directory "src" under projectname. move source code ( ie: org/apache/hadoop directory) src directory under projectname. create sample project in eclipse , go workspace , modify .project xml file changing project name ,.settings ,.classpath files copy modified ".project" file , ".settings" ,".classpath" eclipse workspace project directory newly created directory "projectname/" 5 .use eclipse import alternative under file menu import newly created project utilize existing project workspace alternative give project root directory projectname directory.

if using maven type mvn eclipse:eclipse on project folder

if not using maven, go eclipse, import->import -> general -> filesystem (then select directory source files)

java eclipse

php - zen cart SQL - Select products and order by price -



php - zen cart SQL - Select products and order by price -

solved

see reply below.

background

anyone familiar zen cart know comes finish worlds pointless product sort alternative aka alpha drop downwards sorter.

essentially allow select products letter/number start with. well, starting letter of item useful criteria when shopping i'm trying create more useful product sorter sort on date added, cost , product name. , filter based on attributes category.

problem

so have managed coerce sorter own query, working on except price.

here sql produced current set cost drop down:

select distinct p.products_id, p.products_type, p.master_categories_id ,p.manufacturers_id, p.products_price, p.products_tax_class_id ,pd.products_description ,if(s.status = 1, s.specials_new_products_price, null) specials_new_products_price ,if(s.status =1, s.specials_new_products_price, p.products_price) final_price ,p.products_sort_order ,p.product_is_call ,p.product_is_always_free_shipping ,p.products_qty_box_status products p left bring together specials s on p.products_id = s.products_id left bring together products_description pd on p.products_id = pd.products_id bring together products_to_categories p2c on p.products_id = p2c.products_id p.products_status = 1 , pd.language_id = '1' , p2c.categories_id = '1' grouping p.products_id order final_price asc

as can see trying sort based on final cost alias either normal cost or special cost (if set). works fine through phpmyadmin. unfortunately isn't working through zen cart, php error:

php fatal error: 1054:unknown column 'final_price' in 'order clause' :: select p.products_id, p.products_price_sorter, p.master_categories_id, p.manufacturers_id products p left bring together specials s on p.products_id = s.products_id left bring together products_description pd on p.products_id = pd.products_id bring together products_to_categories p2c on p.products_id = p2c.products_id p.products_status = 1\r\n , pd.language_id = '1'\r\n , p2c.categories_id = '1' grouping p.products_id order final_price asc in /var/www/includes/classes/db/mysql/query_factory.php on line 101

so looked @ line 101 , refers error handling method in database abstraction class. have ideas going wrong here , how might go solving it?

'final_price' not field in database; it's part of each line item entry in shopping cart object. sort base of operations cost (which final cost products not priced attributes , don't have additional priced attributes) using database.

php sql database zen-cart

iphone - CoreData Querying -



iphone - CoreData Querying -

i have created coredata model , defined entities , attributes. have created class(named dbinterface) of nsobject conforms <nsfetchedresultscontrollerdelegate> , added next objects

nsfetchedresultscontroller *fetchedresultscontroller; nsmanagedobjectcontext *managedobjectcontext;

here lost. how proceed info sqlite3 file created?

my query, if thats right term use, needs select records 1 of entities based on condition. not know how write query or of sort in coredata.

you not want nsfetchedresultscontroller. results controller typically used uitableviewcontroller helper object populate table.

if want, continue. however, if looking getting entities core info context, need nsfetchrequest. lets have core info object called person. lets want entities named "ryan"

nsfetchrequest *fetch = [nsfetchrequest fetchrequestwithentityname:@"person"]; nsstring *nametoget = @"ryan"; nspredicate *predicate = [nspredicate predicatewithformat:@"name = %@", nametoget]; [fetch setpredicate:predicate]; nserror *error = nil; nsarray *results = [[self managedobjectcontext] executefetchrequest:fetch error:&error]; if(results) { nslog(@"entities name: %@", results); for(person *p in results) { nslog(@"person = %@", p); } homecoming results; } else { nslog(@"error: %@", error); } homecoming nil;

so create fetch request. nspredicate conditions of sql statement. create predicate format (there tons of options creating predicates). set request's predicate, tell managedobjectcontext execute fetch request. results request in returned array. every object in array object of type person.

if looking utilize nsfetchedresultscontroller, same type of thing. however, create controller 1 fetch request immutable, gets same data. if want different data, need create controller. if stick nsfetchrequests (i sperate info layers ui, using controllers isn't useful me) can query info want , homecoming results.

iphone ios objective-c xcode core-data

.net - Label will not set when form loads -



.net - Label will not set when form loads -

i trying set label value of registry key when person loads form sets label there registry key value. doesn't set , default text no key found or error has occurred. first chance exception of type 'system.invalidcastexception' occurred in microsoft.visualbasic.dll error in immediate window.

private sub form1_load(byval sender system.object, byval e system.eventargs) handles mybase.load dim readvalue string readvalue = my.computer.registry.getvalue _ ("hkey_local_machine\software\wow6432node\bohemia interactive studio\arma 2 oa", "key", nothing) label3.text = readvalue end sub

try first:

msgbox("the value " & readvalue)

check if it's @ "key".

then: add together this:

dim bytes byte() = ctype(readvalue, byte()) str = bitconverter.tostring(bytes) label.text = str

.net visual-studio-2010

MySQL aggregate function return value to JAVA POJO Class -



MySQL aggregate function return value to JAVA POJO Class -

i using mysql , want fire query select count(*) table.then want store homecoming value in java pojo.

mysql query returns signed or unsigned integer java supports signed integer how can handle error?

projectlistmodel class simple bean not hibernate entity. it's more like:

query.setresulttransformer(transformers.aliastobean(projectlistmodel.class));

projectlistmodel contain field public int rowcount going store homecoming value.

handle value in seek grab block handles numberformatexception , if catches utilize sth. this

java mysql hibernate

java - Maven GPG plugin not signing sources and javadoc jars -



java - Maven GPG plugin not signing sources and javadoc jars -

i'm attempting release project's artifacts sonatype using maven. i'm using maven gpg plugin sign artifacts, it's not signing sources , javadoc jars (just main jar), required sonatype. here's think relevant parts of pom.xml:

<plugins> ... <plugin> <artifactid>maven-source-plugin</artifactid> <executions> <execution> <id>attach-sources</id> <phase>install</phase> <goals> <goal>jar-no-fork</goal> </goals> </execution> </executions> </plugin> <plugin> <artifactid>maven-javadoc-plugin</artifactid> <executions> <execution> <id>attach-javadocs</id> <phase>install</phase> <goals> <goal>jar</goal> </goals> </execution> </executions> </plugin> <plugin> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-gpg-plugin</artifactid> <executions> <execution> <id>sign-artifacts</id> <phase>verify</phase> <goals> <goal>sign</goal> </goals> </execution> </executions> </plugin> ... </plugins>

is there way tell sign these others jars too?

these changes pom solved problem:

<plugins> ... <plugin> <artifactid>maven-source-plugin</artifactid> <executions> <execution> <id>attach-sources</id> <goals> <goal>jar</goal> </goals> </execution> </executions> </plugin> <plugin> <artifactid>maven-javadoc-plugin</artifactid> <executions> <execution> <id>attach-javadocs</id> <goals> <goal>jar</goal> </goals> </execution> </executions> </plugin> <plugin> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-gpg-plugin</artifactid> <version>1.4</version> <executions> <execution> <id>sign-artifacts</id> <phase>verify</phase> <goals> <goal>sign</goal> </goals> </execution> </executions> </plugin> ... </plugins>

java maven pom.xml gnupg sonatype

linux - Script getting aborted with exit code 19543 -



linux - Script getting aborted with exit code 19543 -

i have script downloads huge file (~4gb) part files. script called within java thread. script uses wget utility of linux download files. script exits abnormally error message

19543 aborted /usr/bin/wget

once script fails thread sleeps off 1 hr , when wakes ups 1 time again starts downloading. keeps on downloading around ~10 mins , 1 time again fails same error message.

the server downloads, resource management fine , no issues it. cpu usage in client script runs fine.

not understanding why failure happening. before script used download same server no issues.

it downloading 128kbps speed.

linux wget

c - Can I run a program from a SD memory instead of flash on an evaluation board (embedded programming)? -



c - Can I run a program from a SD memory instead of flash on an evaluation board (embedded programming)? -

i have evaluation board (olimex stm32-p103) supports sd-card connector. want set programme in sd memory instead of internal flash of micro-controler; , run there. don't know if possible according boot-loader issue!

p.s goal running linux on board , port application on it.

to run programs sd-card in general should know can't run them "right away". means, have load in executable memory somewhere in address space done (more or less) simple bootloader. in simplest instance, bootloader capable read sd-card specific binary , re-create memory.

that beingness said should think considering got 20k of ram , 128k of flash on board. should programme go? or better: why not flashing programme in 128k of flash beginning? should know linux bit "hungry" in terms of memory.

if goal run "normal" linux on board, i'm afraid you're screwed. because know linux needs mmu run , chip on board not provide 1 (as far researchable without access datasheets st).

if you're lucky can go uclinux. i'm not sure if finished port exists stm32 seems there resources based on short google search "stm32 uclinux". if manage run uclinux i'm afraid there's not much left in scheme application, result might bit disappointing.

depending on why looking linux running on mcu, there maybe other solutions freertos in combination lwip-stack (if networking needed) or fat library fullfat if looking reading sd-cards , stuff.

edit: 1 thing i'd add together booting sd-card typically "bigger" (not much slightly) systems have plenty ram maintain whole image you'd run in , still have space left info want process.

c embedded embedded-linux microcontroller bootloader

php - Cookie not recognised on subdomain -



php - Cookie not recognised on subdomain -

i have domain , subdomain need both recognise cookie set main domain. on www.mydomain.com set cookie javascript so:

var d = new date(); d.setdate(d.getdate() + 30); var c = "all; expires=" + d.toutcstring() + "; path=/;domain=mydomain.com"; document.cookie = "cookies=" + c;

in php utilize simple if (isset($_cookie['cookies'])) ... works on www.mydomain.com doesn't work on sub.mydomain.com.

any suggestions? have phone call cookie within php differently?

var d = new date(); d.setdate(d.getdate() + 30); var c = "all; expires=" + d.toutcstring() + "; path=/;domain=.mydomain.com"; document.cookie = "cookies=" + c;

php javascript cookies

What is an appropriate way to handle or throw exception from service layer of n-tier ASP.Net MVC application? -



What is an appropriate way to handle or throw exception from service layer of n-tier ASP.Net MVC application? -

i have web application 3 layers: web > services > core. services has bunch of business logic helps web build , interpret viewmodels. there might problem in services layer though, , user should pushed error page.

how should error handling implemented in service layer of mvc application? example:

public void deleteorder(int orderid) { var order = _db.order.firstordefault(c => c.orderid == orderid); if (order == null) { // error handling } _db.orders.remove(order); _db.savechanges(); }

what go in isnull block?

generally set exception handling code in controllers. in terminology, assuming the mvc controllers live in "web" layer, , these controllers phone call methods in "service" layer, such "deleteorder" method you've shown. if case, in error handling code in deleteorder, should throw exception:

if (order == null) { throw new invalidoperationexception("specified orderid not exist"); }

this way unhandled exception passed controller, exception handling code lives, , there can log exception , redirect user appropriate error page.

as far how handle exception in controller, have number of options:

use try-catch block each action method implement iexceptionfilter interface on controller class implementing onexception method use built-in handleerrorattribute exception filter create own custom exception handling filter

the 4th method (create own exception filter) robust way go. in here, can add together exception logging, code redirect user appropriate error page based on type of exception thrown.

you can find overview of mvc controller exception handling here.

asp.net-mvc asp.net-mvc-3 asp.net-mvc-4 exception-handling

c# - Delete Cookies from Webbrowser control in wp7 -



c# - Delete Cookies from Webbrowser control in wp7 -

i have problem facebook , google logout. scenario when user first time login facebook or google particular site.(using clint api, redirect own web browser). show login page . after logout if 1 time again login facebook or google m trying it's not showing login page , straight shows login success message.(because webbrowser history there, , not able delete history) in situation multiple user can't login facebook or google.

have idea? how solve problem?

on wp7 you'll have utilize invokescript , javascript logout and/or rid of cookies required different services fb , google. fiddler comes in handy this.

if remember correctly, google you'll have watch specific url's , cancel navigation, run invokescript , go on navigation.

i worked on project accessed different providers , solution able working.

on wp8 there method clear cookies.

c# windows-phone-7 c#-4.0 c#-3.0 webbrowser-control

A way to put the facebook "feed" pop up inside a jquery dialog box? -



A way to put the facebook "feed" pop up inside a jquery dialog box? -

is there way set facebook feed pop (that publishes wall) within jquery dialog box? code have, have dialog box , feed come different pop ups:

<script> $(function() { $( "#dialog-modal" ).dialog({autoopen: false, resizable: false, draggable: false, height: 250, width: 500, modal: true, dialogclass: 'main-dialog-class'}); $( "#opener" ).click(function() { $( "#dialog-modal" ).dialog( "open" ); $.getjson( "/like_artist.php", // server url { artist_id : $(this).data('artist_id') }, // info want pass server. function(json) { var text = ''; text = 'you want ' + json[1] + ' play show in town! increment chances ' + json[1] + ' comes through area on tour alerting friends!'; $('#dialog-modal').text(text); fb.ui({ method: 'feed' }); alert(json[1]); }// function phone call on completion. ); }); }); </script>

suggestions appreciated!

you utilize feed dialog calling per url in “fake popup”, if open within iframe in jquery dialog box.

(give url on site return_uri, execute piece of javascript code in iframe’s parent window, close dialog 1 time again or something.)

although, work if user logged in facebook (you might want utilize fb.getloginstatus determine beforehand) – because if not, facebook redirect auth dialog, , can not shown in kind of frame, has opened @ top level window.

jquery facebook

c# - Adding rows to DataGridView programmatically -



c# - Adding rows to DataGridView programmatically -

i have datgridview add together new rows. first column of every row image indicates whether rest of row has been completed. maintain track of each row has list-like object attached counts number of completed fields, changes image if plenty fields have been completed. works expected when user adding rows in gui, run problems when seek add together new rows programmatically.

when new row created, datagridviewimagecell first column added custom class keeps track of completed fields.

here code add together new row:

//initiate new row object[] buffer = new object[13]; buffer[0] = nullimage; //a blank image (int = 1; < buffer.length; i++) { buffer[i] = string.empty; } rowid = datagridview1.rows.add(buffer);

here rowadded code:

private void datagridview1_rowsadded(object sender, datagridviewrowsaddedeventargs e) { datagridviewimagecell tmp = (datagridviewimagecell)datagridview1.rows[datagridview1.rowcount - 1].cells[0]; datagridview1validatefields.addrow(tmp); //custom class maintain track of completed fields }

the custom class contains list of datagridviewimagecells dgvic; here its' addrow method:

private list<object> dgvic = new list<object>(); public void addrow(datagridviewimagecell p) { items.add(new list<int>());//list of ints maintain track of completed fields dgvic.add(p); }

when come in debugger (while adding rows programmatically) can see each time add together new row datagridviewimagecells stored in dgvic recent row. instance after adding 3 rows, i'd expect 3 datagridviewimagecells rows 0, 1 , 2; of them row 2.

it looks me rowcount still tied each datagridviewcell, , rowcount increments cell changes. if case though, how come works through gui? have ideas?

change yours addedrows event follows:

private void datagridview1_rowsadded(object sender, datagridviewrowsaddedeventargs e) { int index = e.rowindex; (int = 0; < e.rowcount; i++) { datagridviewimagecell tmp = (datagridviewimagecell)datagridview1.rows[index].cells[0]; datagridview1validatefields.addrow(tmp); index++; } }

c# .net datagridview

.net - Immediately exit a Parallel.For loop in c# -



.net - Immediately exit a Parallel.For loop in c# -

in c#, possible exit parallel.for loop in progress. next code can take total sec exit loop after loopstate.stop() has been called.

static void main(string[] args) { stopwatch watch = new stopwatch(); parallel.for(0, 50, (i, loopstate) => { console.writeline("thread:" + thread.currentthread.managedthreadid + "\titeration:" + i); thread.sleep(1000); if (i == 0) { watch.start(); loopstate.stop(); return; } }); console.writeline("time elapsed since loopstate.stop(): {0}s", watch.elapsed.totalseconds); console.readkey(); }

output

thread:10 iteration:0 thread:6 iteration:12 thread:11 iteration:24 thread:12 iteration:36 thread:13 iteration:48 thread:13 iteration:49 thread:12 iteration:37 time elapsed since loopstate.stop(): 0.9999363s

is there way faster? thanks!

yes possible. @ this article goes detail parallel programming question. here excerpt out of it:

what if don’t want waste resources , want stop computations after click cancel? in case, have periodically check status of cancellation token somewhere within method performs long-running operation. since declared cancellation token field, can utilize within method.

public double sumrootn(int root) { double result = 0; (int = 1; < 10000000; i++) { tokensource.token.throwifcancellationrequested(); result += math.exp(math.log(i) / root); } homecoming result; }

using traditional stop or break not cause task canceled immediately, experiencing. according this article on msdn,

in context, "break" means finish iterations on threads prior current iteration on current thread, , exit loop. "stop" means stop iterations convenient.

so can't forcefulness stop using traditional method. need utilize method mentioned @ beginning.

hope helps you!

c# .net multithreading .net-4.0 parallel-processing

java - Atom feed reader in ExtJs -



java - Atom feed reader in ExtJs -

i trying read info atom feed , display info in extjs grid.

but not able find out sample code achieving :(

please allow me know how proceed this, sample code much appretiated.

if need more details, please allow me know it.

thanks,

java extjs extjs4 extjs3

sql - Top articles with unique name -



sql - Top articles with unique name -

i need select top rated articles uniqune name. i've got articles table:

id name --------------- 1 article 1 2 article 1 3 article 2

and votes table:

article_id rating -------------------- 1 3 1 2 3 1

when grouping articles name, counts average rating of articles same name.

select article.name, avg(vote.rating) rating article left bring together vote on vote.article_id = article.id grouping article.name

but want average rating of top rated articles. know how this? give thanks advice.

edit: want result:

name average_rating -------------------------- article 1 2.5 article 2 1

this lookig for:

select result.id, result.name, result.rating ( select article.id id, article.name name, avg(vote.rating) rating article left bring together vote on vote.article_id = article.id grouping article.id order rating desc ) result grouping result.name

probably, can handled improve works. give thanks helping.

sql dql

powershell - Formatting an integer x.xxxxx as xx.xxx -



powershell - Formatting an integer x.xxxxx as xx.xxx -

i have number $int

$int = 9.5587452369

i want number in format xx.xxx tried :

$int = "{0:n3}" -f ($int) $int = "{0:d2}" -f ($int)

or

$int = "{0:d2}" -f ("{0:n3}" -f ($int))

but doesn't work ideas ?

use tostring() method specified format.

ps > $int = 9.5587452369 ps > $int.tostring("00.000") 09,559

or

ps > "{0:00.000}" -f $int 09,559

read more @ msdn - custom numeric format strings

powershell formatting

haskell - How to properly close network connections with network-conduit? -



haskell - How to properly close network connections with network-conduit? -

larn basics of conduit library, used network-conduit create simple echo server:

class="lang-hs prettyprint-override">import control.monad.io.class import qualified data.bytestring.char8 bs import data.conduit import data.conduit.network -- conduit print input receives on console -- , passes through. echo :: (monadio m) => conduit bs.bytestring m bs.bytestring echo = yield (bs.pack "anything type echoed back.\n") -- print received info console well: awaitforever (\x -> liftio (bs.putstr x) >> yield x) echoapp :: (monadio m) => application m echoapp appdata = appsource appdata $= echo $$ appsink appdata -- hear on port 4545: main :: io () main = runtcpserver (serversettings 4545 hostany) echoapp

it wanted, when client closes part of connection, server still waiting input instead of writing out remaining info , closing sending part of connection too:

class="lang-sh prettyprint-override">$ nc localhost 4545 <<<"hello world!" type echoed back. hello world!

i tried removing echo , just

class="lang-hs prettyprint-override">echoapp appdata = appsource appdata $$ appsink appdata

but problem still there. doing wrong?

i'm not sure mean "the server won't respond it"? i'd guess you're expecting server shut downwards after client disconnects. if so, that's not intention of library: continues server connections in infinite loop long go on coming in. using addcleanup, can see individual connection handlers in fact terminate, e.g.:

echo :: (monadio m) => conduit bs.bytestring m bs.bytestring echo = addcleanup (const $ liftio $ putstrln "stopping") $ yield (bs.pack "anything type echoed back.\n") -- print received info console well: awaitforever (\x -> liftio (bs.putstr x) >> yield x)

haskell conduit network-connection

.net 2.0 - WriteLine string containing '{' character throws FormatException in C# -



.net 2.0 - WriteLine string containing '{' character throws FormatException in C# -

this question has reply here:

how escape braces (curly brackets) in format string in .net 4 answers

this throws formatexception:

console.writeline("strict digraph {0}\n{", project.projectname);

but fine:

console.writeline("strict digraph {0}\n", project.projectname);

i need trailing '{' , \{ isn't valid escape code. wrong code , how create work?

you need escape curly bracket curly bracket:

console.writeline("strict digraph {0}\n{{", project.projectname);

for farther info have @ relevant msdn article composite formatting , section "escaping braces".

is states that

opening , closing braces interpreted starting , ending format item. consequently, must utilize escape sequence display literal opening brace or closing brace. specify 2 opening braces ("{{") in fixed text display 1 opening brace ("{"), or 2 closing braces ("}}") display 1 closing brace ("}"). braces in format item interpreted sequentially in order encountered. interpreting nested braces not supported.

but mind you. can result in unexpected behavior: take format string {{{0:d}}} example. should output "{10}" example, shouldn't it?. should, doesn't. msdn-article linke above states that

the first 2 opening braces ("{{") escaped , yield 1 opening brace. the next 3 characters ("{0:") interpreted start of format item. the next character ("d") interpreted decimal standard numeric format specifier, next 2 escaped braces ("}}") yield single brace. because resulting string ("d}") not standard numeric format specifier, resulting string interpreted custom format string means display literal string "d}". the lastly brace ("}") interpreted end of format item. the final result displayed literal string, "{d}". numeric value formatted not displayed.

to circumvent msdn suggests utilize next code:

var result = string.format("{0}{1:d}{2}", "{", 10, "}");

c# .net-2.0

c - Is reading blocks of data from serial faster than reading 1 character at a time? -



c - Is reading blocks of data from serial faster than reading 1 character at a time? -

is faster read big blocks serial port read 1 byte @ time? general knowledge reading blocks faster. but, wondering if case serial communication because:

modern processor speeds older protocols serial transmits 1 bit @ time, unlike new communication methods usb

as follow up, how using usb serial connection (using pl2303 driver, if helps) impact this?

this came when thinking how parse incoming messages serial port. current design, easier parse info 1 character @ time, but, want reads efficiently.

unless you're hitting serial hardware straight imagine os buffer incoming info , still more efficient read blocks of info @ time.

you both ways , see faster though.

also certainly usb fast serial connection given s stands serial.

c serial-port

python - Pass another object to the main flask application -



python - Pass another object to the main flask application -

i got uncertainty how pass object flask app in right way.

the thought simple.

i wan create api application, means http requests processed flask application trigger meothds in main application.

for that, need flask aware of other process, 1 way or another.

currently, have :

if __name__ == '__main__': logger = myprocess() app.run()

i need able :

@app.route('/nb_trendy') def nb_trendy(): res = logger.get_trendy() homecoming jsonify(res)

which means either need either give handle on logger app, or straight define logger within app.

but in each of solutions can find, need create inherits app, either override __init__() , takes objects parameters, or modify run() method.

the current way though :

class myflask(flask): def __init__(): flask.__init__() logger = myprocess()

is way it, or there improve way this?

thanks!

here more general version of question: web api in flask

take @ application factories, should you're looking for. you'd create mill returned flask app you'd send logger - this:

def create_app(logger_instance): app = flask(__name__) app.config['logger'] = logger_instance homecoming app

and in runserver.py, you'd create , pass in logger:

from yourapp import create_app if __name__ == '__main__': logger = myprocess() app = create_app(logger) app.run()

once that's done, app can refer logger within app.config['logger'].

python flask

c# - Properties and onchange events. Need to find a proper design pattern -



c# - Properties and onchange events. Need to find a proper design pattern -

so made socket communication library. , part of iconnection

public enum connectionstate { notconnected, connecting, connected, authenticated, disconnecting, disconnected } public interface iconnection { connectionstate state { get; } event action connected; event action disconnected; event action authenticated; event action authenticationfailed; // 2 methods core of question void onauthenticated(); void onauthenticationfailed(); bool send(byte[] data); void connect(); void close(); }

of course of study iconnection provides info connection state , able fire connected/disconnected events holds socket. there no doubt.

now, users of iconnection know when becomes authenticated. example, server might hear events, , 1 time connection authenticated - send client's initial configuration data. or client might hear events , decide start communication or retry authentication process.

but. problem is, authentication process exists in protocol layer. iconnection has no thought such layer exists. protocol layer uses iconnection send serialized byte[] message other party.

so, iconnection able alter it's state , inform subscribers on auth process had implement 2 methods

void onauthenticated(); void onauthenticationfailed();

which are, called protocol layer authentication process code.

i sense i'm doing wrong here. , since work alone, thoughts much appreciated.

i ended moving core part of protocol authentication, keep-alive service , basic message types used everywhere communication assembly.

so iconnection auth process aware of core protocol.

c# architecture

tokenize - Why is my leading wildcard search failing in Solr? -



tokenize - Why is my leading wildcard search failing in Solr? -

i have text field defined utilize copyfield fill various source fields, , goal 1 field utilize search solr index.

this text field defined utilize custom fieldtype "text_en_splitting_reversed." created field type copying illustration "text_en_splitting" , adding reversedwildcardfilterfactory index analyzer.

<!-- text_en_splitting, add-on of reversed tokens leading wildcard matches --> <fieldtype name="text_en_splitting_reversed" class="solr.textfield" positionincrementgap="100" autogeneratephrasequeries="true"> <analyzer type="index"> <tokenizer class="solr.whitespacetokenizerfactory"/> <!-- in example, utilize synonyms @ query time <filter class="solr.synonymfilterfactory" synonyms="index_synonyms.txt" ignorecase="true" expand="false"/> --> <!-- case insensitive stop word removal. add together enablepositionincrements=true in both index , query analyzers leave 'gap' more accurate phrase queries. --> <filter class="solr.stopfilterfactory" ignorecase="true" words="lang/stopwords_en.txt" enablepositionincrements="true" /> <filter class="solr.worddelimiterfilterfactory" generatewordparts="1" generatenumberparts="1" catenatewords="1" catenatenumbers="1" catenateall="0" splitoncasechange="1" types="word-delim-types.txt" /> <filter class="solr.lowercasefilterfactory"/> <filter class="solr.keywordmarkerfilterfactory" protected="protwords.txt"/> <filter class="solr.porterstemfilterfactory"/> <filter class="solr.reversedwildcardfilterfactory" withoriginal="true" maxposasterisk="3" maxposquestion="2" maxfractionasterisk="0.33"/> </analyzer> <analyzer type="query"> <tokenizer class="solr.whitespacetokenizerfactory"/> <filter class="solr.synonymfilterfactory" synonyms="synonyms.txt" ignorecase="true" expand="true"/> <filter class="solr.stopfilterfactory" ignorecase="true" words="lang/stopwords_en.txt" enablepositionincrements="true" /> <filter class="solr.worddelimiterfilterfactory" generatewordparts="1" generatenumberparts="1" catenatewords="0" catenatenumbers="0" catenateall="0" splitoncasechange="1" types="word-delim-types.txt" /> <filter class="solr.lowercasefilterfactory"/> <filter class="solr.keywordmarkerfilterfactory" protected="protwords.txt"/> <filter class="solr.porterstemfilterfactory"/> </analyzer> </fieldtype>

my primary problem: when search using leading wildcard, unexpected results. example, know 1 particular search i'm doing "*car" should homecoming single match (the document contains word "racecar"). since failing, decided debug in analyzer tool in solr admin. here screenshot of test:

i'm new analyzer tool, shouldn't right side have retained leading asterisk way down? , why doesn't end matching? expected reverse processing of user's entered keywords?

now, in index query config, set utilize edismax. however, in admin analyzer gui, don't see way command whether it's using standard parser or edismax. (perhaps doesn't matter?)

in case info may help provide more context, going run downwards goals particular field beingness indexed:

i *car match racecar. this not working. i $30 match documents containing $30, not containing 30 (without dollar sign preceeding). added types="" attribute define $ digit. is working. i 30 match documents containing $30. this not working.

from screen shot, clear worddelimiterfilterfactory has stripped off leading *. seek adding preserveoriginal="1" query analyzer side i.e.

<filter class="solr.worddelimiterfilterfactory" preserveoriginal="1" generatewordparts="1" generatenumberparts="1" catenatewords="0" catenatenumbers="0" catenateall="0" splitoncasechange="1" types="word-delim-types.txt" />

solr tokenize lucene

sql - how to insert string to given string in oracle? -



sql - how to insert string to given string in oracle? -

i having 1 string test1string need pad 3 zeros before every digit.the result string should test0001string.i have tried pad,regexp_instr didn't right result.can explain methanks in advance

you can utilize regexp_replace:

sql> select regexp_replace('test1string', '([[:digit:]])', '000\1') tx dual; tx -------------- test0001string

sql oracle oracle11g

YouTube JavaScript API: use of "unstarted" state -



YouTube JavaScript API: use of "unstarted" state -

from player documentation: "when player first loads video, broadcast unstarted (-1) event."

what's intended utilize of event? is, host code differently, consequence of seeing it, if state didn't exist? illustration code i've seen nil log it.

i don't imagine it's useful. don't think there's deeper truth you're missing out on. assume reflects state that's used internally player , exposed in api sake of completeness.

youtube-api youtube-javascript-api

javascript - Get coordinates of line-surrounding box -



javascript - Get coordinates of line-surrounding box -

i've been working in javascript code line drawing system. i'd lines drawn selectable, i've been attempting implement line-highlighting. can see in image below, have line (in black) known coordinates , equation in slope-intercept (y=mx+b). how can calculate corners' (circled in green) coordinates, knowing box's radius?

this easiest think of in terms of vectors.

start off defining point @ end of line a, , other end b

var = new vector(1, 1) var b = new vector(5, 3)

now find unit direction vector of line (a vector of length 1 pointing b), , perpendicular:

var dir = b.minus(a).normalize(); var dir_perp = new vector(dir.y, -dir.x)

and extend them of length thickness:

dir = dir.times(thickness); dir_perp = dir_perp.times(thickness)

the 4 corners then:

[ a.minus(dir).plus(dir_perp), a.minus(dir).minus(dir_perp), b.plus(dir).minus(dir_perp), b.plus(dir).plus(dir_perp) ]

this assumes have sort of vector math library. here's 1 made earlier

javascript math line coordinates

c++ - Visual Studio 2012 -



c++ - Visual Studio 2012 -

i having issues visual studio 2012, when build solution , run debug says msvcp100d.dll missing

screen dump:

when seek run programme using release compiles fine , runs randomly runs run time error:

it not build more underlining these cv_8u & cv_8uc3

i using opencv library, code worked fine on visual studio 2010; decided upgrade 2012.

i ideally build solution using debug..........

any solutions or suggestions...? regards

it looks linking against opencv libs visual studio 2010. have compile opencv library visual studio 2012 pre-built ones visual studio 2010.

the info on how can found under installation making own libraries source files.

c++ opencv visual-studio-2012

Combine these mysql queries from multiple tables -



Combine these mysql queries from multiple tables -

let have table list of users, , retrieve users table this:

select userid users year = 2012

that generates list of users, more specifically, userid's (digits).

so, lets our list looks (random userids):

1234 9532 0983 2098 1980

in other table, have users favorite colors, 1 entry each color. user 1234 have multiple entries in table (lets phone call fav_colors):

1234 reddish 1234 bluish 9532 yellowish 9532 reddish 0983 bluish 0983 violet

this simplified illustration of concept trying grasp. how can form 1 query show me users year 2012 (from first query), , likes color red? having problem combining queries users table , fav_colors table

thanks

this should results you're looking for

select u.userid, c.color users u bring together fav_colors c on u.userid = c.userid u.year = 2012 , c.color_name = 'red'

mysql

c# - Converting string to bool within DataReader with Automapper -



c# - Converting string to bool within DataReader with Automapper -

this seems simple question, easy.

i have custom string bool map in automapper converts "y" , "n" true , false. doesn't much simpler:

mapper.createmap<string, bool>().convertusing(str => str.toupper() == "y");

this works fine in primitive example:

public class source { public string isfoo { get; set; } public string bar { get; set; } public string quux { get; set; } } public class dest { public bool isfoo { get; set; } public string bar { get; set; } public int quux { get; set; } } // ... mapper.createmap<string, bool>().convertusing(str => str.toupper() == "y"); mapper.createmap<source, dest>(); mapper.assertconfigurationisvalid(); source s = new source { isfoo = "y", bar = "hello world!", quux = "1" }; source s2 = new source { isfoo = "n", bar = "hello again!", quux = "2" }; dest d = mapper.map<source, dest>(s); dest d2 = mapper.map<source, dest>(s2);

however, let's instead want take source info datareader:

mapper.createmap<string, bool>().convertusing(str => str.toupper() == "y"); mapper.createmap<idatareader, dest>(); mapper.assertconfigurationisvalid(); datareader reader = getsourcedata(); list<dest> mapped = mapper.map<idatareader, list<dest>>(reader);

for every dest in mapped, isfoo property true. missing here?

i ended ditching string bool map , instead creating extension methods imemberconfigurationexpression<idatareader>. extension methods plural because ran this issue numerical info coming db didn't match destination types perfectly, causing inconsistent big numbers. since database stuff out of control, had forcefulness mapper read type. here's ended with:

public static class mapping { public static void init() { mapper.createmap<idatareader, dest>() .formember(s => s.isfoo, opt => opt.readasboolean("isfoo")) .formember(s => s.quux, opt => opt.readasnumber("quux")); mapper.assertconfigurationisvalid(); } public static void readasboolean(this imemberconfigurationexpression<idatareader> opt, string fieldname) { opt.mapfrom(reader => reader.getstring(reader.getordinal(fieldname)).toupper() == "y"); } public static void readasnumber(this imemberconfigurationexpression<idatareader> opt, string fieldname) { opt.mapfrom(reader => reader.getdecimal(reader.getordinal(fieldname))); } }

the duplication of property names strings goes against grain, suspect more automapper skills create more elegant. now, @ to the lowest degree works.

c# .net automapper

xaml - Nonlinear WPF Slider values -



xaml - Nonlinear WPF Slider values -

it straightforward remap linear values returned wpf slider control:

public double multiplier { { switch ((int)slidermultiplier.value) { case 0: homecoming 0.1; case 1: homecoming 0.2; case 2: homecoming 0.5; case 3: homecoming 1; case 4: homecoming 2; case 5: homecoming 5; case 6: homecoming 10; default: throw new argumentoutofrangeexception(); } } }

but slider handle, while beingness dragged, accompanied tooltip showing selected value - unmapped linear value. how can supply remapped value display? or slider supply non-linear values directly?

somebody else has solved (as far tooltips concerned). couldn't find way of having slider study non-linear value range.

http://joshsmithonwpf.wordpress.com/2007/09/14/modifying-the-auto-tooltip-of-a-slider/

wpf xaml slider

does java provide a built-in static String.Compare method? -



does java provide a built-in static String.Compare method? -

when comparing strings prefer not rely on instance methods lest string on method called happens null. in .net utilize static string.compare(string, string, bool) method. java provide similar built-in "null-safe" string compare utility or have implement own?

no, jdk not contain such utility. there several external libraries that. illustration org.apache.commons.lang.stringutils provides null-safe equals(string, string) , equalsignorecase(string, string). guava has similar utilities too.

java string static compare

kendo ui - HTML5 validation on lists -



kendo ui - HTML5 validation on lists -

how can html5 required validation on grouping of check boxes? have alternative such "choose 1 or more of following", several checkboxes within ul. if set required attribute @ ul level, nil happens. if set @ input level, makes every value must checked validate. want forcefulness user pick @ to the lowest degree 1 value. seems work fine radio type, checkboxes (where can have more 1 choice) not work.

here's html:

<form> <!-- in case, set required @ ul level !--> <ul required="required" validationmessage="you must come in gender"> <li> <input id="male" name="mf" type="checkbox" value="male" /> <label for="male">male</label> </li> <li> <input id="female" name="mf" type="checkbox" value="female" /> <label for="female">female</label> </li> </ul> <!-- in case, set @ input level --> <ul required="required" validationmessage="you must come in gender2"> <li> <input id="male2" name="mf2" type="checkbox" value="male2" required /> <label for="male">male2</label> </li> <li> <input id="female2" name="mf2" type="checkbox" value="female2" required /> <label for="female">female2</label> </li> </ul> <input type="submit" value="submit"> </form>

i should note: using kendo create validation work across browsers (in case there's kendo-ized solution problem)

html5 kendo-ui

jQuery draggable - snap to browser? -



jQuery draggable - snap to browser? -

i using next code drag div on site:

js13('#wrapper').live('mouseover', function () { js13(this).draggable(); });

but want somehow snap browser, not possible drag outside of browser window bounds.

is possible somehow? ;)

you can utilize containment property (see draggable-api)

in case, might try:

js13('#wrapper').live('mouseover', function () { js13(this).draggable( "option", "containment", $(window)); });

not sure if working solution, not tested.

jquery jquery-ui-draggable

How to get the onEdit event to to be caught in a Google Apps Script when editing a spreasheet via api? -



How to get the onEdit event to to be caught in a Google Apps Script when editing a spreasheet via api? -

i have apps script captures onedit event when edit google spreadsheet cell manually, , applies various formatting changes based on change.

however, when edit same cell using google drive api, script doesn't seem run.

is there way trigger event via api can caught apps script? or other solution this?

publish web app:

it possible trigger google apps script code using url, i.e. google apps script editor menu->publish->publish web app. can pass id of cell parameter "web app". , have web app phone call onedit.

i suspect "google-spreadsheet-api" has no way this, basic things such "insert row in middle of sheet", don't exist.

google-apps-script google-spreadsheet google-drive-sdk google-spreadsheet-api

python - Autoincrementing option for Pandas DataFrame index -



python - Autoincrementing option for Pandas DataFrame index -

is there way set alternative auto-incrementing index of pandas.dataframe when adding new rows, or define function managing creation of new indices?

you can set ignore_index=true when append-ing:

in [1]: df = pd.dataframe([[1,2],[3,4]]) in [2]: row = pd.series([5,6]) in [3]: df.append(row, ignore_index=true) out[3]: 0 1 0 1 2 1 3 4 2 5 6

python indexing append row pandas

javascript - Datatables fnSort advise -



javascript - Datatables fnSort advise -

looking help place fnsort datatables code create default sort sec column opposed first. have:

dataclones['keyword_table_<?php echo ceil($countcallscounter/7); ?>']=document.getelementbyid('keyword_table_<?php echo ceil($countcallscounter/7); ?>').clonenode(true); $('#keyword_table_<?php echo ceil($countcallscounter/7); ?>').datatable( { //"sdom": "<'row'<'span6'l><'span6'f>r>t<'row'<'span6'i><'span6'p>>", "sdom":"<<'span6'l><'span6'f>r>t<<'span6'i><'span6'p>>", "spaginationtype": "bootstrap", "olanguage": { "slengthmenu": "_menu_ records per page" } } );

i know need add together http://datatables.net/api#fnsort not overly familiar js after quick help if possible.

thanks

all have set variable = $(selector).datatable() call. can phone call variable.fnsort().

var otable; // create sure within scope of function, or want execute sort. dataclones['keyword_table_<?php echo ceil($countcallscounter/7); ?>']=document.getelementbyid('keyword_table_<?php echo ceil($countcallscounter/7); ?>').clonenode(true); otable = $('#keyword_table_<?php echo ceil($countcallscounter/7); ?>').datatable( { //"sdom": "<'row'<'span6'l><'span6'f>r>t<'row'<'span6'i><'span6'p>>", "sdom":"<<'span6'l><'span6'f>r>t<<'span6'i><'span6'p>>", "spaginationtype": "bootstrap", "olanguage": { "slengthmenu": "_menu_ records per page" } } ); function onsort(){ otable.fnsort([0,'asc']); }

also if know column want sort on initialize of datatable could:

$('#example').datatable( { "aasorting": [[ 4, "desc" ]] } );

http://datatables.net/api#fnsort http://datatables.net/release-datatables/examples/basic_init/table_sorting.html

javascript datatables