Posts

c# - Stop executing code when return null on Page_load -

i have page has few properties in .cs, properties later on used in .aspx instance: .cs public string person { get;set; } .aspx <a href="<%= person.website %> >my website</a> the problem here if person null, framework still try run .aspx , end throwing null-exception.. , if make simple check in page_load if(person == null) return it still try execute .aspx, again throw exception so.. question is.. there anyway prevent .aspx getting loaded if persons null if(person == null) //dont run aspx,code response.write("something went wrong!"); thanks in advance! first, can write code : <a href="<%= person != null? person.website : null %> >my website</a> but results in producing unclickable link. propably not desired, isn't it? but such requirements far more easier fulfill using databinding. asp.net has been design mimic windows forms behavior. doing here, "legacy" asp code-style, ...

Linked List in C error -- Invalid Initalizer error -

i attempting create linked list using c (not c++). linked list initialized through function llinit() should return list struct. however, when compile code error stating "error: invalid initializer" in lltester.c file. why this? this function used initialize linked list in llist.c file: list llinit() { list* ll = malloc(sizeof(list)); ll->head = null; ll->tail = null; return *ll; } this list struct in llist.h file: typedef struct { node *head; node *tail; } list; this main function in lltester.c file attempt initialize list: int main() { list mylist= llinit(); //this line error occurs on! return 0; } your code leaking memory, since it's allocating list malloc() returning structure's content by value . if want have function returns empty list value, should that: list llinit() { list ll; ll.head = null; ll.tail = null; return ll; } the above fine, there's no risk of value "di...

c# - How to add CheckBox, Label and DDL to ASP.NET page programmatically? -

i trying add check box, label , ddl asp.net page (aspx) class in c#. have been using literalcontrol _litext = new literalcontrol(); attach label can show them using this.controls.add(_litext); in createchildcontrols() method. how add ddl , check box asp.net page c# code label in same line ddl , checkbox? i have made ddl using syntax: list<dropdownlist> _ddlcollection=new list<dropdownlist>(); (int = 0; < 5; i++) { _ddlcollection.add(new dropdownlist()); } problem not in this.controls.add() call createchildcontrols(). onprerender() method fill ddl , check box. literalcontrol class this? here have tried in onprerender(): foreach (splist list in web.lists) { if (!list.hidden) { _litext.text += @<input type="checkbox">; _litext.text += list.title + "<br />"; } } firs...

rubygems - bundle update FileOverflow - file too large -

i don't have lot of experience building gems (the workflow, etc). anyway, when try reinstall local gem, error: gem::package::tarwriter::fileoverflow: tried feed more data fits in file. this after uninstall gem, repackage gem build , update bundler. can enlighten me error means? i'm assuming gem large. currently, it's 148k. is possible may including gem on in files list? check issue , code provide better error text still not released in rubygems >= 2.2

c++ cli - C++ CLI Wrapper -

i’ve question creating c++ cli wrapper native c++ class used in c#. here example code: #include "stdafx.h" #pragma once using namespace system; namespace wrapper { class nativeclass { public: nativeclass() {} int add(int a, int b) { return a+b; } }; public ref class wrapper { public: wrapper() {pnative = new nativeclass();} int add(int a, int b) { return(pnative->add(a,b)); } ~wrapper() { delete pnative; pnative = 0; } !wrapper() { this->~wrapper(); } //my problem here. nativeclass* getnative() { return pnative; } private: nativeclass* pnative; }; } this code works fine. need retrieve pointer refers native class use in other wrapper classes. however, don’t want function “getnative” visible in c# when...

oracle - SQL Database, ERD, crows foot notation, -

i have erd diagram have crows foot on customer going dotted line straight line membership. mean members must customers , customers may hold membership? regards i'm not sure whether understood correctly. have like customer >- - - - - ----membership correct? if that's case means membership can owned multiple customers, it's compulsory customer have membership (mandatory relationship - if optional you'd have 0 @ membership table line), , dotted line means it's non-identifying 1 (i.e: foreign key not part of members primary key - or customer not identified membership)

tomcat - how to set jsession id with http -only flag on sun one webserver -

may duplicate question far searched above question related tomcat. , few of methods tried using set http-only flag in web.xml doesn work sun 1 webserver. please suggest me how add http-only jsessionid web application runs on sun 1 webserver. thanks the configuration related version of web-app , not related tomcat or webserver 6.0. configuration below possible in version="3.0": <web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://java.sun.com/xml/ns/javaee web-app_3_0.xsd" version="3.0"> <!-- configuration below possible in version="3.0" --> <session-config> <cookie-config> <http-only>true</http-only> </cookie-config> </session-config> </web-app>

How to make a folder in python? -mkdir/makedirs doesn't do this right -

i have little problem. i'm kinda new in python need here. i'm trying make folder should independent on location. the user can on desktop , make on desktop , if in directiory there , so. i mean: os.mkdir('c://program files//....') is not good it's not possible do: os.mkdir('//just folder') ? why have meantion way there? yes can pass folder name os.mkdir it'll create folder in current working directory. may have change current working directory again , again user or pass whole path os.mkdir if don't want that. in [13]: import os in [14]: os.getcwd() out[14]: '/home/monty' in [15]: os.mkdir("foo") #creates foo in /home/monty in [17]: os.chdir("foo") #change current working diirectory `foo` in [19]: os.getcwd() out[19]: '/home/monty/foo' in [18]: os.mkdir("bar") #now `bar` created in `/home/monty/foo`

c# - Parsing any valid DateTime format to SQL Server compatible format? -

i india , here follow dd-mm-yyyy date format. my problem that, our various client needs date time displayed in above format. sql server use our backend,does not recognizes dd-mm-yyyy valid date time format. convert given date mm-dd-yyyy using cultureinfo either using convert.todatetime() or datetime.parse or datetime.tryparse() also, came accross situation, when input date in correct format mm-dd-yyyy or mm/dd/yyyy or yyyy-mm-dd , local system date other above, it throws exception, input string in not in correct format . not able figure out how resolve automatically. exisitng custom method: fails times in of scenarios. /// <summary> /// parses string value supplied value datetime. /// usage: var = common.parsedate(yourdatestring); /// </summary> /// <param name="value"></param> /// <returns></returns> private static datetime parsedate(string value) { datetime i; if (!datetime.trypar...

sql - Not able to get the stored procedure's result in variable? -

i have hierarchy of stored procedures calling 1 in below: 1 2 3 now doing is: first of showing 3rd level sp least level. create proc [dbo].[proc_tbluserschedulenewupdateonly] ( @scheduleid bigint=258, @contactid uniqueidentifier='ede3e474-02ca-49c7-86dd-aa97794ecf8a', @scheduledate datetime= '2012-07-16 00:00:00.000', @starttime varchar(20)='12:03:00.0000000', @endtime varchar(20)='15:00:00.0000000', @location bigint=8, @area bigint=7, @room bigint=9, @enddate datetime='2012-07-16 00:00:00.000', @currenttime datetime='2012-07-16 12:00:35.900', @modifiedby uniqueidentifier='0bf84a77-fac2-44e5-af9b-39740415dbd2', ...

How to check if all inputs are not empty with jQuery -

i need validate form jquery. can check inputs 1 one, it's not practical solution. how can check if inputs non-empty more efficiently? in form can have input elements of different types: text, several groups of radio, select etc. just use: $("input:empty").length == 0; if it's zero, none empty. to bit smarter though , filter out items spaces in, do: $("input").filter(function () { return $.trim($(this).val()).length == 0 }).length == 0;

model view controller - How to bind AngularJS Calendar to a REST resource using MVP -

i’m failing implement binding between rest resource , angluarjs calendar control. seems i’m missing or don’t logically since components working long there separate. used plunker example of calendar implementation: http://plnkr.co/edit/vbydnk?p=preview inside view: ... <div ng-controller="calendarctrl" dev-calendar="uiconfig.calendar" class="span8 calendar" ng-model="eventsources" style="padding-top: 30px;"></div> ... inside controller: xyz.controller('maincontroller', function($scope, $location, $rootscope, mainmodel) { ... // rest call - getpendingobjectsbyuser $scope.pendingobjects = mainmodel.pendingobjectsbyuser.get( {userid : $rootscope.currentuser.userid}, function(response) { // }, function(response) { ...

android - layout accessed from another APK could'nt access its drawable resources -

i accessed layout of apk accessing applicationinfo service , getting resources via packagemanager. works fine if textview , buttons specified in layout. throws resource not found exception if drawable resource used in accessed layout. this code access layout applicationinfo info = packagemanager.getapplicationinfo( packagename, 0 ); resources res = packagemanager.getresourcesforapplication( info ); xmlresourceparser xres = res.getlayout( 0x7f030000 ); hello friend please try this. packagemanager manager = getpackagemanager(); resources = manager.getresourcesforapplication(packname); int resid = resources.getidentifier("image1", "drawable", packname); log.d(tag, "resid = " + resid); drawable image = getresources().getdrawable(resid); log.d(tag, "resid = " + resid);