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