Posts

Showing posts from April, 2015

anonymous types - c#, what does method ( new { x=y.property } ) mean? -

i've been watching videos on asp.net mvc, think question general c# 1 though. i notice in example code, method paramters called this blah.method("something here", "something else", new { blah=item.someproperty }); can explain happening 3rd parameter? see video watching, method takes in object third paramter. it anonymous type, property called blah , given value evaluating item.someproperty . in cases interesting way of passing set of key/value pairs - easier dictionary, example: new {forename="fred", surname="jones" } is simpler same dictionary , 2 records ("forename"/"fred", "surname"/"jones"). mvc uses approach in number of places pass in semi-optional parameters (a bit convention on configuration). quite comparable lot of jquery, , let's face it: mvc users using jquery, 2 approaches site quite nicely together. i discuss topic (along string.format ...

cron alternative php tip -

i got file fetch.php for manually calling bookmark once day execute script. i want set kind of cron..that goes fetch.php once day.. is possible.. the fetch.php file has html , bunch of javascript thats why cron doesn't work.. thanks... if need clarification let me know.. in crontab can run lynx command example : lynx -dump http://your.website.com > /dev/null edit: the problem lynxs not run javascript. so need find command line web browser support javascript , not quite simple. check ' links ' or 'w3m' read more in post : http://www.linuxquestions.org/questions/linux-software-2/is-there-a-browser-command-line-tool-for-testing-javascript-websites-359260/

c# - Error ::Invalid token '=' in class, struct, or interface member declaration -

trying hide panel of master page in content page using following code panel p = this.master.findcontrol("panel1") panel; p.visible = false; //error showing on line why error ? i suspect you've got code this: class mypage : page { panel p = this.master.findcontrol("panel1") panel; p.visible = false; } you can't put code in class - other declarations (e.g. fields) needs in method: class mypage : page { public void page_load(object sender, eventargs e) { panel p = this.master.findcontrol("panel1") panel; p.visible = false; } }

opensuse - sh shell emails var/usr/email/dave forwarding -

i'm new opensuse 11.1, have several crontab jobs running, 1 of creates dynamic list of 'at' jobs each day. there way emails 'sh' shell sends /var/usr/email/dave forwarded other email addresses, research has come blank, because i'm not sure i'm looking for. cheers if can help. since looking this, when printing perl after script executed in /bin/sh shell, /bin/sh emails printout /var/usr/mail/dave, simple forward email other pop3 accounts, 1 of accessible phone. apologies original question wasn't clear enough set mailto environment variable in crontab file name of user you'd receive mail. add if it's not there. from man 5 crontab : in addition logname, home, , shell, cron(8) @ mailto if has reason send mail result of running commands in ``this'' crontab. if mailto defined (and non-empty), mail sent user named. mailto may used direct mail multi‐ ple recipients separating reci...

javascript - can I use blur in a hidden field, jquery -

can use blur in hidden field in jquery? if not, how can track changes in hidden field hidden field hidden, won't visible user change something. page author/script can change value , if case, can use change event track changes. $('#hidden_id').change(function(){ alert('changed value: ' + $(this).val()); });

html - flood a div inside another div and set opacity -

say have html object tree follows: <div> <p>text 1</p> <p>text 2</p> <div></div> </div> i want css flood inner div inside of outer one. want text etc appear intact. idea can set bg color , opacity inner div , not affect text. how do this? edit: emphasize on point: set opacity on outer div, text inside fade. don't want happen you set outer div position: relative inner div to: position: absolute; top: 0; left: 0; width: 100%; height: 100%; and set whatever want on it. should cover inside first div. if want text appear on top of set: div p { position: relative; z-index: 1; } div div { z-index: 0; }

php: cookie based sessions -

does body have info/links how integrate cookie based session system? i've used file/mysql, , using memcached. wanted play apc sessions, thought i'd give go @ cookies, don't know it. i imagine i'd have write own session handler class? in php session data stored in file. thing stored in cookie session identifier. when sessions enabled , valid session cookie found, php loads users session data file super global called funnily enough session. basic sessions started using session_start(); called before text sent browser. items added or removed session object using simple array indexing eg. $_session['favcolour'] = 'blue'; later... $favcolour = $_session['favcolour']; basic cookie sessions (no local storage) can created call to set_cookie('favcolour','blue'[,other params]); before text sent browser, retrieved cookie superglobal $favcolour = $_cookie['favcolour']; you don't need call sessio...

json - Epoch Time (Ticks since 1970) - Mac vs. Windows -

i have c# web services return json. .net javascriptserializer returns dates in epoch time (milliseconds since 1970). on windows machine, web based application processes milliseconds proper date without problem. on mac, dates off 1 hour. not every time. sometimes. happening on iphone front end i'm building well. i thought @ first had lost precision when dividing milliseconds 1000 create valid objective-c nsdate object. tested date creation in javascript on mac firefox same timestamp , got same 1 hour offset. any ideas? thanks... edit: noticed in console in xcode date created had -4 or -5 next it. i'm assuming gmt offset. seem vary independent of whether or not date offset 1 hour. -4 dates , -5 dates correct , of either 1 offset. edit: examples using: console.log(new date(-1173643200000)); returns sun oct 23 1932 00:00:00 gmt-0400 (est) console.log(new date(-1031515200000)); returns sat apr 24 1937 23:00:00 gmt-0500 (est) nsdate* date = [nsdat...

Returning a Custom Type from a Postgresql function -

i'm trying return custom type postgresql function follows: drop type if exists gaugesummary_getdaterangeforgauge_type cascade; -- drop our previous type create type gaugesummary_getdaterangeforgauge_type -- recreate our type ( minimum timestamp without time zone, maximum timestamp without time zone ); create or replace function gaugesummary_getdaterangeforgauge ( gaugeid integer ) returns gaugesummary_getdaterangeforgauge_type $$ declare igaugeid alias $1; oresult gaugesummary_getdaterangeforgauge_type%rowtype; begin select oresult min(archivedminimumtime) minimum, max(telemeteredmaximumtime) maximum gaugesummary gaugeid = $1; return oresult; end; $$ language plpgsql; select gaugesummary_getdaterangeforgauge(2291308); there 2 problems i'm having this. 1) - results come single column "("1753-01-01 12:00:00","2009-11-11 03:45:00")", need them come in 2 columns. sol...

java - Compact syntax for instantiating an initializing collection -

i'm looking compact syntax instantiating collection , adding few items it. use syntax: collection<string> collection = new arraylist<string>(arrays.aslist(new string[] { "1", "2", "3" })); i seem recall there's more compact way of doing uses anonymous subclass of arraylist , adds items in subclass' constructor. however, can't seem remember exact syntax. http://blog.firdau.si/2010/07/01/java-tips-initializing-collection/ list<string> s = arrays.aslist("1", "2");

PHP: cannot redeclare class -

so have 3 classes in situation. connection.php engineer.php status.php both engineer , status classes use connection. hasn't been problem i'm using both classes in page i'm getting fatal error: cannot redeclare class connection is there way round this? in both classes need db access connection class. thanks, jonesy instead of using include() use require_once() importing connection.php engineer.php , status.php.

SQL Server 2005 - CTE, retaining values and inserting in datasets -

lets have table such (sql server 2005) pairid childid parentid 0 1 2 1 2 3 2 3 4 and have cte return dataset: pairid childid parentid level 0 1 2 2 1 2 3 1 2 3 4 0 how save initial child id result set instead: pairid childid parentid level 0 1 2 2 1 1 3 1 2 1 4 0 so doing keeping original child id , returning instead of other... this cte query date, works perfectly: with tester (select a.pairid, a.childid, a.parentid, 0 level businesshierarchy left outer join businesshierarchy a2 on a.parentid = a2.childid (a2.pairid null) union select b.pairid, b.childid, b.parentid, oh.level + 1 level businesshierarchy b inner join tester oh o...

iphone - How can I render different paragraph styles in Core Text? -

i'm having difficult time trying work out how build page using core text, have multiple paragraphs follow 1 another, in different styles. in other words, have title paragraph, followed subtitle paragraph, followed several body paragraphs. in html terms, be: <h1>some title</h1> <h2>some subtitle</h2> <p>blah blah... ...</p> i have got far creating ctframesetter title, creating ctframe that, , drawing context. don't understand how create new frame flows on previous paragraph. can please? or there online tutorial help? thanks! :-joe the easiest way style nsattributedstring different styles before create framesetters.

Notepad Tutorial Android - menu problems -

i working on notepad tutorial on android dev site, part 1. have done code in tutorial, tried code form downloaded solution. when launch app don't see button "add note", , therefore cannot continue tutorial. seems methods aren't firing? all see title , note says "there no notes here yet". thanks help!

Emacs shortcuts specific for a file type -

is there way different shortcut different file types? tipically use f12 compile. runs make -f . i'd have f12 running m-x org-export-as-html when i'm on org-mode. how should edit .emacs file? it's just: (global-set-key [f12] 'compile) thanks, hamen add mode hook org-mode local-set-key instead of global-set-key (add-hook 'org-mode-hook (lambda () (local-set-key [f12] 'org-export-as-html)))

WPF, MVVM and Prism modularity -

i still learning use mvvm , prism , have general questions: i have grid in view. lets have button when click want auto size grid columns. code go? resizing grid columns view thing , view model shouldn't know it. in case adding button click handler in view's code behind? have same question grid editing , validation. view model can see when value edited two-way binding if decides value invalid, how can notify grid cancel edit? lets view has number of user controls , each user control needs bind data different object. view model view huge class of data need of different components of view? regarding prism , modular design, trying figure out "module" is. understanding module self contained, meaning if pick module , drop in app, should work. if have class makes service calls (lets soap calls server info) , populates grid, module need include both mvvm components , service layer, right? if have multiple modules use same service layer, each 1 need include ...

visual studio - What does .net source (C#, VB.net) look like in other (non-english) languages? -

as title says, little curious...i have seen european open-source projects post source, syntactically identical. chinese or japanese or other more complex character-based languages? update: little misleading guess. asking "traditional" .net languages c#, vb.net, maybe f# etc. understand there newer .net languages being create support non-english written , spoken languages , appear dissimilar similar source written in vb.net , c#. i try vote few people , mark answer intended question answer. the keywords in english, of code same in language. people use local languages identifier names, others keep names in english too. here's example of how code swedish identifiers: public class stensaxpåse { public enum värde { papper = 0, sten = 1, sax = 2 } private värde _värde; public stensaxpåse(random slump) { _värde = (värde)slump.next(3); } public bool sammasom(stensaxpåse andra) { return _värde == andra._värde; } public bool slår(...

Counting how many times a rating was entered in a MySQL Database using PHP -

i'm trying count how many times article has been rated members buy using php count articles total entered ratings have been stored in mysql database. i want use php , not mysql , wondering how can this? i hope explained right? an example helpful mysql database holds ratings listed below. here mysql database. create table articles_ratings ( id int unsigned not null auto_increment, ratings_id int unsigned not null, users_articles_id int unsigned not null, user_id int unsigned not null, date_created datetime not null, primary key (id) ); create table ratings ( id int unsigned not null auto_increment, points float unsigned not null default 0, primary key (id) ); it's easier sql: select count(*) articles_ratings id = (id value) you of course select * articles_ratings id = (id value) , loop through rows count them -- if database can work you, it's best use it!

excel vba - Run a SQL query on existing recordset? -

i've created 3rd recordset (disconnected) 2 existing recordsets came different connections. now, i'd run sql query on 3rd recordset. i using excel vba. thanks, harry you can use ado recordset filter method sql clauses: filter , recordcount properties example , e.g. rs.filter = "supplierid = 10"

forms - Best practices doing big file upload on the web with progressive enhancement -

i'm building html form user should able upload big files ~100mb. my users coming anywhere can't count on broadband connection, modern browser or availability of javascript/flash. users have these "extras" i'd offer better experience form of feedback on process , flexible form. the thing can think of can go wrong server timeout. i've never built functionality i'd know other people's best practices , serious problems in area are . not entirely relevant backend in php. if backend php among other things need @ upload_max_filesize. configuration issues covered here . making app verify , act on parameters of runtime environment idea because increases fault tolerance. using flash on frontend not recommend because tends fail large files. , without javascript, process feedback isn't possible @ except built-in features of browser. best experience can provide without javascript placing file upload form iframe containing page won't dis...

Weather API with date parameter -

i looking weather api can query latlng , date. date seems hard part. apis seem return weather @ current day and/or week. need work worldwide , not in us. can suggest one? ideally i'd use google or yahoo don't think provide functionality or @ least not documented the forecast.io api provides functionality require. can query coordinates , time in past , future. it's available globally wherever there weather data sources.

What is the favorable naming convention for methods or properties returning a boolean value in Ruby? -

i've seen of these: is_valid is_valid? valid? is there preferred one? edit: more conditionals: has_comment has_comment? comment? was_full was_full? full? please add more descriptive examples. i think convention add '?' @ end of method instead of 'is' valid?

java - Microsoft Access with JDBC: how to get the "caption" property of a given field? -

at work have deal several legacy databases stored in microsoft access format. 1 of informations need extract "caption" property of fields on given table. if using vb script, quite easy, can see on code above: set dao = server.createobject("dao.dbengine.36") set bd = dao.opendatabase(arquivo, false, false, ";pwd=password") set query = bd.openrecordset("select * table") = 0 query.fields.count - 1 on error resume next response.write query.fields(i).name & "=" & query.fields(i).properties("caption") & vblf next how can achieve same results using jdbc? know resultsetmetadata class, , have method called getcolumnlabel(), should return caption property, that's not happening. here our code in groovy: resultset query = conexao.createstatement().executequery("select * table") metadata = query.getmetadata() (i = 1; < metadata.getcolumncount(); i++) { string col...

python - Passing arguments into SUDS client statement -

i using suds (like soap) test wsdl files. methods contain types linked further functions. not sure how access variables stored in types displayed. sample code below: from suds.client import client client=client('http://eample.wsdl') print client response is: ports (1): (ptz) methods (4): absolutemove(ns4:referencetoken profiletoken, ns4:ptzvector destination, ns4:ptzspeed speed, ) types (303): ns4:ptzspeed i able access these functions. cannot find documentation on how test functions in suds. want test see if functions work , checking return values. know how this? i used command below display child functions. client.factory.create('absolutemove.ptzspeed.speed.pantilt') i main problem passing values functions , getting return values. i have tried pass arguments parameters have attributes stored in attributes. below shows layout structure of parameters i'm trying access. (absolutemove){ profile...

How do I suppress warnings in Eclipse for PHP? -

in eclipse, i'm getting warnings not having start tag ( <div> ) because start tag in file. how suppress warning keep out of "problems" window? i know in java @suppresswarning, don't know how php. assume there is, based on availability of php type hinting in eclipse, maybe isn't? you may set on per project base. go project -> properties -> validation and modify settings like. can suppress lot of warnings, html -> document type -> invalid location!

version control - New to git -- how do I get changes from cloned repo into original repo? -

this quite newb question, can't seem figure out. here's did... on server (via ssh): created site on dedicated server created git repo there ( git init think?) added , committed everything at office: cloned repo on development machine pulled everything made changes local files added files again (is right? not svn!) did commit did push ...now, on server, if git show , shows diff server's last copy of stuff removed , stuff pushed office being added. that's want happen. can't figure out is: what need on server make changes pushed office become "live?" i've had pretty success deploying websites svn in past, , figure can away with git too... i'm missing piece of puzzle. help. edit - noticed post: git - pulling changes clone onto master should pulling office repo onto server instead of pusing there? ssh office server , have git+ssh office pull repo? seems kind of crazy, i'd rather figure out how make push go throug...

actionscript 3 - pass < or > operator into function as parameter? -

inside function there if() statement this: if(passedvalue < staticvalue) but need able pass parameter dictating whether if expression above or is: if(passedvalue > staticvalue) but cant pass < or > operator in has parameter, wondering best way this? also if language using matters actionscript 3.0 thanks!! instead of passing operator, impossible in as3, why not pass custom comparison function? function actualfunction(passedvalue:number, comparefunction:function) { /* ... */ if(comparefunction(passedvalue, staticvalue)) { /* ... ... */ } /* ... */ } then use it: actualfunction(6, function(x:number, y:number) { return x > y; }); or: actualfunction(6, function(x:number, y:number) { return x < y; });

.net - How to set color for a font class- object in VB.NET..? -

how set color font class- object in vb.net..? mean.. dim myfont new font("microsoft sans serif", 16, fontstyle.bold) e.graphics.drawstring(tabmain.tabpages(e.index).text, myfont, systembrushes.highlighttext, paddedbounds) how can set font class object(myfont) - color black. ? just expand systembrushes.highlighttext new solidbrush(color.black) public sub drawstringrectanglef(byval e painteventargs) ' create string draw.' dim drawstring [string] = "sample text" ' create font , brush.' dim drawfont new font("arial", 16) dim drawbrush new solidbrush(color.black) ' create rectangle drawing.' dim x single = 150.0f dim y single = 150.0f dim width single = 200.0f dim height single = 50.0f dim drawrect new rectanglef(x, y, width, height) ' draw rectangle screen.' dim blackpen new pen(color.black) e.graphics.drawrectangle(blackpen, x, y, width, heig...

javascript - how to execute a command after an ajax call? -

i wrote script $.getjson('<%=url.action("jsonsave","controler")%>', { id: newrow.id, personid: newrow.pesronid}, function(data) { $('#grid').trigger('reloadgrid'); //{0} $('#grid').editrow(rowcount); //{1} }) what should {1} executed after {0} answer updated did little research, , seems using jquery grid plugin . has callback called gridcomplete should need. combine original answer use one , set: since events called in order, add method event queue this: $.getjson('<%=url.action("jsonsave","controler")%>', { id: newrow.id, personid: newrow.pesronid}, function(data) { $('#grid').one('gridcomplete', function(){ $('#grid').editrow(rowcount); }); $('#grid').trigger('reloadgrid'); }) using one instead of bind cau...

java - Write Excel data directly to OutputStream (limit memory consumption) -

i’m looking – simple – solution output big excel files. input data comes database , i’d output excel file directly disk keep memory consumption low possible. had things apache poi or jxls found no way solve problem. and additional information need generate .xls files pre 2007 excel, not new .xlsx xml format. know generate csv files i’d prefer generate plain excel… any ideas ? i realize question isn't clear, want able write excel file without having keep whole in memory... the way efficiently use character -based csv or xml (xlsx) format, because can written output line line can per saldo have 1 line @ once in memory time. binary -based xls format must first populated completely in memory before can written output , of course memory hogging in case of large amount of records. i recommend using csv may more efficient xml, plus have advantage decent database server has export capabilities that, don't need program / include new in java. don't know db you...

API to export your voicemails in iphone -

i limited amount of space voicemails on mobile phone. once space full can no longer have ability receive voicemails or have voicemails left me. until delete them or of them. so know possible export voicemails external device, if yes there api doing this. thanks abhishek

listbox - WPF: complex tab focus behavior -

my control constructed nested list boxes , tree views. each list box / tree view item contains rich text boxes , other controls. i want define 'tab' focus behavior such when user clicks 'tab' next focusable item (according order define) become focused. currently doesn't work accept (it works partially). my question not specific case - rather on how define such behavior @ all. extreme example, let's want control , make focus jump between items not physically near. anyone might know how can controlled? joe, mechanism smarter thought, check nesting - works perfectly: <listbox keyboardnavigation.tabnavigation="continue"> <listboxitem focusable="false"> <listbox keyboardnavigation.tabnavigation="continue"> <listbox.items> <listboxitem focusable="false"> <textbox width="300" keyboardnavigation.tabindex=...

mysql - Concatenate JOINS or write recursive function - problem with dynamic number of JOIN queries -

i have following problem solve: let's there table contains number of elements, table copied become table b. in table b of original elements lost , added. reference table ab keeps track of these changes. table b copied table c , again of existing elements lost , added. reference table bc keeps track of these relations. ... etc. there n number of such tables n-1 number of reference tables. if want know of elements of choice in table c present in a, can doing like: select ab.oldid ab join bc bc.newid in (x, y, z) now since number of reference tables can wary, number of join lines can wary. should concatenate query looping on steps , adding join lines or shoudl rather write recursive function selects members of next step , let function call until have end result? or there other better way that? since table names vary, you'll need build kind of dynamical query. if recursive function approach, you'll need pass resultsets between function calls somehow...

How to increase java heap size programmatically -

i have java desktop application searching files , reaching default heap limit pretty soon. wont have access systems installed in want increase jvm heap size in application itself. can me how can programmatically in application setting -xmx 1 gig doesn't mean jvm allocate memory upon start-up. jvm allocate -xms (plus overhead) until more heap space needed. need protect users thrashing virtual memory or failed memory allocation os? if not, set xmx large value. note windows 32bit jvms ignore xmx settings greater 1.2gig, it's best not request more gig or safe.

Pretty URL in Rails when linking -

let's have ruby on rails blogging application post model. default able read posts http//.../post/id. i've added route map.connect ':title', :controller => 'posts', :action => 'show' that accept http//.../title (titles unique) , controller query title , display page. when calling <%= link_to h(post.title), post %> in view, rails still gives me links of type post/id. is possible rails automatically create pretty links me in case? if willing accept: http:/.../1234-title-text can do: def to_param [id, title.parameterize].join("-") end ar::base.find ignores bit after id, "just works". to make /title go away, try naming route: map.post ':id', :controller => 'posts', :action => 'show', :conditions => {:id => /[0-9]+-.*/ } ensure route appears after map.resources :posts call.

flash - Is there any free, small, fast, thing for compiling ActionScript-3 Flex apps on windows? -

what want small, light , powerfull this c# development environment developing as3 ria's on eee pc. on windows. in general need codehinting (at least flashdevelop has) , ui designer-builder (as similar possible 1 have in flash builder @ work,.. @ leat this flex framework 4) main point should eazy in use (user-friendly) , small in size. can anyone, please, me in search? hum... http://wonderfl.net/ ? it's online though, no features code hinting , ui designing. perfect snippets however. for eee , alike, i'd suggest flash developer + flex sdk. if want ui designer, has flash builder or flash ide.

sed - Bash command to remove leading zeros from all file names -

i have directory bunch of files names like: 001234.jpg 001235.jpg 004729342.jpg i want remove leading zeros file names, i'd left with: 1234.jpg 1235.jpg 4729342.jpg i've been trying different configurations of sed, can't find proper syntax. there easy way list files in directory, pipe through sed, , either move or copy them new file name without leading zeros? for file in `ls`; mv $file `echo $file | sed -e 's:^0*::'`; done

Database Design help needed -

i trying develop database model recruitment website , have lot of confusions. job seeker can make 5 resumes online. in location field can add 5 locations @ most. job seeker can fill form , jobs emailed according fields filled up. in form can select many locations want. job poster can posts job. , can add many locations want in job form. i have created location table locations. confused how locations saved in resume, jobemail , jobad table? i can think of 2 solutions. there locations field in each table , location ids posted forms saved in field separated commas. , later on can use mysql function match these locations. create table each table columns resumeid, locationid, , locations saved separate record in table. which of these solution right? or there other way kind of scenarios. thanks create table. never, ever store data comma-separated values. "never, ever" might slight exaggeration in circumstances you'll best served storing data in ...

sql server - How to get unique rows from TSQL based on date open and closed -

i have 2 tables data one: id ans_id user_id date_opened 06146723 858735205 55258 2009-02-20 12:59:47.0000000 06146723 481768765 55258 2009-09-16 17:04:22.0000000 and table 2: id ans_id user_id date_closed 06146723 630993597 5258 2009-04-02 14:35:23.0000000 06146723 1348252927 5258 2010-05-24 16:03:33.0000000 i need combine them , 1 record, per close , open joint. tried this: select distinct a.id ,a.ans_id ,a.user_id ,a.date_opened ,b.date_closed ,b.ans_id table1 inner join table2 b on a.id = b.id , a.date_opened < b.date_closed order a.id, a.date_opened and got: 06146723 858735205 55258 2009-02-20 12:59:47.0000000 2009-04-02 14:35:23.0000000 630993597 **06146723 858735205 55258 2009-02-20 12:59:47.0000000 2010-05-24 16:03:33.00000001348252927** 06146723 481768765 55258 2009-09-16 17:04:22.0000000 2010-05-24 16:03:33.00000001348252927 how...

content management system - Drupal multi-language websites examples -

please let me know if have knowledge important sites use drupal cms , have multi-language support. know job done using google research need quick turnaround. appreciate answers. http://www.drupalsites.net nice site lists drupal sites. here list of tags of sites made in drupal in languages. http://www.drupalsites.net/tagadelic/chunk/8

login authentication in asp.net 2.0 -

i working on asp.net 2.0 , sql server 2005 using login authentication userid = cj , password = 123 when click on login button text welcome cj must displayed. on redirected page welcome if user valid store in session : myuser currentuser = userlogin(username, password); if(currentuser!=null){ session["loggeduser"] = current; response.redirect("~/default.aspx"); } else { //user authentication failed } when access logged user check if session variable null : if(session["loggeduser"]!=null) { myuser currentuser = (myuser)session["loggeduser"]; } when click logout button clean session variable (inside logout method) : session["loggeduser"] = null; good luck!

vba - What is the difference between Dim, Global, Public, and Private as Modular Field Access Modifiers? -

in vb6/vba, can declare module-level variables outside of specific sub or function method. i've used private , public before inside modules , understand them so: public - visible code inside module , code outside module, making global. private - visible code inside module. i've noticed can use dim , global modifiers modular variables. dim , global different private , public , respectively, when used access modifiers on modular fields? if so, how different? dim , private work same, though common convention use private @ module level, , dim @ sub/function level. public , global identical in function, global can used in standard modules, whereas public can used in contexts (modules, classes, controls, forms etc.) global comes older versions of vb , kept backwards compatibility, has been wholly superseded public .

c# - .Net - DataAnnotations - Validate 2 dependent DateTime -

let got following classes: public class post { public date begindate { get; set; } [validate2date(begindate, enddate, errormessage = "end date have occurs after begin date")] public date enddate { get; set; } } public class validate2dates : validationattribute { public validate2dates(datetime a, datetime b) { ... } public override bool isvalid(object value) { // compare date , return false if b < } } my problem how use custom validate2dates attribute because can't that: [validate2date(begindate, enddate, errormessage = "end date have occurs before begin date")] i got following error: an object reference required non-static field, method, or property '...post.begindate.get' c:...\post.cs you can't use attribute that. attribute parameters restricted constant values. imo better solution provide method on class implements check , can called through business logic validation i...

subsonic3 - What is the full syntax for calling a stored procedure in SubSonic 3.0? -

what full syntax stored procedure using subsonic 3.0? here code not working: dataset ds = new dataset(); storedprocedure sp = test.usersp_stock_search("", 0, ""); sp.executedataset(); ds=sp.executedataset()

c# - Datagridview combobox business object updating reference -

i asked question on here , got answer. i'm trying apply same logic on datagridview bound bindinglist< t > of curriculum objects. curriculum class has property of type year. i'm trying use comboboxcolumn update reference curriculum object has of years. the comboboxcolumn bound bindinglist< t > of years, errors if set either display member or value member left them null. doing datagridview loads , displays data correctly (i overrode tostring method on year class). however, if choose year object combobox, end edits throws , exception saying can't convert string type year. it looks need typeconverter it, problem combobox displaying descriptive value, can't guarantee unique year object - have no way of getting year object given string. has got experience in situations these, must pretty common thing want google has failed me on occasion. marlon same problem here . seems object binding in combobox column doesn't work , have specify value...

flex - Adding Tab dynamically -

i have tab , want tab click of button. tab has vbox (contains charts,grid etc). gives error while adding code addchild(), removechild() on button click. error of null object reference. please suggest me. thanks you're trying access children of tab has not been initialized yet. simplest solution change creationpolicy property of tabnavigator "all". you can see explanation of creationpolicy in adobe documentation. if not solution, you're going have post more specific code.

open source - Hash-database of malware and such? -

is there free database of hashes of malware? i'd real database of hashes, there place possible collect data? i've found http://www.team-cymru.org/services/mhr/ , don't offer real database, api access.. if not, have idea how collect on "my own"? you ask these guys , might know. general rule, these databases assets of anti-virus companies. don't give them away (in readable, re-distributable, un-restricted form), , use them 1 base competitiveness in market. open source anti-virus , scanners mail servers might point in right direction. you try , reverse engineer definitions of popular anti-virus vendors , create new database data extrapolated, won't compatible each other , use different hashing/scanning methods ... might illegal ianal.

javascript - Problem with url -

var x = 20; xhr.open('get','http://127.0.0.1:8000/insert/x); how can pass value of x in http string , get xhr.open('get','http://127.0.0.1:8000/insert/20); request? xhr.open('get','http://127.0.0.1:8000/insert/' + x);

c# - Trying to work with tiled maps -

i know being dense here need help. working on program handles mapping of area, need have map georef'd can gather mgrs coords point on map. have lib wrote working images import 1 one using upper left , bottom right coords. calculate number of pixels , offset top left , bottom right of image. what trying create dragable map googlemaps or number of other mapping systems. here's kicker. system running on closed network no access google or other online resource maps. i have 500gb worth of map data can work format not familiar with, xml file georef data, , truck load of files .tileset extension. assume need create sort of tile stitching routine similar see in game engine, have no experience such engines. can give me advice or libs or directions start researching parse , use these tileset files , function going?

oop - How can I tell if a function is being called statically in PHP? -

possible duplicate: how tell whether i’m static or object? let's have fooclass bar() method. inside of bar() method, there way tell if it's being called statically or not, can treat these 2 cases differently? fooclass::bar(); $baz = new fooclass(); $baz->bar(); class fooclass { function bar() { if ( isset( $this ) && get_class($this) == __class__ ) { echo "not static"; } else { echo "static"; } } } fooclass::bar(); $baz = new fooclass(); $baz->bar();

xml - Coop API - posting with PHP -

i'm trying simple post web service using curl , api i'm getting 422 response. code looks like: include 'curlrequest.php'; $secret_key = 'mykeyhere'; $group_id = 'group_id'; $postdata = array( 'group_id' => $group_id, 'key' => $secret_key, 'status' => 'test' ); $curl = new curlrequest('http://coopapp.com/statuses/update.json'); $curl->exec(array( curlopt_post => true, curlopt_postfields => json_encode($postdata) )); i'm using existing curl library handle posts. i'm sure has way i'm formatting post url (i've tried bunch of different ways) or way i'm posting data. their docs here: http://coopapp.com/api/statuses thanks! here's quote api page post /statuses/update.xml?group_id=#{group_id}&status=an%20encoded%20status&key=#{secret_key} its supposed key not secret_key $postdata = array( 'group_id' => $...

c# - Determining casting of an object -

i have code below rssfeedreader rss = (rssfeedreader)this.parenttoolpane.selectedwebpart; my problem @ run time know if 'this.parenttoolpane.selectedwebpart' of type rssfeedreader or of type 'rsscountry' how check object type , cast appropriatley? many thanks, you can this: if (this.parenttoolpane.selectedwebpart rssfeedreader) //... to check if of type. alternatively, can use 'as' use type, , null if not of type. rssfeedreader reader = this.parenttoolpane.selectedwebpart rssfeedreader; if (reader != null) { //... }

Will the MySQL datetime format work with SQLite and PostgreSQL? -

in mysql enter dates ( datetime field) in format 2009-10-16 21:30:45 . makes simple insert times database. $date = date('y-m-d h:i:s', $timestamp); will format work sqlite , postgresql? if not, format use? sqlite uses several date formats ; postgresql uses similar formats , more. both understand yyyy-mm-dd hh:mm:ss.

php - How can I print number in 4 digit? -

i want print list of numbers in php. want print 4 digits of numbers (preceding 0 if necessary), e.g. 0001, 0009, 0076, 0129, 1234 what should do? printf("%04d", $num);

Extract data from large structured file using Java/Python -

i have large text file (~100mb) need parsed extract information. find efficient way of doing it. file structured in block: mon, 01 jan 2010 01:01:01 token1 = valuexyz token2 = valueabc token3 = valuepqr ... tokenx = value123 mon, 01 jan 2010 01:02:01 token1 = valuexyz token2 = valueabc token3 = valuepqr ... tokeny = value456 is there library in parsing file? (in java, python, command line tool) edit: know question vague, key element not way read file, parse regex, etc. looking more in library, or tools suggestions in terms of performance. example, antlr have been possibility, tool loads whole file in memory, not good. thanks! for efficient parsing of files, on big file, can use awk. example $ awk -vrs= '{print "====>" $0}' file ====>mon, 01 jan 2010 01:01:01 token1 = valuexyz token2 = valueabc token3 = valuepqr ... tokenx = value123 ====>mon, 01 jan 2010 01:02:01 token1 = valuexyz token2 = valueabc ...

iphone - Reloading tableView when subclassed causing crash -

hey guys! have problems reloading tableview. have subclasses tableview, class called radiotable . have subclasses tableviewcells, thats not important here. i need point out i'm pretty new, , built subclass tutorials , stuff. first of all, here error message i'm getting when try reload data. reloading [self.tableview reloaddata]. *** terminating app due uncaught exception 'nsinternalinconsistencyexception', reason: '-[uitableviewcontroller loadview] loaded "mainview" nib didn't uitableview.' okay, problem pretty clear. view(my nib-file) not have tableview's connected files owner. , thats tried solve. tried add iboutlet in subclass, , setting tableview-property there. (my tableview-subclass inherited uitableview, thats clear) here init-code: - (id)initwithstyle:(uitableviewstyle)style { if ((self = [super initwithstyle:style])){ radiotable *atableview = [[radiotable alloc] initwithframe:self.tableview.frame style:style]; ...

c# - How do I create a "tabbed" look in a single piece of HTML that I can display in a webbrowser control? -

i have process going create piece of static html associated record. screen load bunch of records have piece of associated static html. while records shown in multi-grid layout, selected record's associated html displayed in web browser control. data growing large screen real estate , i'd show data in logical groups - perhaps tabs - perhaps someother way inside web browser control. there way in html? remember seperate process has preformed associated html , in screen load web browser contro. sample static html i'm talking about: <html> <head> <style type="text/css">td{font-family: arial; font-size: 10pt;}</style> </head> <table border="0"><caption>we confirm following fx transaction</caption> <tr><td>customer:</td><td align = right bgcolor = "#00ffff">phone cust</td></tr> <tr><td>instrument id:</td><td align =...

android - Best practice to pull content from the web? -

i'm new developing android applications, , have little experience java in school. redirected stackoverflow google groups page when looking android beginners group. have question best practice pull content web source , parse it. firstly, have application threaded (by use of handler?), however, issue class have created (server) connect , fetch content fails retrieve content, causes json parser class (jsonparser) fail, , view display nothing. after navigating previous activity, , attempting call connect(), fetch(), , parse() methods on same remote uri, work. why (sometimes retrieve remote data) happen sometimes , not always? best practice, including use of progressdialog , internal handler class, make application seamless user. best place ask question? help here code i'm using now. import java.io.bufferedinputstream; import java.io.bufferedreader; import java.io.ioexception; import java.io.inputstream; import java.net.url; import java.net.urlconnection; import org.apa...

SQL Server 2005 SSIS - How to get special information from the first line of a file -

say have text file looks this: date 1/1/2010 a,b,c a,b,d ... i want import table looks this: 1/1/2010,a,b,c 1/1/2010,a,b,d ... what elegant way that? my best idea far use data flow package, , use flat file source read in file (ignoring first line) , load table. when complete, have script task open file again, read out date, pass date sql task update table date. but surely there less convoluted way? i extract date package datetime variable. then, use data flow extract data mentioned. after within same dataflow, use derived column tranformation add date variable buffer loaded table. it's similar had in mind but, requires 1 less open , close db connection created , disposed using sql task.

javascript - Why aren't $.put() and $.delete() native in jQuery? -

we having discussion internally here @ work jquery having built-in support $.get() , $.post(), not $.put() , $.delete(). some think keep js library size smaller. others think not feature asked for, left plugin developers make. what thoughts community? where stop? $.options() ? $.copy() ? $.mkactivity() ? there many potential http verbs bother create convenience method each. webapps haven't bothered put , delete in past, they're not used often. gain convenience method pretty small; there's not problem using $.ajax() .

Python: multiple properties, one setter/getter -

consider following class definitions class of2010(object): def __init__(self): self._a = 1 self._b = 2 self._c = 3 def set_a(self,value): print('setting a...') self._a = value def set_b(self,value): print('setting b...') self._b = value def set_c(self,value): print('setting c...') self._c = value = property(fset=self.set_a) b = property(fset=self.set_b) c = property(fset=self.set_c) note set_[a|b|c]() same thing. there way define: def set_magic(self,value): print('setting <???>...') self._??? = value once , use a,b,c follows a = property(fset=self.set_magic) b = property(fset=self.set_magic) c = property(fset=self.set_magic) def attrsetter(attr): def set_any(self, value): setattr(self, attr, value) return set_any = property(fset=attrsetter('_a')) b = property(fset=attrsetter('_b')) c = propert...

INVALID SYNTAX ERROR for 'else' statement in python -

i trying write quicksort program in python, i'm getting invalid syntax error @ else statement in second last line below: import random n=int(raw_input("enter size of list: ")) # size of list intlist = [0]*n num in range(n): intlist[num]=random.randint(0,10*n) pivot=random.choice(intlist) list_1=[] # list of elements smaller pivot list_2=[] # list of elements greater pivot num in range(n): if num<=pivot: list_1.append(num) else list_2.append(num) this not complete program still writing. add colon after else looks else: . , pick tutorial ;)

objective c - How do I send key events to a Flash movie in WebKit? -

i trying create site-specific browser application. i've created new cocoa app, added webview window, , loading page. page contains flash movie, can controlled via keyboard. i'd wire menu commands trigger actions, presumably simulating keystrokes. i've traversed view hierarchy , have found nsview contains movie (with class name "webhostednetscapepluginview"). i'm stuck @ point of sending keys. tried using cgeventcreatekeyboardevent() input keeps going top-level webview rather subview containing movie. i tried [[webview window] makefirstresponder: _myview] set target input. is cgeventcreatekeyboardevent() right function here and, if so, how target nsview? many in advance. my original answer work if window active. wanted work when window hidden, , came code below. this works ordinary keys (enter, space, arrow keys, etc.). uses keycodes won't work letters , symbols might move around based on user's language , region. and doesn'...

svn - Adding repository to Eclispe using Subclipse -

all, i have created repository on unix server , trying connect using subclipse on local machine. when try add repository in eclipse, following error: ra layer request failed svn: options of 'https://xxx/<my repository>': 200 ok (https://xxx) i using subclipse plugin. on windows xp machine. there way can check locally repository accessible? try tortoisesvn more descriptive in errors, can check parameters repobrowser. anyway doesn´t seem error, return 200 ok reponse, returning not ok subclipse, url missing information.

windows vista - memory allocation in C -

i have question regarding memory allocation order. in following code allocate in loop 4 strings. when print addresses don't seem allocated 1 after other... doing wrong or sort of defense mechanism implemented os prevent possible buffer overflows? (i use windows vista). thank you. char **stringarr; int size=4, i; stringarr=(char**)malloc(size*sizeof(char*)); (i=0; i<size; i++) stringarr[i]=(char*)malloc(10*sizeof(char)); strcpy(stringarr[0], "abcdefgh"); strcpy(stringarr[1], "good-luck"); strcpy(stringarr[2], "mully"); strcpy(stringarr[3], "stam"); (i=0; i<size; i++) { printf("%s\n", stringarr[i]); printf("%d %u\n\n", &(stringarr[i]), stringarr[i]); } output: abcdefgh 9650064 9650128 good-luck 9650068 9638624 mully 9650072 9638680 stam 9650076 9638736 typically when request memory through malloc() , c runtime library round size of reque...

sqlite python insert -

i have asked similar question before , here detailed explanation of i'm trying achieve i have 2 sqlite tables table1 - standard table - has fields server,id,status table2 - has fields server,id,status,number,logfile table2 empty , table1 has values. i'm trying fill table2 entries table1. can retrieve records table1 ,but while trying insert table2 fails.(but inserting single field works) self.cursor.execute("select * server_table1 limit (?)",t) #insert server_process record in self.server_pool_list: print "--->",record # geting output ---> (u'cloud_sys1', u'free', u'192.168.1.111') self.cursor.execute("insert server_table2(server,status,id) values (?,?,?)",(record[0],)(record[1],),(record[2],)); and let me know how produce more useful error messages when insert fails this statement broken: self.cursor.execute("insert server_table2(server,status,id) values (?,?,?)",(record[0],)...