Friday, 15 August 2014

how to reduce size of text code in C language? -



how to reduce size of text code in C language? -

i trying cut down size of text in c (gcc )

when typed size command, text size 4096.

the programme simple

and then, when erased newline , initialization this,

the result same before.

i mean text size still 4096

how cut down size of text??

__text segment actual compiled code resides, not related straight size of source code file.

the important means of controlling code size belongs design - design programme correctly, avoid redundant logic. microoptimizations combining variable definition , initialization meaningless, compiler improve anyway. compiler has different optimization options, variating between speed improvement code size improvement. set optimization level minimal code size.

c

jar file not connecting to the database -



jar file not connecting to the database -

i created java project long requires connection derby inbuilt netbeans database. used open netbeans, compile files , run , used work fine. learnt how create jar file out of on netbeans , did it.now when run jar file not connect database.when login gets stuck cause apparently not connecting db. plz help me out? thanking in advance.

p.s. please simple in explanation. coding not in understanding lot of programming jargon. seek explain me u explain layman if possible.

you using clientdriver, means java programme attempting connect derby network server running on same machine ("localhost") @ port 1527.

if connection not working, simplest explanation derby network server not running @ moment run java program.

the commands running in netbeans ("go services in netbeans , connect") may automatically starting derby network server you.

you can start derby network server on own. it's java program; derby binary distribution contains scripts can run start it. go here read how start derby network server , configure knows ayush database is: http://db.apache.org/derby/docs/10.10/getstart/twwdactivity4.html , also: http://db.apache.org/derby/docs/10.10/adminguide/cadminconfig86869.html#cadminconfig86869

database database-connection derby

php - Setting Content-Length Header for Magento -



php - Setting Content-Length Header for Magento -

i'm battling site performance issues , 1 of recommendations disable chunked encoding.

our site pages aren't big plenty need , there's much overhead. i'm not familiar http headers, i've learned "transfer-encoding: chunked" header gets set automatically if not have "content-length" header.

does know how go setting "content-length" header in magento? need work pages pages cached (we utilize lightspeed total page caching extension).

i can't speak lightspeed total page caching extension (you need contact back upwards issue), magento has single entry point via index.php, can hack , wrap output in buffer:

ob_start(); # ... run magento here $buffer = ob_get_clean();

you set content-length header:

header(sprintf("content-length: %s", strlen($buffer)));

then sending out buffer:

echo $buffer;

this might not work caching extension or if other extensions breaking output buffering chain.

php http magento http-headers magento-1.5

objective c - playing audio in background and recording that background audio with video on iphone -



objective c - playing audio in background and recording that background audio with video on iphone -

in app want play background sound , video recording both sound , video record....

how can functionality???

// setup cam

-(void)setupdivavcam { self.capturingwindow.delegate = self; [self.capturingwindow setupwithoptions:@{diyavsettingcameraposition : [nsnumber numberwithint:avcapturedevicepositionback] }]; [self.capturingwindow setcammode:diyavmodevideo]; } #pragma mark - rec video methods start -(ibaction)capturevideo:(id)sender { [self startcapturingvideo]; } -(ibaction)stopvideo:(id)sender { [self stopcapturingvideo]; } //to start video recording -(void)startcapturingvideo { { { if(![[uidevice currentdevice].model isequaltostring:@"iphone simulator"]) { //to disable photographic camera button time untill image loads _camerabutton.userinteractionenabled = no; [self.capturingwindow capturevideostart]; } } } } //to stop video recording -(void)stopcapturingvideo { [self.capturingwindow capturevideostop]; }

the above code video

i looked in several forums , couldn't deliver satisfying answer.

my wish able play , record video while playing music @ background. managed help of snippet found. here code:

iphone objective-c ios7 avaudiorecorder

'ora-12505' error while connecting to Oracle XE database via SQL Developer -



'ora-12505' error while connecting to Oracle XE database via SQL Developer -

whilst connecting oracle xe database via sql developer ora-12505 error, seen below

oracle-sqldeveloper oracle-xe

Is there a C# equivalent of VB.NET's "Static"? -



Is there a C# equivalent of VB.NET's "Static"? -

the vb.net static declaration:

http://msdn.microsoft.com/en-us/library/z2cty7t8.aspx

the reference can find question 2008:

http://forums.asp.net/t/951620.aspx?what+is+the+equivalent+of+static+from+vb+net+in+c+

is there equivalent in recent versions of c#, or still not present? there particularly wrong using static in vb.net?

c# not back upwards , won't because somehow violates object programming thought of state beingness part of object, not method.

of course of study 1 can syntactic sugar, , he/she event quite right. still, looking through class code, expected description of state variables fields of class. otherwise should find in each , every method.

so can seen high-level decision , millage may vary here.

vb.net static

sql server - Adding another Table -



sql server - Adding another Table -

okay have made study calculating how many contracts funded in each month within year 2014.

so have calculate total contracts in service only.

what mean have table called tlkorigdept. within table have this

table tlkorigdept orig_dept_id orig_dept_name 1 sales 2 service 3 f&i 4 other 5 direct marketing

so have funded contracts service 'orig_dept_id' = 2 query problem see in clause. because when alter orig_dept_id 3 works not 2. shows blank , not error message.

the user inputs @begin_date , @end_date user picks company @program. user should see funded contracts each month service only.

i either see problem in select statement or clause

here query

[code="sql"] alter proc spgetadminserviceytd (@begin_date datetime, @end_date datetime, @program int=null) declare @year int set @year = 2014 declare @orig_dept_id int set @orig_dept_id = 2 begin select d.name, a.dealer_code, b.last_name, b.city, b.state, b.phone,e.orig_dept_name , count(case when month(c.orig_dept_id) = 1 1 else null end) jan , count(case when month(c.orig_dept_id) = 2 1 else null end) feburary , count(case when month(c.funded_date) = 3 1 else null end) march , count(case when month(c.funded_date) = 4 1 else null end) apr , count(case when month(c.funded_date) = 5 1 else null end) may , count(case when month(c.funded_date) = 6 1 else null end) june , count(case when month(c.funded_date) = 7 1 else null end) july , count(case when month(c.funded_date) = 8 1 else null end) august , count(case when month(c.funded_date) = 9 1 else null end) september , count(case when month(c.funded_date) = 10 1 else null end) oct , count(case when month(c.funded_date) = 11 1 else null end) nov , count(case when month(c.funded_date) = 12 1 else null end) dec , count(1) ytd tdealer bring together tcontact b on a.contact_id = b.contact_id bring together tcontract c on a.dealer_id = c.dealer_id bring together tcompany d on c.company_id = d.company bring together tlkorigdept e on c.orig_dept_id = e.orig_dept_id c.orig_dept_id = 2 , d.company_id = @program , c.funded_date >= dateadd(month, datediff(month, 0, getdate())-5, 0) , year(c.funded_date) = @year , c.funded_date < dateadd(month, datediff(month, -1, getdate())-1, 0) , (c.funded_date) between @begin_date , @end_date grouping d.name, a.dealer_code, b.last_name, b.city, b.state, b.phone, month(c.funded_date), month(e.orig_dept_name), e.orig_dept_name end exec spgetadminserviceytd '01/01/2014', '05/30/2014', '47'

sql-server where-clause

javascript - Merging 2 div content on drag and drop of div on one another using jquery -



javascript - Merging 2 div content on drag and drop of div on one another using jquery -

i need jquery code next scenario. there 4 div's, 1 can dragged , dropped on other. while dropping content of div1 , div2 should merged.

merged content can pulled out , set origial div code thing this.

<div id ="f1"> <p id="c1">content 1</p> </div> <div id ="f2"> <p id="c2">content 2</p> </div> <div id ="f3"> <p id="c3">content 3</p> </div> <div id ="f4"> <p id="c4">content 4</p> </div>

if drag f2 on f1 in f1 should find both c1 , c2 this

<div id ="f1"> <p id="c1">content 1</p> <p id="c2">content 2</p> </div> <div id ="f3"> <p id="c3">content 3</p> </div> <div id ="f4"> <p id="c4">content 4</p> </div>

now should able pull out c2 , set other div also. this..

<div id ="f1"> <p id="c1">content 1</p> </div> <div id ="f3"> <p id="c3">content 3</p> </div> <div id ="f4"> <p id="c4">content 4</p> <p id="c2">content 2</p> </div>

please help me out. in advance.

i have managed write code this. on browser console see

tags getting dragged around on ui effect not crystal clear.

<script> function allowdrop(ev) { ev.preventdefault(); } function drag(ev) { ev.datatransfer.setdata("text", ev.target.id); } function drop(ev) { ev.preventdefault(); var info = ev.datatransfer.getdata("text"); $('#'+ev.target.id).parent().append($('#'+data)); } </script> <div id ="f1"> <p id="c1" ondrop="drop(event)" ondragover="allowdrop(event)" draggable="true" ondragstart="drag(event)">content 1</p> </div> <div id ="f2"> <p id="c2" ondrop="drop(event)" ondragover="allowdrop(event)" draggable="true" ondragstart="drag(event)">content 2</p> </div> <div id ="f3"> <p id="c3" ondrop="drop(event)" ondragover="allowdrop(event)" draggable="true" ondragstart="drag(event)">content 3</p> </div> <div id ="f4"> <p id="c4" ondrop="drop(event)" ondragover="allowdrop(event)" draggable="true" ondragstart="drag(event)">content 4</p> </div>

javascript jquery drag

how to parse same data from one request to other request in jmeter, which is generated by random function? -



how to parse same data from one request to other request in jmeter, which is generated by random function? -

in application, email id same & unique(for each thread) throughout application.

now have utilize random function generate email id on home page i.e. "${__randomstring(5,abcd)}@test.com" so, can generate different email-id different threads. want utilize same email id other pages. how can possible please suggest.

e.g. :- in home page utilize email id "abcde@test.com" (make sure email-id generated random function), want carries same id on myprofile page too.

you using 2 parameters of __randomstring function:

random string length chars utilize random string generation

but there one: name of variable in store result (optional)

if amend function follows:

${__randomstring(5,abcd,email)}@test.com

you able refer generated variable ${email} or ${__v(email)}. rather go __v alternative it's you'll want add together __threadnum function in conjunction __randomstring bind variable current thread number.

see how utilize jmeter functions posts series more info on various jmeter functions , best utilize cases.

jmeter

JQuery Get Element Name On Html Table -



JQuery Get Element Name On Html Table -

i have table. it's maintain product name, amount , price..

when want alter amount 2-3-4 or number it's alter first row.

how can alter result rows

<table> <tr> <td>product name 1 </td> <td><input type="text" id = "amount" value="1"></td> <td id="price">55</td> <td id="result"><!-- here 55*1 (amount) --></td></tr> <tr><td>product name 2 </td> <td><input type="text" id = "amount" value="1"></td> <td id="price">65</td> <td id="result"><!-- here 65*1 (amount) --></td></tr> <tr><td>product name 3 </td> <td><input type="text" id = "amount" value="1"></td> <td id="price">23</td> <td id="result"><!-- here 23*1 (amount) --></td> </tr> </table> <script> $('#amount').keyup(function () { var amount= $("#amount").val(); var cost = $(this).closest('tr').children('td.price').text(); var result = amount * price; $("#result").html(result).show(); }); </script>

ids must unique. can utilize class instead.

html

<table> <tr> <td>product name 1</td> <td> <input type="text" class="amount" value="1" /> </td> <td class="price">55</td> <td class="result"> <!-- here 55*1 (amount) --> </td> </tr> <tr> <td>product name 2</td> <td> <input type="text" class="amount" value="1" /> </td> <td class="price">65</td> <td class="result"> <!-- here 65*1 (amount) --> </td> </tr> <tr> <td>product name 3</td> <td> <input type="text" class="amount" value="1" /> </td> <td class="price">23</td> <td class="result"> <!-- here 23*1 (amount) --> </td> </tr> </table>

js

$('input.amount').keyup(function () { var amount = +$(this).val(); //here utilize '+' convert number var cost = +$(this).closest('tr').find('td.price').text(); var result = amount * price; //here miktar undefined $(this).closest('tr').find('td.result').html(result).show(); });

demo

jquery html

javascript - Attempting to loop through files with Q.js -



javascript - Attempting to loop through files with Q.js -

i attempting utilize q.js handle issues promises , deferrable in web application - start off saying understanding of async 0 right now. first time i've tried it, , really lost after reading much of documentation can.

i previously using library called jsdeferred accomplish next code; loops through list of files , loads them, , adds them array. have since learned should not utilize jsdeferred , told should instead utilize promises , deferrables correctly.

i have explored lot of venues , may stupid, having hard time implementing exact code in promises oriented library (in example, trying utilize q.js, no success).

q.js library define(function () { homecoming function (selector, callback) { var files = [ "/app_content/json/ecma5.json", "/app_content/json/jquery.json", "/app_content/json/tangent.json" ]; var results = []; var editor, server; homecoming deferred.loop(files.length, function (i) { homecoming $.get(files[i]).next(function(data) { results.push(data); }); }).next(function () { // lot of things happen here. amazing things. }).next(function() { // seriously, stuff awesome. }).next(function() { callback(editor); }); }; });

i'm having hard time file loading/looping, help appreciated. think 1 time footing here, i'll able proceed lot better, file looping throwing me off. maintain reading in documentation seems one-time utilize scenarios.

i still reading documentation, , go on so, if can help me footing here appreciate it. 1 time see working of own, it's easier me pick other situations. have 20 other places need start using concept, first 1 giving me headache.

update

i not have utilize q.js, 1 came recommended. looking @ https://github.com/caolan/async if solve problem.

further update

working more docs, have amalgamated of working code, still seems missing something. having problem passing results parameters each then(fn), have maintain outside variable.

var results = []; var editor, server; var chain = files.reduce(function (previous, item) { homecoming previous.then(function(previousvalue) { homecoming q.resolve($.get(item, function(data) { results.push(data); })); }); }, q.resolve()); chain .then(function (results) { }) .then(function (results) { // can't seem results pass through 2nd 'next'. }) .then(function () { callback(editor); }); final result

with help of here, have made code work how want. end result. implementation of codemirror using tern , custom script definitions.

define(function () { homecoming function (selector, callback) { var editor, server, results, files = [ "/app_content/json/ecma5.json", "/app_content/json/jquery.json", "/app_content/json/tangent.json" ]; q .all(files.map($.get)) .then(function(data) { results = data; }) .then(function() { editor = codemirror.fromtextarea(selector[0], { mode: { name: "javascript", globalvars: true }, linenumbers: true, linewrapping: true, matchbrackets: true, indentunit: 2, tabmode: "spaces", autoclosebrackets: true, matchtags: true, highlightselectionmatches: true, continuecomments: "enter", foldgutter: true, width: "100%", gutters: ["codemirror-linenumbers", "codemirror-foldgutter"], extrakeys: { "ctrl-space": "autocomplete", "ctrl-q": function(cm) { cm.foldcode(cm.getcursor()); } } }); }) .then(function() { server = new codemirror.ternserver({ defs: results }); editor.setoption("extrakeys", { "ctrl-space": function(cm) { server.complete(cm); }, "ctrl-i": function(cm) { server.showtype(cm); }, "alt-.": function(cm) { server.jumptodef(cm); }, "alt-,": function(cm) { server.jumpback(cm); }, "ctrl-q": function(cm) { server.rename(cm); }, }); editor.on("cursoractivity", function(cm) { server.updatearghints(cm); }); }) .then(function() { callback(editor); }) .done(); }; });

i offer extreme, extreme constructive, helpful, useful, , knowledgeable info provided here.

using q.js, , assuming not need send info along request, shorten code using map , q.all:

var results, files = [ "/app_content/json/ecma5.json", "/app_content/json/jquery.json", "/app_content/json/tangent.json" ]; q.all(files.map($.get)) .then(function(_results) { results = _results; }) .then(function () { // more awesome stuff here }) .then(function () { // etc... console.log(results); }) .done();

note in order utilize results within subsequent .then() blocks, must save off reference outside of promise chain. in example, results wanted local function passed in then() - shadowed global results. give different name, _results, , assign global results in order able utilize later.

javascript jquery asynchronous q

objective c - iOS Set up NSTimer to call a method only on active / inactive page -



objective c - iOS Set up NSTimer to call a method only on active / inactive page -

i 1 of viewcontroller want phone call method updatevisitotslists on time criteria's , not able decide way best accomplish it.

1) every time view loaded/appeared want phone call method.

for in viewdidappear method can phone call before calling [super viewdidappear];, works, believe.

2) if user on view only, want phone call method after every 5 secs.

for this, need set nstimer. want stop timer when viewdiddisappear - don't want running unnecessary. should utilize unscheduled timer shown here , start , stop in appear & disappear methods ? in viewdidappear, phone call method, , set

nstimer *t = [nstimer scheduledtimerwithtimeinterval: 5.0 target: self selector:@selector(updatevisitotslists:) userinfo: nil repeats:no];

what best way , methodology accomplish looking ? help highly appreciated.

thanks.

updated :-

@lord zolt, per comment did next :-

//in .h @property (strong, nonatomic) nstimer *timer; // .m @synthesize timer; - (void)viewdidload { ........ [super viewdidload]; // create timer timer = [nstimer scheduledtimerwithtimeinterval:5 target:self selector:@selector(ontimercall:) userinfo:nil repeats:yes]; } -(void) viewwilldisappear:(bool)animated { [timer invalidate]; timer = nil; [super viewwilldisappear:animated]; } -(void) ontimercall: (nstimer *) _timer { // update visitor's list [self updatevisitotslists]; }

is proper ?

i recommend using timers.

create nstimer property, recommend calling invalidate on them on viewwilldisappear.

if don't phone call invalidate, when view controller dismissed or popped, won't deallocated, since nstimer maintain alive.

the code posted fine few modifications:

you don't need @synthesize properties anymore (unless overwrite both setter , getter). don't set timer nil.

edit: if want timer related screen (aka should executed when screen visible), should initialise in viewdid(will)appear , stop in viewdid(will)disappear.

ios objective-c nstimer

c# - 'AllowAnonymous' could not be found -



c# - 'AllowAnonymous' could not be found -

everything worked fine until installed (package manager console) postal package, uninstalled , installed older version.

now error not. error:

the type or namespace name 'allowanonymous' not found (are missing using directive or assembly reference?)

who knows how prepare this?

probably missing reference system.web.http assembly in project?

so need to:

add reference system.web.http; add using system.web.http; controller;

to add together reference need next steps:

in solution explorer, right-click project node , click add reference. in add reference dialog box, select tab assemblies, , come in system.web.http search on right side. select component system.web.http, , click ok.

link:

how to: add together or remove references using add together reference dialog box

c# asp.net-mvc asp.net-mvc-4 asp.net-membership asp.net-identity

c# - How do I bind Data from my DataTable to Gridview -



c# - How do I bind Data from my DataTable to Gridview -

i elaborate. trying description failed payment , want hover on image or status see reason description failed payment:

here c# info bound gridview

datatable billingdt = new datatable(); billingdt = q.getbillhistory(sessionvars.current.varcontractid); billingdt.columns.add("paynum", system.type.gettype("system.string")); billingdt.columns.add("datestr", system.type.gettype("system.string")); billingdt.columns.add("amountstr", system.type.gettype("system.string")); billingdt.columns.add("balancestr", system.type.gettype("system.string")); billingdt.columns.add("description", system.type.gettype("system.string")); string downpayment = dt.select("name = 'downpayment'")[0][1].tostring(); (int row = 0; row < billingdt.rows.count; row++) { billingdt.rows[row]["paynum"] = billingdt.rows[row]["payment"].tostring(); billingdt.rows[row]["datestr"] = convert.todatetime(billingdt.rows[row]["paydate"]).toshortdatestring(); if (billingdt.rows[row]["payment"].tostring() == "0") { billingdt.rows[row]["paynum"] = downpayment; } if (billingdt.rows[row]["status"].tostring().length < 1) { billingdt.rows[row]["status"] = ""; } if (billingdt.rows[row]["descript"].tostring().length < 1) { billingdt.rows[row]["description"] = ""; } if (billingdt.rows[row]["amount"].tostring().length > 0) { billingdt.rows[row]["amountstr"] = fv.moneystring(convert.todecimal(billingdt.rows[row]["amount"])); } billingdt.rows[row]["balancestr"] = (billingdt.rows[row]["balance"].tostring().length > 0) ? fv.moneystring(convert.todecimal(billingdt.rows[row]["balance"])) : ""; } billinghistorygv.datasource = billingdt; billinghistorygv.databind();

and here asp:image want bind description tooltip:

<asp:templatefield> <itemtemplate> <asp:image id="statusiconimg" runat="server" imageurl='<%# getimage((string)eval("status")) %>' /> </itemtemplate> <itemstyle horizontalalign="right" width="20px" /> </asp:templatefield>

if understanding question correctly, not have bind tooltip property of image? tooltip='<%# eval("description") %>'

<asp:image id="statusiconimg" runat="server" imageurl='<%# getimage((string)eval("status")) %>' tooltip='<%# eval("description") %>' />

c# asp.net gridview

c++ - MPL for_each to use functor with more parameters -



c++ - MPL for_each to use functor with more parameters -

i want utilize compile time (mpl) for_each check if given input variable in mpl array , , output variable mpl array again. i'm trying utilize function object 2 parameters mpl type , input.

#include <boost/mpl/list.hpp> #include <algorithm> #include <boost/mpl/for_each.hpp> #include <string> #include <istream> #include <ostream> #include <sstream> #include <boost/mpl/range_c.hpp> #include <boost/mpl/vector.hpp> #include <boost/mpl/vector_c.hpp> #include <boost/mpl/at.hpp> #include <boost/mpl/placeholders.hpp> #include <boost/bind.hpp> using namespace std; namespace mpl = boost::mpl; typedef mpl::range_c<char,1,5> range5; typedef mpl::list< mpl::int_<1> , mpl::int_<5> , mpl::int_<31> , mpl::int_<14> , mpl::int_<51> > out_type; template <class t> struct id {}; struct do_this_wrapper { static char stat_c ; template<typename u> inline void operator()(int i, u ) { if (i == u::value) { do_this_wrapper::stat_c = mpl::at_c<out_type,u::value>::type::value; } } }; char do_this_wrapper::stat_c ; int main() { int x =1; boost::mpl::for_each<range5>(boost::bind(do_this_wrapper(), x, _1)); homecoming 0; };

these errors

in file included /usr/include/boost/bind.hpp:22:0, ../src/testproj3.cpp:2627: /usr/include/boost/bind/bind.hpp: in instantiation of ‘struct boost::_bi::result_traits<boost::_bi::unspecified, do_this_wrapper>’: /usr/include/boost/bind/bind_template.hpp:15:48: required ‘class boost::_bi::bind_t<boost::_bi::unspecified, do_this_wrapper, boost::_bi::list2<boost::_bi::value<int>, boost::arg<1> > >’ ../src/testproj3.cpp:2665:70: required here /usr/include/boost/bind/bind.hpp:69:37: error: no type named ‘result_type’ in ‘struct do_this_wrapper’ typedef typename f::result_type type; ^ in file included ../src/testproj3.cpp:2617:0: /usr/include/boost/mpl/for_each.hpp: in instantiation of ‘static void boost::mpl::aux::for_each_impl<false>::execute(iterator*, lastiterator*, transformfunc*, f) [with iterator = boost::mpl::r_iter<mpl_::integral_c<char, '\001'> >; lastiterator = boost::mpl::r_iter<mpl_::integral_c<char, '\005'> >; transformfunc = boost::mpl::identity<mpl_::na>; f = boost::_bi::bind_t<boost::_bi::unspecified, do_this_wrapper, boost::_bi::list2<boost::_bi::value<int>, boost::arg<1> > >]’: /usr/include/boost/mpl/for_each.hpp:101:97: required ‘void boost::mpl::for_each(f, sequence*, transformop*) [with sequence = boost::mpl::range_c<char, '\001', '\005'>; transformop = boost::mpl::identity<mpl_::na>; f = boost::_bi::bind_t<boost::_bi::unspecified, do_this_wrapper, boost::_bi::list2<boost::_bi::value<int>, boost::arg<1> > >]’ /usr/include/boost/mpl/for_each.hpp:111:38: required ‘void boost::mpl::for_each(f, sequence*) [with sequence = boost::mpl::range_c<char, '\001', '\005'>; f = boost::_bi::bind_t<boost::_bi::unspecified, do_this_wrapper, boost::_bi::list2<boost::_bi::value<int>, boost::arg<1> > >]’ ../src/testproj3.cpp:2665:71: required here /usr/include/boost/mpl/for_each.hpp:75:25: error: no match phone call ‘(boost::_bi::bind_t<boost::_bi::unspecified, do_this_wrapper, boost::_bi::list2<boost::_bi::value<int>, boost::arg<1> > >) (mpl_::integral_c<char, '\001'>&)’ aux::unwrap(f, 0)(boost::get(x));

i inquire possible utilize in way , how

you should implement boost_result_of protocol do_this_wrapper:

typedef void result_type;

see live on coliru

#include <boost/mpl/list.hpp> #include <algorithm> #include <boost/mpl/for_each.hpp> #include <string> #include <istream> #include <ostream> #include <sstream> #include <boost/mpl/range_c.hpp> #include <boost/mpl/vector.hpp> #include <boost/mpl/vector_c.hpp> #include <boost/mpl/at.hpp> #include <boost/mpl/placeholders.hpp> #include <boost/bind.hpp> using namespace std; namespace mpl = boost::mpl; typedef mpl::range_c<char,1,5> range5; typedef mpl::list< mpl::int_<1> , mpl::int_<5> , mpl::int_<31> , mpl::int_<14> , mpl::int_<51> > out_type; template <class t> struct id {}; struct do_this_wrapper { typedef void result_type; static char stat_c ; template<typename u> inline void operator()(int i, u ) { if (i == u::value) { do_this_wrapper::stat_c = mpl::at_c<out_type,u::value>::type::value; } } }; char do_this_wrapper::stat_c ; int main() { int x =1; boost::mpl::for_each<range5>(boost::bind(do_this_wrapper(), x, _1)); homecoming 0; };

c++ boost

child module not found in maven multi project execution -



child module not found in maven multi project execution -

i created 2 projects(project-1,project-2) in directory , execute both projects in 1 click create project(project-3) in directory , nowadays these 2 projects((project-1,project-2) modules , define packaging pom here using modules concept.

<modules> <module>d:/20-6-2014/project-1</module> <module>d:/20-6-2014/project-2</module> </module>

i define project-3 parent both projects,while run project-3 gives error.

error is: kid module d:\20-6-2014\project-3\project-1 of d:\20-6-2014\project-3\pom.xml not exist.

your directory construction should follows project-3 parent project project-1 , project-2

| | ----project-3 | | ----pom.xml | | ----project-1 | | | | | ------pom.xml ----project-2 | | -------pom.xml

and project-3's pom.xml should have

<modules> <module>project-1</module> <module>project-2</module> </module>

maven

c# - Given 4 points of a rectangle, disregarding the 4 points, do any sides intersect? -



c# - Given 4 points of a rectangle, disregarding the 4 points, do any sides intersect? -

i'm messing around object recognition samples emgu:

rectangle rect = modelimage.roi; pointf p1 = new pointf(rect.left, rect.bottom); pointf p2 = new pointf(rect.right, rect.bottom); pointf p3 = new pointf(rect.right, rect.top); pointf p4 = new pointf(rect.left, rect.top); //check if opposite lines intersect //if so, don't add together final results //we should never have 2 opposite sides intersecting linesegment2df l1 = new linesegment2df(p1,p2); linesegment2df l2 = new linesegment2df(p2, p3); linesegment2df l3 = new linesegment2df(p3, p4); linesegment2df l4 = new linesegment2df(p4, p1) if (!(intersects(l1, l3) || intersects(l2, l4))) { //draw line }

however, fishy results such (grey ish):

and (red):

i other bad results too, notice trend these. these rectangles (or technically trapezoids...?) have lines cross on or lay on top of each other. want ignore drawing these results if that's case. there way determine given 4 points?

update: @ request of user @chris , check out this answer. attempted replicate pseudo code. however, may misunderstanding it. doesn't give expected results. seems homecoming true. may because translated pseudo code wrong.

public static bool intersects(linesegment2df l1, linesegment2df l2) { float x1 = l1.p1.x; float x2 = l1.p2.x; float x3 = l2.p1.x; float x4 = l2.p2.x; float y1 = l1.p1.y; float y2 = l1.p2.y; float y3 = l2.p1.y; float y4 = l2.p2.y; float intervalamin = math.min(x1, x2); float intervalamax = math.max(x1, x2); float intervalbmin = math.min(x3, x4); float intervalbmax = math.max(x3, x4); //if (math.max(l1.p1.x, l1.p2.x) < math.min(l2.p1.x, l2.p2.x)) homecoming false; if(intervalamax < intervalbmin) homecoming false; float a1 = (y1-y2)/(x1-x2); // pay attending not dividing 0 float a2 = (y3-y4)/(x3-x4); // pay attending not dividing 0 if (a1 == a2) homecoming false; // parallel segments float b1 = y1-a1*x1;// = y2-a1*x2; float b2 = y3-a2*x3;// = y4-a2*x4; float xa = (b2 - b1) / (a1 - a2);// 1 time again, pay attending not dividing 0 float ya = a1 * xa + b1; //float ya = a2 * xa + b2; if ((xa < math.max(math.min(x1, x2), math.min(x3, x4))) || (xa > math.min(math.max(x1, x2), math.max(x3, x4)))) homecoming false; // intersection out of bound homecoming true; }

i found cool simplified method online. simplified bit so:

public static bool intersects2df(linesegment2df thislinesegment, linesegment2df otherlinesegment) { float firstlineslopex, firstlineslopey, secondlineslopex, secondlineslopey; firstlineslopex = thislinesegment.p2.x - thislinesegment.p1.x; firstlineslopey = thislinesegment.p2.y - thislinesegment.p1.y; secondlineslopex = otherlinesegment.p2.x - otherlinesegment.p1.x; secondlineslopey = otherlinesegment.p2.y - otherlinesegment.p1.y; float s, t; s = (-firstlineslopey * (thislinesegment.p1.x - otherlinesegment.p1.x) + firstlineslopex * (thislinesegment.p1.y - otherlinesegment.p1.y)) / (-secondlineslopex * firstlineslopey + firstlineslopex * secondlineslopey); t = (secondlineslopex * (thislinesegment.p1.y - otherlinesegment.p1.y) - secondlineslopey * (thislinesegment.p1.x - otherlinesegment.p1.x)) / (-secondlineslopex * firstlineslopey + firstlineslopex * secondlineslopey); if (s >= 0 && s <= 1 && t >= 0 && t <= 1) { // collision detected homecoming true; } homecoming false; // no collision }

after tweaking , debugging on of way round points in lines (basically code prior this), figured little in code need adjust. after fixing that, solution works!

c# geometry emgucv

javascript - I need to submit the form and redirect the parent page on form submission in a fancy box -



javascript - I need to submit the form and redirect the parent page on form submission in a fancy box -

this form code given in fancybox popup iframe page.

i need close popup , redirect parent page

http://luxuryresortstayvouchers.com/newdesign/?p=list.php

when submit button pressed.

following function closing fancybox popup parent page not redirected desired location.

function closemeup() { parent.$.fancybox.close(); } <form action=""http://luxuryresortstayvouchers.com/newdesign/?p=list.php method="post" target="_parent" class="form_class" enctype="multipart/form-data" > <input class="vouch_num" type="text" placeholder="checkin date" maxlength="25" size="50" id="datepicker" /> <input class="vouch_num" type="text" placeholder="checkout date" maxlength="25" size="50" id="datepicker2" /> <br /> <input type="button" id="ok" class="submit_but" value="submit" onclick="closemeup();" /> <input type="button" id="cancel" class="cancel_but" value="cancel" /> </form>

any help highly appreciated.

thanks.

you utilize parent.window.location.href property within onsubmit attribute of (iframed) form :

<form id="login_form" onsubmit="javascript:parent.window.location.href='http://luxuryresortstayvouchers.com/newdesign/?p=list.php';" > ... </form>

notice don't have forcefulness closing fancybox since page redirection job.

also notice if close fancybox manually (without submitting form), parent page won't redirected.

see jsfiddle

javascript jquery forms fancybox

annotations - What dose @Trivial mean in Java? -



annotations - What dose @Trivial mean in Java? -

i have seen @trivial in java code in couple of places this:

@trivial public final class xyz {...}

what mean? effect have?

annotations can created custom, , looks custom annotation someone. illustration (from code):

/** * because never gonna give up, never gonna allow down! * * @author m0skit0 * */ @target(elementtype.method) @retention(retentionpolicy.runtime) public @interface rickastley { }

bonus quick guess @trivial meaning: class doesn't need javadoc because functionality trivial.

java annotations

java - Saving image to external storage not working in android -



java - Saving image to external storage not working in android -

in android app, want store image external storage. have code:

package async; import java.io.file; import java.io.fileoutputstream; import java.io.outputstream; import http.network; import interfaces.imagedownloader; import android.app.activity; import android.content.context; import android.graphics.bitmap; import android.os.asynctask; import android.os.environment; import android.provider.mediastore; import android.util.log; import android.widget.imageview; public class async_image_task extends asynctask<string, void, bitmap> { imagedownloader callercontext; imageview calledimageview; string link; public async_image_task(imageview calledimageview, string link) { this.callercontext = (imagedownloader)calledimageview.getcontext(); this.calledimageview = calledimageview; this.link = link; execute(link); } @override protected bitmap doinbackground(string... params) { bitmap bitmap = network.downloadimage((context) callercontext, params[0]); if (bitmap != null) { seek { string[] segments = link.split("/"); int len = segments.length; string path = environment.getexternalstoragedirectory().getabsolutepath(); string imgpath = segments[len-6] + "/" + segments[len-2] + "/" + segments[len-1]; file file = new file(path, imgpath); file.getparentfile().mkdirs(); string abs = file.getabsolutepath(); outputstream fout = new fileoutputstream(file); bitmap.compress(bitmap.compressformat.png, 100, fout); fout.flush(); fout.close(); mediastore.images.media.insertimage(((activity)callercontext).getcontentresolver(),abs,file.getname(),file.getname()); } grab (exception e) { log.d("image_error", e.getmessage()); } } homecoming bitmap; } @override protected void onpostexecute(bitmap bitmap) { callercontext.imagecallback(bitmap, calledimageview); } }

and in manifest have permission:

<uses-permission android:name="android.permission.read_external_storage" /> <uses-permission android:name="android.permission.write_external_storage" />

but when tries execute outputstream fout = new fileoutputstream(file);, throws filenot found exception....

error:

06-18 17:48:35.573: d/image_error(9316): /storage/sdcard0/arin/53/image.jpg: open failed: eacces (permission denied)

why happening, when have permission?

does know?

thanks

logcat

06-18 18:03:57.522: w/system.err(14213): java.io.filenotfoundexception: /storage/sdcard0/arin/53/image.jpg: open failed: eacces (permission denied) 06-18 18:03:57.532: w/system.err(14213): @ libcore.io.iobridge.open(iobridge.java:416) 06-18 18:03:57.532: w/system.err(14213): @ java.io.fileoutputstream.<init>(fileoutputstream.java:88) 06-18 18:03:57.532: w/system.err(14213): @ java.io.fileoutputstream.<init>(fileoutputstream.java:128) 06-18 18:03:57.532: w/system.err(14213): @ java.io.fileoutputstream.<init>(fileoutputstream.java:117) 06-18 18:03:57.532: w/system.err(14213): @ async.async_image_task.saveimage(async_image_task.java:64) 06-18 18:03:57.532: w/system.err(14213): @ async.async_image_task.doinbackground(async_image_task.java:37) 06-18 18:03:57.532: w/system.err(14213): @ async.async_image_task.doinbackground(async_image_task.java:1) 06-18 18:03:57.532: w/system.err(14213): @ android.os.asynctask$2.call(asynctask.java:287) 06-18 18:03:57.532: w/system.err(14213): @ java.util.concurrent.futuretask$sync.innerrun(futuretask.java:305) 06-18 18:03:57.532: w/system.err(14213): @ java.util.concurrent.futuretask.run(futuretask.java:137) 06-18 18:03:57.532: w/system.err(14213): @ android.os.asynctask$serialexecutor$1.run(asynctask.java:230) 06-18 18:03:57.532: w/system.err(14213): @ java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1076) 06-18 18:03:57.542: w/system.err(14213): @ java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:569) 06-18 18:03:57.542: w/system.err(14213): @ java.lang.thread.run(thread.java:856) 06-18 18:03:57.542: w/system.err(14213): caused by: libcore.io.errnoexception: open failed: eacces (permission denied) 06-18 18:03:57.542: w/system.err(14213): @ libcore.io.posix.open(native method) 06-18 18:03:57.542: w/system.err(14213): @ libcore.io.blockguardos.open(blockguardos.java:110) 06-18 18:03:57.542: w/system.err(14213): @ libcore.io.iobridge.open(iobridge.java:400) 06-18 18:03:57.542: w/system.err(14213): ... 13 more

the directory trying create file may not exist. seek line before phone call new fileoutputstream:

file.mkdirs();

java android image save external

MS access import from newly created text file (from URL) -



MS access import from newly created text file (from URL) -

first, context. have excel spreadsheet module that, using piece of javascript on site, imports info text file generated website.

set datasheet = worksheets("datasheet") ... set qtqtrresults = datasheet.querytables _ .add(connection:=url, destination:=datasheet.cells(1, 1)) qtqtrresults .webformatting = xlnone .webselectiontype = xlspecifiedtables .webtables = "1,2" .refresh

the url goes "site.com/download.jsp?login=abc&search=123" which, when accessed in browser, creates text file downloads browser's default download directory.

my problem need replicate functionality in access, importing info text file existing table.

can offer solution (other utilize excel)?

i tested next , worked me in access 2010:

class="lang-vbs prettyprint-override">option compare database alternative explicit sub downloadcsvfromweb() dim httpreq object, stm object set stm = createobject("adodb.stream") stm.type = 2 ' adtypetext stm.open set httpreq = createobject("msxml2.serverxmlhttp") httpreq.open _ "get", _ "http://www.example.com/downloads/gord/test.csv", _ false httpreq.send stm.writetext httpreq.responsetext stm.savetofile _ "c:\users\gord\desktop\test.csv", _ 2 ' adsavecreateoverwrite stm.close set stm = nil set httpreq = nil end sub

that saves file disk (on desktop, in case). code go on utilize docmd.transfertext import info access table.

ms-access access-vba

c# - Changing size of Notify Icon -



c# - Changing size of Notify Icon -

as know when utilize notifyicon command in c# , place in systemtray , displayed, windows overrides size , create 16*16 can somehow alter size? create little bigger scheme "date , time" display or "input method type" in windows 8. want display text there. in adv.

the scheme draws icon, , decides size is. worth, notification icons system's little icon size. in fact should not assume 16px icons. font scalings larger 100% little icon size larger 16px.

at win32 level, application supplies hicon, , scheme draws that. if needs resize it, will. cannot custom draw in notification area.

imagine if applications custom draw in notification area? take couple of applications decide awesomely of import had custom draw big amounts of information. , there'd no room left rest of taskbar.

so, bottom line here need find other ui approach solve problem.

c# windows notifyicon

C# ConfigurationManager not returning value -



C# ConfigurationManager not returning value -

i'm trying value configuration file

<?xml version="1.0" encoding="utf-8" ?> <configuration> <appsettings> <add key="musicpath" value="c:/users/alvaro/music" /> </appsettings> </configuration>

and how handle it

this.config = new configurationhandler(); string musicpath = this.config.musicpath(); directoryinfo dinfo = new directoryinfo(musicpath);

and configurationhandler class

namespace raggaerplayer.class { class configurationhandler { public string musicpath() { string path = configurationmanager.appsettings["musicpath"]; homecoming path; } } }

but got error @ directoryinfo variable "value cannot null".. doing wrong?

i believe file should named app.config. rename it, think causes versioning problems.

c#

parsing - Parse android application query: saving retrieved data -



parsing - Parse android application query: saving retrieved data -

i utilize parse.com integer, saves how many gold user has. tried this:

parsequery<parseobject> query = parsequery.getquery("gold"); query.whereequalto("username", username); query.findinbackground(new findcallback<parseobject>() { public void done(list<parseobject> scorelist, parseexception e) { if (e == null) { //how can save gold integer? } else { log.d("score", "error: " + e.getmessage()); } } });

that depends key used store gold in parseobject. 1 time have that, can replace comment with:

int score = scorelist.get(0).getint(<keyforgold>);

android parsing

machine learning - How to disable the console output in libsvm (java) -



machine learning - How to disable the console output in libsvm (java) -

i using libsvm in java , experiencing similar issues described here python.

i getting lot of console output during training , prediction , disable it. sadly, due "service temporary unavaiable" can't access website, might described (here). couldn't find java related way disable warnings (if did oversee apologize)

the output looks quite similar this:

optimization finished, #iter = 10000000 nu = 0.013178458659415372 obj = -11.005078334927212, rho = -2.1799731001804696 nsv = 20, nbsv = 5 total nsv = 20

do know how can disable kind of output in java?

thanks lot help.

to disable output programmatically need following:

svm.svm_set_print_string_function(new libsvm.svm_print_interface(){ @override public void print(string s) {} // disables svm output });

java machine-learning classification svm libsvm

ruby - unable to identify iframes using page-object -



ruby - unable to identify iframes using page-object -

i tried different ways identify nested frame using page-object tried in_iframe(index: 1) |frame|..end , tried id & class no luck

<div id="tabswrapper"> <table id="defaulttabs" width="100%" cellspacing="0" cellpadding="0" border="0"> <tbody> <tr> <td class="tabcontentcell"> <div id="tabcontentcontainer" style="height: 443px;"> <a id="top" name="top"></a> <div id="tabdefaultcontent"> </div> <div id="tab14036918566282content" class="tabcontent" style="display: none;"> <iframe id="tab14036918566282frame" class="portal xicseamlessui" width="100%" height="716px" frameborder="0" "="" name="tab14036918566282frame" marginheight="0" marginwidth="0" src="/mywork/ptl/secure/defaultportal" style="height: 443px;"> <!doctype html> <html class="ltr yui3-js-enabled gecko ltr js firefox firefox24 firefox24-0 win secure" lang="en-us" dir="ltr"> </iframe> </div> <div id="tab14036918654673content" class="tabcontent"> <iframe id="tab14036918654673frame" class="portal xicseamlessui" width="100%" height="716px" frameborder="0" "="" name="tab14036918654673frame" marginheight="0" marginwidth="0" src="/ncs/secure/jas/create" style="height: 443px;"> <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html lang="en" xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head> <body class="browserff browserff3 init"> <div class="xicseamlessui" xic:app="create" xic:title="create"> <span id="bfeedback" class="feedback"> </span> <div id="confirmationwindow69" xic:width="50%"> <div id="contentmodalwindow6c" xic:width="50%"> <input id="hiddentext" class="xicinputtext" type="text" size="1" style="visibility:hidden" name="hiddentext"> <input id="hiddencheckbox" type="checkbox" onclick="var wcall=wicketajaxpost('?wicket:interface=:0:hiddencheckbox::ibehaviorlistener:0:', wicketserialize(wicket.$('hiddencheckbox')),null,null, function() {return wicket.$('hiddencheckbox') != null;}.bind(this));" name="hiddencheckbox" style="visibility: hidden"> <table cellspacing="0" cellpadding="0"> <tbody> <tr> <td width="83%"> </td> <td width="17%" align="right" nowrap="nowrap"> <label id="categorydescription65">select category: </label> <span id="categorydescriptiondropdown66"> <div class="xicinputwrapper xicinputwrapperselect"> <select id="celldropdown67" class="xicsmartselectloaded" name="categorydescriptiondropdown:celldropdown" onchange=".page.showpleasewait('processing...');var wcall=wicketajaxpost('?wicket:interface=:0:categorydescriptiondropdown:celldropdown::ibehaviorlistener:0:', wicketserialize(wicket.$('celldropdown67')),null,null, function() {return wicket.$('celldropdown67') != null;}.bind(this));"> <option value="0" selected="selected">new</option> <option value="1">basic</option> <option value="2">advanced</option> <option value="3">premium</option> <option value="4">other</option> </select> </div> </span> </td> </tr> <tr> <tr> <tr> </tbody> </table> <div id="mypleasewait22" class="xicpleasewait xicfullpagezindex" style="z-index: 2000; display: none;"> </div> <div id="pleasewait" class="xicpleasewait xicfullpagezindex" style="z-index: 6000; display: none;"> </body> </html> </iframe> </div> </div> </td> </tr> <tr> </tbody> </table>

here, there 2 frames 1 active , other hidden.

exception: timed out after 30 seconds, waiting {:css=>"select[name*='description']", :tag_name=>"select"} become nowadays (watir::wait::timeouterror)

this seems me iedriver issue when tried firefox , chrome working fine

ruby iframe selenium-webdriver watir-webdriver page-object-gem

optaplanner - How to use drools planner in netbeans -



optaplanner - How to use drools planner in netbeans -

how utilize drools planner in netbeans.

i'm beginner. used drools drools planner different me.

i tried read user guide. still not understand.

someone can help step step, please.

my english language bad.

drools planner has been renamed optaplanner.

these latest docs on how set optaplanner examples in netbeans. if doesn't suffice, google using existing maven project in netbeans. there's nil specific such setup optaplanner examples, except - @ end - main class , working directory in run configuration, of course.

optaplanner drools-planner

HTML5+javascript , How to connect with database like oracle,msql -



HTML5+javascript , How to connect with database like oracle,msql -

here question:

i want build webapplication using javascript , html5. can tell me how can create connection database oracle or mysql? because in application need load info databse html5 page.

can utilize webservice ? can utilize rest ?

what options , possibilities.

you may utilize ajax phone call php , transactions illustrated here http://www.w3schools.com/php/php_ajax_database.asp

javascript database html5 web-services rest

ios - How to change the Content Node for a CCSrollView in SpriteBuilder -



ios - How to change the Content Node for a CCSrollView in SpriteBuilder -

i'm building game requires levels. these levels, fit onto 1 page have had add together them ccscrollview. view loads automatically, have set in spritebuilder app. ccsrollview has been added in mainscene.ccb file, , content node scroll view level.ccb. i'm trying have button in level.ccb changes scene/content node level called gameplay.ccb. i've tried writing code alter scene in mainscene.m , level.m files in xcode. these bring error. i'm still learning code, sorry if question has been asked or has easy solution

- (void)levelone { ccscene *gameplayscene = [ccbreader loadasscene:@"gameplay"]; [[ccdirector shareddirector] replacescene:gameplayscene]; }

this piece of code how switch scene without scrollview

if not understand problem , code send me message , email source code

thanks!

ios uiscrollview cocos2d-iphone spritebuilder

c# - No action on Html.Beginform -



c# - No action on Html.Beginform -

i have @using (html.beginform()) on partial view on application developing. have textbox on page , on clicking come in button after entering textbox submitting form. there anyway can tell mvc not preform action in beginform helper?

i tried passing @using (html.beginform(null)) got same result. realise take out html.beginform , utilize tags , have javascript homecoming false submit action wondering there anyway can accomplish behavior html.beginform?

update - showing partial view

<div class="row"> <div class="col-xs-12 h-form no-padding"> @using (html.beginform(null)) { @html.antiforgerytoken() <p> <div> <input id="txtsearch" type="text" placeholder="search..."> </div> </p> } </div> </div>

update ii seems if there 1 text field there , nail come in form submitted on post action. if set 2 text fields on page hitting either no post action invoked.

anyway going remove html.beginform() , utilize <form onsubmit="return false">

if want when click on submit button form doesn't submit.the submit button type must button

<input **type="button"** value="create" onclick="ajaxsubmit();" />

c# asp.net-mvc asp.net-mvc-5 html-helper

ios - Custom cell in UITableView make images overlap on scroll -



ios - Custom cell in UITableView make images overlap on scroll -

i have created custom table view cell have 2 images on (initially set hidden). when render each cell check status , set images visible/hidden property. when open table looks fine when scroll bottom , top first 2-3 cells have both image displayed.

- (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath{ static nsstring *cellidentifier = @"mycustomcell";{ ordercustomcell *cell = [tableview dequeuereusablecellwithidentifier:cellidentifier]; if(cell == nil){ [tableview registernib:[uinib nibwithnibname:@"mycustomcell" bundle:nil] forcellreuseidentifier:cellidentifier]; cell = [tableview dequeuereusablecellwithidentifier:cellidentifier]; } ... cell.title.text = @"some value"; ... if(...){ cell.image1.hidden = yes; cell.image2.hidden = no; } else{ cell.image1.hidden = no; cell.image2.hidden = yes; } ...

why happen? problem maybe cellidentifier. update first try:

ordercustomcell *cell; if(cell == nil){ [tableview registernib:[uinib nibwithnibname:@"mycustomcell" bundle:nil] forcellreuseidentifier:cellidentifier]; cell = [tableview dequeuereusablecellwithidentifier:nil]; }

second try:

ordercustomcell *cell = [tableview dequeuereusablecellwithidentifier:cellidentifier]; if(cell == nil){ [tableview registernib:[uinib nibwithnibname:@"mycustomcell" bundle:nil] forcellreuseidentifier:nil]; cell = [tableview dequeuereusablecellwithidentifier:nil]; }

- (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath{ static nsstring *cellidentifier = @"mycustomcell"; ordercustomcell *cell = [tableview dequeuereusablecellwithidentifier:nil]; if(cell == nil){ [tableview registernib:[uinib nibwithnibname:@"mycustomcell" bundle:nil] forcellreuseidentifier:cellidentifier]; cell = [tableview dequeuereusablecellwithidentifier:cellidentifier]; } ... cell.title.text = @"some value"; ... if(...){ cell.image1.hidden = yes; cell.image2.hidden = no; } else{ cell.image1.hidden = no; cell.image2.hidden = yes; } ...

ios objective-c uitableview

Opening a dialog box in jquery with php content -



Opening a dialog box in jquery with php content -

i trying open chat portal in dialog using jquery.

here code

<img class="chatbtn" id="chat_btn" style="margin-top: 10px; margin-left: 10px" src="images/colored_livecha.png" alt="" width="80" height="33" /> jquery('.chatbtn').click(function() { var dlg = jquery('#chat_btn').dialog({ autoopen: 'false', modal: 'true', minheight:'300px', minwidth: '300px' }); dlg.load('chat.php', function(){ dlg.dialog('open'); }); });

however on click nil happens. amendments required?

you'll need wrap in script tag.

<script> jquery('.chatbtn').click(function() { var dlg = jquery('#chat_btn').dialog( { autoopen: 'false', modal: 'true', minheight:'300px', minwidth: '300px' }); dlg.load('chat.php', function(){ dlg.dialog('open'); }); }); </script>

another question, jquery included in head or somewhere in page?

php jquery jquery-ui-dialog

ios - Parse Product Link Returns null -



ios - Parse Product Link Returns null -

i using parse.com store template , having problem accessing parts of info browser. need access column called 'link' info browser , not seem able to. if run linklabel.text = self.product[@"link"]; , nslog nslog(@"%@", linklabel.text]); value returned null.

so decided check value of 'link' is. ran nslog(@"%@", self.product[@"link"]); , still returned null. thought there wrong 'link' tried 'name' nslog(@"%@", self.product[@"name"]);still... nil (it returns (null)).

so have no thought how access link or name viewcontroller. have added @property (nonatomic, strong) pfobject *product; , still nothing.

i able access of objects not accessed servers. in other view (that parse.com built) when run linklabel.text = self.product[@"link"]; , log value off of info browser. doing wrong , need help! give thanks much!

to access info parse ,you need fire query , in homecoming info have provided condition. here's go link , parse , go google. find way fetch info parse. after receiving info populate label's or view controller want to.

ios objective-c xcode hyperlink parse.com

c# - how to read the parameter with params keyword and implementing a function -



c# - how to read the parameter with params keyword and implementing a function -

hi have here code snippet. isn't mine, saw in net while learning on how deal entity framework know including (eager load) navigation properties homecoming iqueryable

what want know is:

how read parameter params system.linq.expressions.expression<func<t, object>>[] includeproperties?

how phone call or utilize function? (should pass collection, right? little illustration great help since larn in way when see demo)

public iqueryable<customer> allincluding(params system.linq.expressions.expression<func<t, object>>[] includeproperties) { var query = context.customers; foreach (var includeproperty in includeproperties) { query = query.include(includeproperty); } homecoming query; }

any help much appreciated. thanks!

params lets pass array parameter actual array or open-ended list of values:

var includes = new expression<func<customer, object>>[] { => i.subproperty1, => i.subproperty2 }; var query = db.entities.allincluding(includes);

or just

var query = db.entities.allincluding(i => i.subproperty1, => i.subproperty2);

i'm guessing on specific types , properties, idea.

c# entity-framework

Removing footer in SAP Crystal Reports 2011 -



Removing footer in SAP Crystal Reports 2011 -

i trying set study print invoice company details part of page footer.

i have set terms , conditions section want printed after else , have set study footer.

this t & c page should not include company info footer , should print on single page.

i have set formula suppress page footer if t&c's have been printed. works , on other reports have set similarly, not force part of t&c's on sec page.

the problem having particular study company info footer several lines opposed single line (as others) , though suppress footer on t&c's page, still reserves space footer have gone , pushes end few lines of t&c's additional page.

this happened before well, footers before had been single line instead, there still plenty space print total t&c's on page after reserving space footer.

is there way me suppress footer without space beingness reserved, or putting suppressed footer in 'background' rest of t&c's can print in front?

the client have specified required font size , styling study cannot cut down size of footer and/or t&c's solve problem.

right click on section >> section expert >> check suppress blank section, if section blank suppressed , removing footer empty space.

crystal-reports

forms - How to process select box in PHP when you want to process the actual '' and not the 'value' attribute? -



forms - How to process select box in PHP when you want to process the actual '<option>' and not the 'value' attribute? -

<span> kamertype :</span> <select class="autowidthselect" required area-required="true" name="prijskamertype" onchange="calculateprice()" id="prijskamertype"> <option selected="selected" value="">selecteer kamertype</option> <option value="295">kraaiennest</option> <option value="395">kajuit</option> <option value="495">kapiteinshut</option> </select>

when process above php code below, shows me content defined in 'value' attribute, in case prices. want show content defined in <option> tag (kraaiennest, kajuit, kapiteinshut). how accomplish that?

(i can not alter values, because of calculation of total cost @ end of form)

<?php $prijskamertype = $_post ['prijskamertype']; echo $prijskamertype.' type'; ?>

edit:

i have created array , drop-down list it:

<?php $optionskamertype = array(); $optionskamertype[""] = "selecteer kamertype"; $optionskamertype["295"] = "kraaiennest"; $optionskamertype["395"] = "kajuit"; $optionskamertype["495"] = "kapiteinshut"; ?>

html-code:

<span> kamertype :</span> <select class="autowidthselect" required area-required="true" name="prijskamertype" onchange="calculateprice()" id="prijskamertype"> <?php foreach($optionskamertype $key => $value) { echo '<option value="'. $key .'" label="'. $value .'">'.$value.'</option>'; } ?> </select>

what have now?

this isn't php, it's how html forms work: thing sent server browser content of value attribute. (or, if there isn't one, content of alternative tag, doesn't help here because still 1 value.)

what can do, though, have array in php code has values , labels of options. can utilize create drop-down in first place, , when form submitted this:

$label = $option_list[ $_post['whatever'] ];

php forms drop-down-menu form-processing

handsontable - Context menu to add column not working when defining columns property to hide some columns -



handsontable - Context menu to add column not working when defining columns property to hide some columns -

i needed way create spreadsheet user can potentially paste in no of columns. pasting things in spreadsheet not work mentioned here https://github.com/warpech/jquery-handsontable/issues/553, wanted enable context menu add together column. works fine when have plain array info source , not setting columns property, if need define columns attribute things dont work when setting

contextmenu: ['col_right']

. needed define columns property because need hide columns (as mentioned here https://github.com/warpech/jquery-handsontable/issues/120). way create things work define custom action context menu, not sure how go it.

here jsbin : http://jsfiddle.net/8v4z5/1/

thanks

ok 1 work around worked me requires playing bit info structure. seeing create context menu work when info source plain array , "columns" property should not defined , had provide plain array info source. illustration like:

var actualdata = [ {"spreadsheetdata":[ "kia", "nissan", "toyota", "honda"]}, {"year":"2008", "spreadsheetdata":[10, 11, 12, 13]}, {"year":"2009", "spreadsheetdata":[ 20, 11, 14, 13]}, {"year":"2010", "spreadsheetdata":[30, 15, 12, 13]} ]; var info = []; actualdata.foreach(function(d){ data.push(d.spreadsheetdata); });

example: http://jsfiddle.net/yw3we/

handsontable

Ruby on Rails: Create doesn't work. Data doesn't insert to database -



Ruby on Rails: Create doesn't work. Data doesn't insert to database -

two simple model:

record

class record < activerecord::base has_many :comments validates :title, presence: true, length: { minimum: 5 } end

comment

class comment < activerecord::base belongs_to :record end

in viewer

<h2>add comment: </h2> <%= form_for([@record, @record.comments.build]) |f| %> <p> <%= f.label :commenter %><br> <%= f.text_field :commenter %> </p> <p> <%= f.label :body %><br> <%= f.text_area :body %> </p> <p> <%= f.submit %> </p> <% end %>

in controller

def create @record = record.find(params[:record_id]) @comment = @record.comments.create(comment_params) logger.debug "comment check: #{@comment.attributes.inspect}" redirect_to record_path(@record) end

logger information:

i, [2014-06-26t14:13:49.802139 #20539] info -- : processing commentscontroller#create html i, [2014-06-26t14:13:49.802236 #20539] info -- : processing commentscontroller#create html i, [2014-06-26t14:13:49.802300 #20539] info -- : parameters: {"utf8"=>"✓", "authenticity_token"=>"12u1/kgn8bacy8jn/tji3ux7m258fzpfrahguhl9wnm=", "comment"=>{"commenter"=>"qwe", "body"=>"asdsa"}, "commit"=>"create comment", "record_id"=>"4"} i, [2014-06-26t14:13:49.802338 #20539] info -- : parameters: {"utf8"=>"✓", "authenticity_token"=>"12u1/kgn8bacy8jn/tji3ux7m258fzpfrahguhl9wnm=", "comment"=>{"commenter"=>"qwe", "body"=>"asdsa"}, "commit"=>"create comment", "record_id"=>"4"} d, [2014-06-26t14:13:49.807062 #20539] debug -- : record load (0.1ms) select "records".* "records" "records"."id" = ? limit 1 [["id", 4]] d, [2014-06-26t14:13:49.807138 #20539] debug -- : record load (0.1ms) select "records".* "records" "records"."id" = ? limit 1 [["id", 4]] d, [2014-06-26t14:13:49.810514 #20539] debug -- : (0.1ms) begin transaction d, [2014-06-26t14:13:49.810599 #20539] debug -- : (0.1ms) begin transaction d, [2014-06-26t14:13:49.821927 #20539] debug -- : (0.1ms) commit transaction d, [2014-06-26t14:13:49.822023 #20539] debug -- : (0.1ms) commit transaction d, [2014-06-26t14:13:49.822159 #20539] debug -- : comment check: {"id"=>nil, "commenter"=>"qwe", "body"=>"asdsa", "record_id"=>nil, "created_at"=>nil, "updated_at"=>nil} d, [2014-06-26t14:13:49.822201 #20539] debug -- : comment check: {"id"=>nil, "commenter"=>"qwe", "body"=>"asdsa", "record_id"=>nil, "created_at"=>nil, "updated_at"=>nil} i, [2014-06-26t14:13:49.822667 #20539] info -- : redirected http://0.0.0.0:3000/records/4 i, [2014-06-26t14:13:49.822714 #20539] info -- : redirected http://0.0.0.0:3000/records/4

when create comment, info doesn't write database suggestion? way, why each logger info has double output?

try adding accepts_nested_attributes_for :comments record model

ruby-on-rails ruby

business intelligence - Representing a nested stacked bar chart -



business intelligence - Representing a nested stacked bar chart -

i'm qlikview beginner , i'm working piece of data; trying visualize bar chart.

more specifically, need develop nested stacked bar chart shown in image. @ top level, every project, need have length of stacks of bar chart proportional "totalupdates" 5 different project locations. (loc 1 loc 5)

at sec level, within each 1 of stacks described above, need able represent percentage of completion. updatescompleted/totalupdates. (shaded or colored differently)

i tried using crosstable, did not work. since i'm trying work 3 dimensions, i'm unable find suitable solution handle this. snapshot of input spreadsheet , desired representation attached.

any help much appreciated. give thanks you!

your requirement challenging , have not perfect solution 2 approaches.

the first 1 simple chart 2 dimensions projecttype , projectsource.

the advantage of chart is simple , scales increasing projects , locations. there 2 formulas:

updates: = sum(updatescompleted) total: = sum(totalupdates)

but because of stacking of values changed to:

total: = sum(totalupdates)-sum(updatescompleted)

the sec 1 comes closer requirement:

but uses set analysis (see page 799 in reference pdf) define values of colums , have add together new coloumn when info contains new location.

the description first column (loc 1) is:

='loc 1 ' & round(sum({1<projectsource={'loc 1'}>}totalupdates)*100/sum(totalupdates)) & '%'

and definition is:

=sum({1<projectsource={'loc 1'} >}updatescompleted)/sum({1<projectsource={'loc 1'} >}totalupdates)

additionaly set backgroundcolurs first 3 columns

to visualise progress (<0.5 red; orange; >0.8 green)

hope helps.

bar-chart business-intelligence qlikview

android - Creating spinner like in actionBar -



android - Creating spinner like in actionBar -

i want create spinner actionbar's spinner dropdown view

i have reffered next questions :

how create spinner actionbar in native android ics spinner outside actionbar , not working dropdown menu

but no luck in finding solution.whenever utilize spinner in activity :

spinner spinner = (spinner) findviewbyid(r.id.spiner_id); arrayadapter<charsequence> adapter = arrayadapter.createfromresource(this, r.array.day, android.r.layout.simple_spinner_item); adapter.setdropdownviewresource(android.r.layout.simple_spinner_dropdown_item); spinner.setadapter(adapter);

and in xml :

<spinner android:id="@+id/spiner_id" android:layout_width="wrap_content" android:layout_height="wrap_content" />

it gives output :

i want spinner in dropdown view instead of current dialog form.

p.s : working on 4.2+ version

@pankaj kumar thnak quick reply.i have added android:spinnermode="dropdown" spinner view in xml , works fine.but dropdown list contains radiobuttons also.how can removed list?

thanks!

add android:spinnermode="dropdown" spinner.

like

<spinner android:id="@+id/spiner_id" android:layout_width="wrap_content" android:spinnermode="dropdown" android:layout_height="wrap_content" />

and more details removing radio buttons, read spinner button without radio button.

android android-actionbar spinner

ms word - How Does Microsoft Office knows if a document was downloaded from the internet? -



ms word - How Does Microsoft Office knows if a document was downloaded from the internet? -

does knows how microsoft office knows if document downloaded internet?

when open word document downloaded internet, example, opens in kind of safe mode..

how office knows file downloaded internet?

is possible bypass protected view (by signature example)?

as explained in microsoft office 2010 engineering science blog:

when file downloaded net windows attachment execution service places marker in file’s alternate info stream indicate came net zone. when word, excel or powerpoint file opened , has marker open in protected view until user decides trust , edit it.

the blog linked above goes more detail document:

plan protected view settings office 2013

you can bypass protected view manually within word going

file|options|trust center|protected view

and clearing check box "enable protected view files originating internet"

for additional info see:

how disable protected view in microsoft office while opening email attachments or downloaded files

on enterprise level, utilize office customization tool , grouping policy alter registry keys permanently disable protected view net files. should started:

office customization tool (oct) reference office 2013

ms-word

android - Is it possible to specify testApplicationId per flavor in Gradle? -



android - Is it possible to specify testApplicationId per flavor in Gradle? -

i have 2 product flavors, , set testapplicationid in build.gradle:

defaultconfig { minsdkversion 8 targetsdkversion 19 testapplicationid 'com.example.testapp' }

is possible override testapplicationid in each productflavor? tried overriding testapplicationid in individual productflavors, r.class file doesn't generated, , compile error. read packagename/applicationid not affecting r.class file, i'm not sure if rule holds testapplicationid too.

android gradle android-gradle

php increment operator when pre pending string -



php increment operator when pre pending string -

im not sure why next occurs in php

<?php //make array first $example = array(); $i = 0; while($i < 10) { $example[$i++] = $i; } var_dump($example); //looks here. expected $i = 0; while ($i < 10) { $example[$i] = $i . " " . $example[$i++]; } var_dump($example); //this 1 should contain each of values 1 time again illustration $expected = array( "0 0", "1 1", "2 2", //etc );

when doing same in java

public class append { public static void main(string[] args) { string[] array = new string[10]; int = 0; while (i < 10) { array[i] = i++ + ""; } = 0; while (i < 10) { array[i] = + " " + array[i++]; } = 0; while(i < 10) { system.out.println (array[i++]); } } }

it returns correct, thing can think of operator precedence. because [ out ranks ++ in php , in java ++ outranks ?

sorry theres lot of code, thought explain improve

php increment post-increment

objective c - Add contents of an IBoutletcollection to an array? -



objective c - Add contents of an IBoutletcollection to an array? -

i have 2 iboutletcollections called numbers , symbols. want add together contents of title in array such first element of array numbers , sec symbols, 3rd numbers, 4th symbols , on. there way it?

edit:

//@property (strong, nonatomic) iboutletcollection(uibutton) nsarray symbols; //@property (strong, nonatomic) iboutletcollection(uibutton) nsarray *numbers; -(void)setnumbers:(nsarray *)numbers { _numbers=numbers; (uibutton button in self.numbers) { number * number = [[number alloc]init]; [button settitle:[number randnum] forstate:uicontrolstatenormal]; } }

this code setting title of outlet collection numbers.

here go, assuming iboutletcollections contain elements of class uilabel , have same number of elements:

@property (strong, nonatomic) iboutletcollection(uibutton) nsarray *numbers; @property (strong, nonatomic) iboutletcollection(uibutton) nsarray *symbols; nsmutablearray *result = [[nsmutablearray alloc] initwithcapacity:self.numbers.count+self.symbols.count]; (int = 0; < self.numbers.count+self.symbols.count; i++) { if (i%2 == 0) { [result addobject:((uibutton *)self.numbers[i]).titlelabel.text]; } else{ [result addobject:((uibutton *)self.symbols[i]).titlelabel.text]; } }

the solution problem run loop , in loop modulo calculation 2 find out when have or odd position in result array, , add together element appropriate iboutletcollection. clear?

objective-c arrays iboutletcollection

c - Does hooking GetProcAddress lead to stack corruption? -



c - Does hooking GetProcAddress lead to stack corruption? -

i reverse engineering science program. before start, create clear own programme legally , not plan "crack" purpose of redistribution.

said programme makes utilize quite lot of antidebug techniques "from book". decided hook getprocaddress , log apis, later identifying might used antidebugging. after using code tutorial http://www.codeproject.com/articles/30140/api-hooking-with-ms-detours programme crashes stack corruption. googled , found other people stack corruption when hooking getprocaddress https://easyhook.codeplex.com/discussions/55039

my question if hooking getprocaddress leads stack corruption or program's antidebug techniques observe meddling , cause stack corruption themselves?

in general, hooking getprocaddress not cause stack corruption. have written several tools time , have worked years on versions of windows windows 95 through windows 8.1.

so it's doing explicitly annoy ;)

c windows winapi hook getprocaddress

I would like to read the WiFi rssi values between 2 android phones -



I would like to read the WiFi rssi values between 2 android phones -

i have 2 android phones , can measure each of respective rssi measurements connected wireless access points. able read rssi between 2 phones themselves, view estimate distance between each device.

one way see in order calculate rssi between each other next logic:

make 1 android device (lets device_1) access point using wifi tethering let other android device (lets device_2) measure rssi device_1. possible because due wifi tethering of device_1 device_2 able see device_1 in wifi scan results , if want connect that. now create opposite one. create device_2 create utilize of wifi tethering , allow device 1 calculate rssi device_2.

in order grab possible questions on that, have both ways, meaning both devices must utilize wifi tethering , 2 measurements. 2 reasons. firstly, multiple devices have defferent transmit powers so, read different rssi values (even if transmitted powerfulness same 1 time again due different scatterring environment rssi values differ). secondly, more accurate if obtain 2 values , improve if repeat methodology more 1 time , create average of them, maintain in mind cannot split dbm values. can take in reply on next post that

wifi readings unstable in android

android android-wifi rssi

No result when animating styles in JQuery -



No result when animating styles in JQuery -

i'm using next code animate margin-top css style of div id of "div".

html:

<div id="div"> <p> lorem ipsum dolor sit down amet, consectetur adipiscing elit. </p> <button id="trigger"> alter margin </button> </div>

javascript (in head section):

<script type="text/javascript" src="scripts/jquery-1.11.0.min.js"></script> <script> $("trigger").mouseup(function() { $("div").animate({ margintop: "-20px" }); }); </script>

however, when click button, nil happens... why that?

jsfiddle: http://jsfiddle.net/zlx5u/

1)trigger id ,your missing '#' in jquery code. 2) wrap jquery code in document.ready.

$(document).ready(function(){ $("#trigger").mouseup(function() { $("div").animate({ margintop: "-20px" }); }); });

please see this fiddle.

jquery jquery-animate

jquery - How do i position a div relative to the window page (responsive css) -



jquery - How do i position a div relative to the window page (responsive css) -

so made button hides , shows div placeholder text:

<button id="btn1">click display div1</button> <div id="div1"></div>

the #div1 positioned absolute cause don't want fixed.

when click button how create appear within window screen? , has 10px top window screen?

and additional question how center div?

here fiddle

try

$("#btn1").click(function(){ $("#div1").css("top",($(document).scrolltop() + 10) +'px').fadetoggle(); });

to create div in center

#div1{ position:absolute; background-color:#007c7c; width:500px; height:500px; color:white; left:50%; margin-left:-250px; }

working demo

jquery html css

ios - ECSlidingViewController with Push and Unwind Segue -



ios - ECSlidingViewController with Push and Unwind Segue -

i using ecslidingviewcontroller storyboards. ecslidingvc root (starting) controller. left menu tableview static cells, , topviewcontroller navigation controller. want have single navigationcontroller app.

from left menu cant utilize force or unwind segues, understand part though. can utilize ecslidingsegue changes topviewcontroller of ecslidingvc , destroys navigation controller , it's stack.

i want able go menu item vc previous vc in main nav controller. lets want ecslidingvc not alter topviewcontroller force destination viewcontroller source.topviewcontroller.navigationcontroller.

also need utilize unwind segues menu items. need go vc in main nav controller.

i inspected ecslidingsegue source code , replace topviewcontroller.

is there built in method (or segue) in ecslidingviewcontroller pushing (or unwinding) vc source.topviewcontroller.navcontroller or need implement custom segue myself?

i think best way go implement custom segue yourself. ecslidingnavigationsegue, topviewcontroller, check whether it's uinavigationcontroller , force destinationcontroller it.

it's same perform method ecslidingsegue, feature of pushing controller topviewcontroller instead of replacing it.

good luck!

ios objective-c segue ecslidingviewcontroller ecslidingviewcontroller-2

java - How can i get checked checkboxes values from checkbox when checkbox made programmatically in android -



java - How can i get checked checkboxes values from checkbox when checkbox made programmatically in android -

i making check-boxes programmatically. , want value of checked check-boxes when click on button... how can this....

i getting value of checkboxes database.

here working code..

public class loyaltyprogram extends activity { sessionmanager session; edittext mpv, discount; button save; string finalresult, getflag, statusemp, accessname, emp_id, bus_id, preferences, bus_type_id, emp_access_name, responsestring, success, name, id, pref, per_amout, percentage, datediff, dateno, minpvalue , discountonit; toast tag; // flag net connection status boolean isinternetpresent = false; // connection detector class connectiondetector cd; progressdialog pdialog; int a; string[] idsplit, namesplit, prefsplit; list<string> testarraylist; linearlayout llmain; linearlayout[] llayout; integer count1 = 0; context mcontext; textview tvo; checkbox cb; stringbuffer result = new stringbuffer(); @override protected void oncreate(bundle savedinstancestate) { // todo auto-generated method stub super.oncreate(savedinstancestate); setcontentview(r.layout.loyaltyprogram); tvo = (textview) findviewbyid(r.id.tvother); mpv = (edittext) findviewbyid(r.id.et_minpurchase); discount = (edittext) findviewbyid(r.id.et_discount); isinternetpresent = cd.isconnectingtointernet(); if (isinternetpresent) { new homedatanew().execute(); llmain = (linearlayout) findviewbyid(r.id.linearlayoutmain); } else { toast toast = toast.maketext(getapplicationcontext(), "check net connection", toast.length_long); toast.setgravity(gravity.center, 0, 0); toast.show(); } save = (button) findviewbyid(r.id.button); save.setonclicklistener(new onclicklistener() { @override public void onclick(view v) { // todo auto-generated method stub minpvalue = mpv.gettext().tostring(); discountonit = discount.gettext().tostring(); for(int t = 0; t<idsplit.length; t++) { if(cb.ischecked()) { system.out.println(idsplit[t]); } } } }); } class homedatanew extends asynctask<string, string, string> { @override protected void onpreexecute() { super.onpreexecute(); pdialog = new progressdialog(loyaltyprogram.this); pdialog.setmessage("loading data.."); pdialog.setcancelable(false); pdialog.show(); } protected string doinbackground(string... params) { httpclient httpclient = new defaulthttpclient(); httppost httppost = new httppost( "http://10.0.2.2/amardeep/android_api/checkbox.php"); seek { session = new sessionmanager(getapplicationcontext()); // user info session hashmap<string, string> user = session.getuserdetails(); // id bus_id = user.get(sessionmanager.key_b_id); bus_type_id = user.get(sessionmanager.key_b_type_id); list<namevaluepair> namevaluepairs = new arraylist<namevaluepair>( 2); namevaluepairs.add(new basicnamevaluepair("bus_type_id", "bt101")); namevaluepairs.add(new basicnamevaluepair("bus_id", "b101")); httppost.setentity(new urlencodedformentity(namevaluepairs)); httpresponse response = httpclient.execute(httppost); response.getstatusline().getstatuscode(); httpentity getresponseentity = response.getentity(); responsestring = entityutils.tostring(getresponseentity); } grab (clientprotocolexception e) { // todo auto-generated grab block } grab (ioexception e) { // todo auto-generated grab block } homecoming responsestring; } @suppresslint("newapi") protected void onpostexecute(string resultstr) { seek { jsonobject json = new jsonobject(responsestring); jsonarray jarray = json.getjsonarray("customer"); (int = 0; < jarray.length(); i++) { jsonobject json_data = jarray.getjsonobject(i); success = json_data.getstring("success"); id = json_data.getstring("id"); name = json_data.getstring("name"); pref = json_data.getstring("pref"); per_amout = json_data.getstring("per_amount"); percentage = json_data.getstring("percentage"); datediff = json_data.getstring("datediff"); dateno = json_data.getstring("dateno"); if (percentage.equals("null")) { percentage = ""; } if (per_amout.equals("null")) { per_amout = ""; } if((datediff.equals("no"))&&(dateno.equals("no"))) { count1 = 1; } else if((datediff.equals("yes"))&&(dateno.equals("no"))) { count1 = 2; } else { count1 = 0; } idsplit = id.split(","); = idsplit.length; namesplit = name.split(","); prefsplit = pref.split(","); testarraylist = new arraylist<string>( arrays.aslist(prefsplit)); } } grab (jsonexception e) { // todo auto-generated grab block e.printstacktrace(); } if (success.equals("1")) { mpv.settext(per_amout); discount.settext(percentage); if ((count1.equals(1)) || (count1.equals(2))) { mpv.setenabled(true); discount.setenabled(true); } else { mpv.setenabled(false); discount.setenabled(false); save.setenabled(false); } int b = (a / 5); int c = (a % 5); if (c != 0) { b = b + 1; } llayout = new linearlayout[b]; (int j = 0; j < b; j++) { int x = 0; x = x + (j * 5); llayout[j] = new linearlayout(loyaltyprogram.this); llayout[j].setlayoutparams(new layoutparams( layoutparams.wrap_content, layoutparams.wrap_content)); llayout[j].setorientation(linearlayout.vertical); llmain.addview(llayout[j]); (int = x; < x + 5; i++) { if (x > a) { break; } else { if (testarraylist.contains(idsplit[i])) { cb = new checkbox(loyaltyprogram.this); cb.settext(namesplit[i] + (i + 1)); cb.setid(i + 1); cb.setchecked(true); cb.settextcolor(color.black); cb.settextsize(12f); cb.setbuttondrawable(r.drawable.checkbox); cb.setpadding(35, 5, 25, 5); if (count1.equals(1)) { cb.setenabled(true); } else { cb.setenabled(false); } llayout[j].addview(cb); } else { cb = new checkbox(loyaltyprogram.this); cb.settext(namesplit[i] + (i + 1)); cb.setid(i + 1); cb.settextcolor(color.black); cb.settextsize(12f); cb.setbuttondrawable(r.drawable.checkbox); cb.setpadding(35, 5, 25, 5); if (count1.equals(1)) { cb.setenabled(true); } else { cb.setenabled(false); } llayout[j].addview(cb); } } } } } else { toast.maketext(getapplicationcontext(), "data empty", toast.length_long).show(); mpv.setenabled(true); discount.setenabled(true); } pdialog.dismiss(); } } }

just within loop , if , else condition

cb.settag(i+99); // set tag values can refer them later. cb.setoncheckedchangelistener(handlecheck(cb)); // here pass checkbox object.

then handlecheck method

private oncheckedchangelistener handlecheck (final checkbox chk) { homecoming new oncheckedchangelistener() { @override public void oncheckedchanged(compoundbutton buttonview, boolean ischecked) { // todo auto-generated method stub if(!ischecked){ toast.maketext(getapplicationcontext(), "you unchecked " + chk.gettag(), toast.length_long).show(); } else { toast.maketext(getapplicationcontext(), "you checked " + chk.gettag(), toast.length_long).show(); } } }; }

hope gives idea. happy coding :)

java android checkbox android-checkbox