Posts

Showing posts from August, 2015

ASP.NET C# - using dataset to read one row? -

i'm developing classic webforms application in c# , when have authenticate user, read sql database user data using query that: select userid,username,email,city users username='blablabla' , password='blablabla' i want use sql query in method returns dto object defined in uservalue class. i'm thinking use dataset fill user data executing query. correct approach or expensive , useless use dataset read 1 row query? can advice me? thanks here's code snippet (this ms sql, other flavors of sql should similar) illustrate i'm talking in comment: using (sqlconnection con = new sqlconnection(connectionstring)) { con.open(); sqlcommand cmd = new sqlcommand("select userid,username,email,city users username=@username , password=@password", con); cmd.paramters.addwithvalue("@username", username); cmd.parameters.addwithvalue("@password", password); cmd.commandtype = commandtype.text; ...

android - appwidget not updating itself -

i working on android appwidget , there issues updating appwidget periodically . changed updating period more 30 minutes . still not updating widget public class mywidgetprovider extends appwidgetprovider { final static string item_click_action = "itemclick"; public static final string toast_action = "toast_action"; broadcastreceiver receiver; public void onupdate(context context, appwidgetmanager appwidgetmanager, int[] appwidgetids) { final int n = appwidgetids.length; (int = 0; < n; i++) { int appwidgetid = appwidgetids[i]; log.e("called", "omupdate"); remoteviews views = new remoteviews(context.getpackagename(), r.layout.widget_lay); views.settextviewtext(r.id.textview1, "floating text displayed here .. daily thoughts"); intent intent = new intent(context, remoteserviceemin.class); intent.putextra(appwidgetmanager.extra_appwidget...

iphone - Xamarin: PresentModalView new View is not visible -

i trying navigate(presentmodalview) 1 screen in xamarin(mvvmcross framework_v2), navigation happening(can see navigation bar changing) screen not visible(previous screen visible). possible reason that. ideas? adding code: in mainmenu private void actionfavouritepressed() { viewmodel.showinfocommand.execute (); } in mainmenuviewmodal public mvxrelaycommand showinfocommand { { return new mvxrelaycommand(() => { this.requestnavigate<infoviewmodel>(); }); } }

iphone - Storyboard orientation -

i'm creating 1 ios app , i'm using storyboards create uis. app should support ios5 , above devices in mainstoryboard_iphone , mainstoryboard_ipad have uis designed portrait mode. now need design them work in landscape mode well. what best way that? need create storyboard landscape mode or there easier way? for each ui have set background image using imageview. there image naming convention, when used e.g myimage-landscape.png automatically detects landscape mode image , sets it? you go ahead , create separate storyboard. however actual recommended apple guidelines state constraints designed for. i learnt fantastic tutorial: http://www.raywenderlich.com/50319/beginning-auto-layout-tutorial-in-ios-7-part-2

ruby - Rails Bootstrap Devise Cancan Passenger Ubuntu deployment -

i've installed nginx , passenger made them run run rails i'm getting below error in log connecting database specified database.yml started "/" 111.222.333.444 @ 2013-08-07 19:44:43 +1000 processing homecontroller#index html completed 500 internal server error in 1ms activerecord::statementinvalid (could not find table 'users'): app/controllers/home_controller.rb:3:in `index' i've run rake db:migrate rake db:seed i tried rake db:migrate rails_env="production" rake db:seed rails_env="production" but i'm getting same error. i've tried @ nginx configurations installed via rvmsudo seems ok. passenger installed using gem , nginx preloading passenger hence why i'm getting 500 error page rails. what wrong? http { passenger_root /usr/local/rvm/gems/ruby-2.0.0-p247/gems/passenger-4.0.10; passenger_ruby /usr/local/rvm/wrappers/ruby-2.0.0-p247/ruby; include mime.types; default_type ...

javascript - How to express types in JSON? -

i want store tree data using json, can't figure out how express types nicely. below how xml hypothetical game involving cats , mice like: <level> <entities> <cat> <direction>right</direction> <position x="100" y="100"/> </cat> <mouse> <direction>right</direction> <position x="50" y="50"/> </mouse> </entities> </level> the best json can come follows: { "entities": [ { "type": "cat", "direction": "right", "position": {"x": 100, "y": 100} }, { "type": "mouse", "direction": "right", "position": {"x": 50, "y": 50} } ] } here specify type explicitly. seems xml better fit this, unfortunately, can't use i...

opengl - Where is glTextureVertexPointer defined? -

i cant finding out gltexturevertexpointer defined, there no such function in c++ or java opengl games , i've included , tested opengl. i trying call way gltexturevertexpointer(2, gl_float, texverts); i need function in order draw sprites texture spritesheet. cant find function in google, also, need know full source code if possible. more interesting cant find function in official opengl pages. i have taken function answer: opengl spritesheets - beginner needs guidance there no such function. there gltexcoordpointer , seem have signature you're looking for.

c# - XmlWriter.WriteStartDocument() is not outputting the declaration to the file -

ok have method should read xml documents , wrap them in bigger xml document. <elements> <element> <element> </elements> the issue when using code below output file missing declaration <?xml > any reason why is? hoping stupid missing. xmlwriter xmlwriter = xmlwriter.create(outputfilename, xwssettings); xmlwriter.writestartdocument(); xmlwriter.writestartelement("elements"); foreach (var item in items) { xmlreader = xmlreader.create(item.fullfilename); while (xmlreader.read()) { if(xmlreader.nodetype == xmlnodetype.element) { xmlwriter.writeraw(xmlreader.readouterxml()); break; } } } xmlwriter.writeendelement(); xmlwriter.writeenddocument(); xmlwriter.flush(); xmlwriter.close(); xmlwriter = null; as @tim had hightlighted check had xmlwritersettings incorrectly set xmlwritersettings xwssettings = new xmlwritersettings(); xwssettings.checkcharacters = fal...

xmpp - Best widget for a chat session in Qt -

i implementing desktop qt application uses xmpp library chat. trying find best approach in terms of performance, easy modify, add custom stuff (for instance, show thumbnain if sends me image)... know approach think best: - each element layout or widget , add them 1 one (it seems slow) - listwidget items overloading paint event (problem: don't know item height before painting) - use rich text widget , build chat html page (didn't tried yet) - ?? best regards, qlistview simple irc chat. if planning implement advanced text styling (different fonts, etc.) or images (like said) webview way go. additionally, simpler way qlistview. there's example qt google chat project uses qtwebkit: http://harmattan-dev.nokia.com/docs/library/html/qt4/webkit-googlechat.html

windows phone 8 - Issue with building Apache cordova app for wp8 on win 8 desktop -

i trying build simple app using apache cordova. things went android. when try add wp8 platform on win 8 notebook, show following error: creating cordova-wp8 project: app name : abc namespace : com.sample.abc path : c:\development\abc\platforms\wp8 create success : c:\development\abc\platforms\wp8 error: not find 'create.js' in 'bin' folder, aborting.. please point out doing wrong! check , see if have system requirement add , build cordova project http://cordova.apache.org/docs/en/2.4.0/guide_getting-started_windows-phone-8_index.md.html sometime if proper sdk set not present error may occur.it happened in case.

c# - How to fetch Metadata from shoutcast radio channel for Windowsphone? -

i develop windowsphone 8/7 internet radio app streams audio file shoutcast radio channel.for need extract metadata streaming.now wondering how extract metadata stream. you need create custom mediastreamsource implementation. way you'll have complete control on data received network, , data fed os-provided media codecs. unfortunately task hard. here's document outlining technical challenges i've encountered (and solved): http://const.me/skyfm/technical.aspx

python - Traceback in Smith-Wateman algorithm with affine gap penalty -

i'm trying implement smith-waterman algorithm local sequence alignment using affine gap penalty function. think understand how initiate , compute matrices required calculating alignment scores, clueless how traceback find alignment. generate 3 matrices required have following code for j in range(1, len2): in range(1, len1): fxopen = f[i][j-1] + gap xextend = ix[i][j-1] + extend ix[i][j] = max(fxopen, xextend) fyopen = f[i-1][j] + gap yextend = iy[i-1][j] + extend iy[i][j] = max(fyopen, yextend) matchscore = (f[i-1][j-1] + simmatrixdict[seq1[i-1]+seq2[j-1]]) xscore = ix[i-1][j-1] + simmatrixdict[seq1[i-1]+seq2[j-1]] yscore = iy[i-1][j-1] + simmatrixdict[seq1[i-1]+seq2[j-1]] f[i][j] = max(0, matchscore, xscore, yscore) i unsure if need single matrix traceback, or 1? clarification on how go tracing max score in f appreciated. the important thing remember traceback in smith-waterman ...

javascript - How to make gif image from youtube video? -

Image
anybody me want developing website using php code. gif-king website have completed jpeg image gif creator how create gif image youtube url yt2gif i tried search google there not gives sufficient result fulfill requirement. i got code upload video gif creator unable find script making youtube url gif creator. i got 1 solution first download youtube video using youtube api. convert in gif images. not right way. unable convert in middle part. convert starting not possible download huge number of video youtube. see process of creating gif images youtube url. screenshot-1 : copy youtube url screenshot-2 : paste in website http://www.gif-king.com/make-your-gif3 see below screenshot. click on create gifs after times video details appear see screenshot-3. screenshot-3 : after click on make gif video convert gif. it working small video. not working big video. my php code: ajax.php if(isset($_request['vid'])){ $vidid=$_request['vid']; ...

javascript - get only part of domain from document.domain -

if x.y.z.com document.domain, how z.com out of in java script? > should use regexp? please suggest. in advance! have set below in sample java script function. cannot hard code it. <html> <head> <title>domain</title> <script type="text/javascript"> function test(){ domain="z.com"; //set domain here } </script> </head> <body bgcolor="#e7e7e7" onload="test()"> </body> java script code use construction: document.location.host.split('.').splice(-2, 2).join('.') upd example use document.location.host = 'new2.new.mail.domain.com' function split('.') splits document.location.host . array = ['new2', 'new', 'mail', 'domain', 'com'] function splice(-2, 2) deletes 2 elements end of previous array , return array = ['domain', 'com'] last join('.') function joins . prev...

vb.net - How do I disable opening multiple MDI Child in VB2010 -

i trying create menu driven application using mdi forms. problem menu in mdi parent create new child every time clicked on it. how allow 1 particular instance of child open particular form allow multiple forms different menu open. example, want child "file" open along "edit" child. also, there way close other forms whenever new form open? you can of checking mdichildren array of main form. array list of open mdi children on form. you can determine if instance of form open looping through array , checking if form of type requested open. to close open forms, loop through mdichildren , call close on of forms.

C++ OpenGL, errors when linking, compiling -

witam, nie potrafię sobie poradzić z błędami linkera chyba że kompilatora(i raczej jest kompilator). chciałem swoje stare projekty skompilować na nowo poprawić programy, jednak nie potrafię przejść przez proces linkowania. w folderze z source.cpp posiadam dodatkowo hello, cant move on errors linker, or compiler. want compile old projects, cant cope errors. in folder source.cpp have also open32.dll glu32.dll glut32.dll (i download it) glut.h (si download it) glut.lib (i download it) glut.def (i think not nessesery) bach looks like path %pathc:\mingw\bin g++ -o program.exe main.cpp glut32.lib and errors in every line use function glut32.dll/opengl.dll, errors similar c:\users\przemko\appdata\local\temp\cc4n2cuy.o:main.cpp:(.text+0xe5): undefined reference `glclearcolor@16' in mingw\include have folder gl headers: glu.h gl.h glext.h "i while installing mingw" my source include #include <time.h> #include <iostream> #include <...

eclipse - Attach screenshot to failed test cases in junit report -

Image
i need attach screenshot of failed testcases in junit report. changes neede done in in "junit-frames.xsl" file. please advice this article may you. all changes needed , examples download. http://testautomation.blog.com/2013/04/22/surefire-report-with-screenshots-on-failure-with-junit-selenium/

Javascript set frame width and height -

i must place afiliate script iframe, have code: eturas.frame({ width: '100%' }); i want set height: try : eturas.frame({ width: '100%', height: '1000px', }); but code not work - can problem? all code: <script type="text/javascript"> var _et = _et || []; _et.push(['project', 'daigera-egzotic']); _et.push(['type', 'hermes']); _et.push(['url', 'trips/index/type:exotic']); (function() { document.write('<' + 'script type="text/javascript" src="http://www.eturas.lt/js/v9/eturas.js"><' + '/script>'); }) (); </script> <script type="text/javascript"> eturas.frame({ style: 'width: 100%; height: 100px;' }); </script> i make $('#idframe').css('height','100px'); example jquery or $("#idframe").css({"width":"100%","height":"100px...

winapi - how to host html control in my window using a buffer which contents a html file -

i developing visual c++ applicatio(x64). trying suppose have html file in window explorer(i mean file file extension ".html"). when single click on preview on preview pane(so don't need open file can see file in preview pane on single click file). i have developed similar type of application in case when click on "html file" code of html file in preview pane(the code can see if open html file in notepad). not expected happen want have preview of "html file" not code of html file. i think need host browser control transform html code in preview pane display of html file(if correct ???) how ?? here code that- ihtmldocument2 * pdoc=null; hresult hr2 = cocreateinstance(clsid_htmldocument, null, clsctx_inproc_server, iid_ihtmldocument2, (lpvoid *) &pdoc); if (pdoc) { ipersiststreaminit *ppersist = null; pdoc->queryinterface(iid_ipersiststreaminit,(lpvoid *) &ppersist); if (ppersist) { ...

java - How to force text file to download instead of opening in browser in jsp -

this question has answer here: how force browser download file? 3 answers how make files download instead of opening in browser? 3 answers how force text (.txt) file download instead of opening browser window. this simple html link out.print("<a href =http://localhost//output/output.txt">"); your server needs add header response: content-disposition: attachment

wpf - Why do I need to call Dispatcher.BeginInvoke() to allow a visual to properly bind before printing? -

i have usercontrol fixed size of 850x1100 give me same aspect ratio letter-sized piece of paper. display in window inside viewbox , , acts print preview. control inherits window's datacontext, , when it's displayed on screen, bindings work , looks wonderful. i've written code below in window's code behind (i feel it's totally view-oriented operation) attempt print it. if execute code written, control prints, not appear data bound. private void printbutton_click(object sender, routedeventargs e) { var dlg = new printdialog(); var result = dlg.showdialog(); if (result == null || !(bool)result) return; var page = new inspectionformprintview { datacontext = this.datacontext }; page.measure(new size(dlg.printableareawidth, dlg.printableareaheight)); page.arrange(new rect(new point(0, 0), page.desiredsize)); dlg.printvisual(page, "inspection form"); } if modify last line in method to dispatcher.begininvoke(new a...

hyperlink - How to add menu link wrapper in drupal 7? -

i have menu, 1 menu item looking this: <li> <a href="aaa">link title</a> </li> and want this: <li> <a href="aaa"> <div class="custom">link title</div> </a> </li> or this: <li> <div class="custom"> <a href="aaa">link title</a> </div> </li> how can this? this works: function theme_menu_link(array $variables) { $variables['element']['#localized_options']['html'] = true; $variables['element']['#title'] = '<div class="custom">' . $variables['element']['#original_link']['link_title'] . '</div>'; return theme_menu_link($variables); }

datepicker - The day name showing incorrect value, next day or previous day in Android -

public class main extends activity { protected static final int dialog = 0; private int day; private int month; private int year; button mbt; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); mbt = (button) findviewbyid(r.id.button1); mbt.setonclicklistener(new onclicklistener() { public void onclick(view arg0) { showdialog(dialog); } }); } private void updatedisplay() { string day = (dateformat.format("eeeeee", new date(year, month, day))).tostring(); toast.maketext(main.this, day, toast.length_long).show(); } private datepickerdialog.ondatesetlistener mdatesetlistener = new datepickerdialog.ondatesetlistener() { @override public void ondateset(datepicker arg0, int year, int monthofyear, int dayofmonth) { year = year; ...

sql - Conditional WHERE clause with CASE statement in Oracle -

i'm brand-new oracle world softball. in working ssrs report, i'm passing in string of states view. twist users pick selection state list called "[ no selection ]" ... (that part not doing , i'm stuck implementing things way) if choose no selection option, want return states default, otherwise return list of states in comma-separated list. this seems should easy i'm stuck. here code have far (just trying sample work) eyes have gone crossed trying going. could give me direction on 1 please? begin :statecode:='mo,fl,tx'; --:statecode:='[ no selection ]'; end; / select count(*) statecount, :statecode selectedval hcp_state vw (case when (:statecode = '') (1) when (:statecode != '') (vw.state_cd in (:statecode)) (else 0) end) ; you can write where clause as: where (case when (:statecode = '') (1) when (:statecode != '') , (vw.state_cd in (:statecode...

android - Alternate way to access multiple columns independently from a database? -

my application stores 3 items: "name", "email", "mobile" in database under same table. want access each of them independently display value under respective textviews. access them independently because if access them through 1 single function won't able display values currently, have write function each column information it. example "email" public string getuseremail(string mobile) { string[] columns = new string[] {user_email}; cursor c = maindatabase.query(reg_info_table, columns, user_mobile_number + "=" + mobile, null, null, null, null); string result = ""; int email = c.getcolumnindex(user_email); while(c.movetonext()) { result = result + c.getstring(email); } return result; } so, if need the "name", i'll have write function similar above it. now, if need access 50 such columns, i'll have make 50 such func...

javascript - Get elements that have not been added to the DOM -

if create new html element using document.createelement , not add dom, there way find it? method of document , seems logical might become property of document . example: (function(){ document.createelement("a"); })(); console.log(document.getelementsbytagname("a").length); // -> 0 i understand why above example doesn't work. there alternative? you're creating elements, without insterting them in dom. you need store them if want know how many are. var myelements = []: var elem = document.createelement("a"); myelements.push(elem); myelements.length; // use length needs

php - Function expects array to be string, convert? -

before downvoting can atleast write bothering you, jesus christ arogance i "warning: mysql_real_escape_string() expects parameter 1 string, array given in bla bla..." everytime following happens: if($_post['action'] == 'napadi') { $igralec_ime = $_session['username']; $igralec = array ( 'ime' => $igralec_ime, 'napad' => prikazi_stat('ofe',$igralec_ime), 'obramba' => prikazi_stat('def',$igralec_ime), 'curhp' => prikazi_stat('curhp',$igralec_ime) ); $monster_ime = $_post['monster']; $monster = array ( 'ime' => $monster_ime, 'napad' => prikazi_monster_stat('ofe',$monster_ime), 'obramba' => prikazi_monster_stat('de...

html - How to enable links if a parent element uses a fullscreen pseudo-element? -

my page looks this: <div.ui-page> <div.ui-content> <a href="foo.html"> </div> </div> on page, i'm setting fullscreen watermark so: /* watermark */ .ui-page:before { background: url("../img/foo.png") no-repeat center center; position: absolute; content: ""; top: 0; bottom: 0; left: 0; right: 0; width: 100%; height: 100%; /* transparency */ opacity: .2; /* grayscale */ filter: url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\'><filter id=\'grayscale\'><fecolormatrix type=\'matrix\' values=\'0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0\'/></filter></svg>#grayscale"); filter: gray; -webkit-filter: grayscale(100%) brightness(10%) contrast(100%); } which works fine. problem is, link no longer clickable. i tried moving ...

css - Equal line height with varying border width (border-box) -

Image
in simplified example have 4 circles, each varying border-width , trying maintain equal line height in each keep them horizontally aligned. however border width seems effect line height (despite being technically outside box?) is there anyway solve without manually adjusting each line-height? width: 50px; height: 50px; border-radius: 50px; border: 1px solid #1daeec; line-height: 50px; example: http://jsfiddle.net/vcj3g/ you can remove line-height, use display:table-cell instead, , add vertical-align:middle; stat class. jsfiddle example .stat { display: table-cell; width: 50px; height: 50px; border-radius: 50px; border: 1px solid #1daeec; text-align: center; margin: 10px; font-size: 16px; color: #1daeec; text-transform: uppercase; vertical-align:middle; }

difference between constructor and properties in C# -

i new programming, please explain me difference between constructor , property in context c#. since both used initialized class fields, & 1 choose in given situation . besides technical stuff, rule of thumb use constructor parameters mandatory things, properties optional things. you can ignore properties (hence optional), can't ignore constructor parameters (hence mandatory). for else, i'd recommend reading c# beginners book or tutorial ;-)

c++ - Using Qt To Build A Full Screen Layout -

Image
i trying use qt along qt designer create simple full screen webview line edit , button above create simple browser. the problem layout doesn't want expand fill of available space. seem think missing simple, can't seem figure out. here overview of layout <mainwindow> <gridview> <vboxlayout> <hboxlayout> <lineedit /><pushbutton /> </hboxlayout> <webview /> </vboxlayout> </gridview> </mainwindow> here code on mainwindow class mainwindow::mainwindow(qwidget *parent) : qmainwindow(parent), ui(new ui::mainwindow) { ui->setupui(this); ui->lineedit->showfullscreen(); ui->pushbutton->showfullscreen(); ui->webview->load(qurl("http://google.com")); ui->webview->showfullscreen(); } and here main code int main(int argc, char *argv[]) { qapplication a(argc...

Linked lists and inheritance in java -

i have parent class extended 6 child classes , getting confused on how replace arraylists linkedlists have in child classes. need basic advice setting parent class made of getters , setters , variables. my parent class has no objects created it. need create node inner class in parent class or need node inner classes in each of child classes creating linked lists? you should have parent class use collections.list interface. generic list interface can implemented using arraylist, linkedlist, etc in child classes

backbone.js - Backbone relational - how is it possible to find related model by two foreign keys? -

in model i've defined relationship, it's property foreign key substituded related model. i had idea give away database 2 same values, example relatedid , related - if define models relationships field related , relatedid value left untouched - , able use it. is possible somehow use collection.where() method in backbone relational on model attributes, represent related models (they have object data type)? if define related id - following - not work: collection.where({ related : 14 // property contains related model, not id after backbone initializes, i've tried use relatedid key instead - not work }) i need such method much, because have find models lot of attributes, , hard scratch :/ could please advice way? i using database "views" flatten relationships way easier querying. works well.

qt - where can I download qmysql driver? -

after 2 days of following many tutorials how create qmysql driver qt give up. keep getting errors , know if possible driver downloaded off somewhere or has created on pc in order work ? thanks this official documentation: http://qt-project.org/doc/qt-4.8/sql-driver.html#how-to-build-the-qmysql-plugin-on-windows

ios - Show only part of coreData array -

i've tableview should display objects of coredata-entity if 1 of entity-attribute equal string. there's entity called buy , 1 of it's attribute string called position and in code tableviewcontroller is: @property (strong) nsmutablearray *buy; - (nsmanagedobjectcontext *)managedobjectcontext { nsmanagedobjectcontext *context = nil; id delegate = [[uiapplication sharedapplication] delegate]; if ([delegate performselector:@selector(managedobjectcontext)]) { context = [delegate managedobjectcontext]; } return context; } - (void)viewdidappear:(bool)animated { [super viewdidappear:animated]; nsmanagedobjectcontext *managedobjectcontext = [self managedobjectcontext]; nsfetchrequest *fetchrequest = [[nsfetchrequest alloc] initwithentityname:@"buy"]; self.buy= [[managedobjectcontext executefetchrequest:fetchrequest error:nil] mutablecopy]; [self.tableview reloaddata]; } ...

javascript - jQuery .height() and .outerHeight() returning zero -

Image
i'm trying write small jquery plugin vertically center div based on it's height, basically in css have top: 50% , since height variable need calculate this. the html looks like <div class="button-wrapper js-center" data-center="vertical" style="margin-top: 0px;" <span class="sub-text">multiline text 2 lines</span> <a href="" class="shop-btn">shop_</a> </div> in plugin tried logging height, keeps on returning zero: console.log($el); console.log("$el.outerheight(): " + $el.outerheight()); console.log("$el[0].scrollheight: " + $el[0].scrollheight); // output: $el.outerheight(): 0 $el[0].scrollheight: 0 when use dev tools check, looks this: so i'm wondering potentially go wrong, reference, plugin i'm (trying) write: http://pastebin.com/qz7bgkcg edit: main css used on .button-wrapper .button-wrapper { width: 250px; left: 50%...

Google Map API V3 Weighted Search Results -

i wondering if knows if possible weight search results based on country or other variables? basically, i'm looking have user enter street address search canada before searching rest of world. the issue encountering users not inputting full address (inc. province , country) , map defaulting addresses outside of canada. is possible? is possible? yes! see component filtering .

vb.net - How to Get SQL Error message from Adapter.Update (ASP.NET with VB) -

writing asp.net app using vb. bll uses adapter.update insert new reocrds. turn calls stored procedure, returns meaningful messages (e.g. "this invoice exists") want display user. i can't figure out how message though. here's part of bll insert function: <system.componentmodel.dataobject()> _ public class invoicesbll private _invoiceadapter shipping_invoicetableadapter = nothing protected readonly property adapter() shipping_invoicetableadapter if _invoiceadapter nothing _invoiceadapter = new shipping_invoicetableadapter() end if return _invoiceadapter end end property ' insert new invoice <system.componentmodel.dataobjectmethodattribute(system.componentmodel.dataobjectmethodtype.insert, true)> _ public function addinvoice( _ byval tripno string, _ byval typeid integer, _ ...

cakephp - Where should the template view file for the login function go? -

i trying follow simple authentication , authorization application tutorial not clear template view file login function (below) supposed go. <div class="users form"> <?php echo $this->session->flash('auth'); ?> <?php echo $this->form->create('user'); ?> <fieldset> <legend><?php echo __('please enter username , password'); ?></legend> <?php echo $this->form->input('username'); echo $this->form->input('password'); ?> </fieldset> <?php echo $this->form->end(__('login')); ?> </div> when put in app/view/users/login.ctp , users/add causes following error: error: view userscontroller::index() not found. error: confirm have created file: app\view\users\index.ctp when app/view/users/login.ctp renamed app/view/users/index.ctp , users/add indicates the user has been saved but going blog tut...

vbscript - why CMD window get the parameter name and not the value of parameter -

i need run following command on cmd window under c:\program files\connection connect "user_vip" so write short vb script perform action dim oshell set oshell = wscript.createobject ("wscript.shell") userc = """user_vip""" wscript.echo userc oshell.run "cmd /k cd c:\program files\connection & connect userc " ,1 , true after run vb script see following cmd window connect userc and not expected see: connect "user_vip" why userc parameter in oshell.run not real value - "user_vip" ?? remark - wscript.echo userc print value - "user_vip" expected vbscript not interpolate variable content string literals , path containing blanks/spaces in shell command needs quotes (" escaped "") change oshell.run "cmd /k cd c:\program files\connection & connect userc " ,1 , true to oshell.run "cmd /k cd ""c:\program file...

php - stream_get_line dont read line as it arrives -

i'm trying read streaming data using php. so read , show every message posted server in real time. i assume $uri, $context code snipped correctly defined. when use code, result got when lenght reached. seams doesnt stop on delimiter "\r" string. define('token', "my_token"); $opts = array( 'http' => array( 'method' => "get", 'header'=> "authorization: basic " . base64_encode(token))); $context = stream_context_create($opts); if (($fp = fopen($uri, "r", false, $context))) { while (!feof($fp)) { $contents = stream_get_line($fp, 1024, "\r"); echo "text: " . $contents . "\n"; } fclose($fp); when lenght reached, show correctly new messages posted. string "text: " before every message. how print 1 message 1 ? ps: tried use "\r", "\n", "\n\r" or "\r\n", nothing works :/. i need t...

Grabbing Values Outside a Form with PHP -

i'm using following code on site. you'll notice there checkbox outside form (towards bottom). need value of checkbox called send_mail.php without creating second form, , without placing inside form element. possible php? ` <h2>search dream home<br /> , save now!</h2> <legend>which areas interested in?</legend> <div class="areas row-fluid" style="text-align:left !important;"> <div class='span5' style='margin-left:0px !important;'> <label> <input type="checkbox" name="arrayvalue[]" id="area[0]" value="test" style='margin-top:-5px !important;'> test</label> </div> </div> <input type="button...

php - Session Management For redirection in Codeigniter -

i want manage page redirection in codeigniter, have 2 controllers: logggedin login when user try access login page while logged in, redirected loggedin controller function __construct() { parent::__construct(); $u = $this->session->userdata('username'); if(! isset($u)) { redirect('loggedin'); } } and when tries access loggedin controller while not logged in, should redirected login controller function __construct() { parent::__construct(); $u = $this->session->userdata('username'); if(isset($u)) { redirect('login'); } } but when press logout button, has redirect login controller, still remains on logggedin controller. function logout() { $this->session->sess_destroy(); redirect('login'); } what problem in code? your condition returning true $u=$this->session->userdata('username'); // true because $u equal va...

asp.net mvc - Trouble with ModelState on datetime field -

in our asp mvc 3 site, want user able enter incomplete form, save record database, , come form later. if there fields entered incorrectly want error message appear when user hits save. a problem occurring specific date of birth field, however. if user enters incorrect date such 14/01/2011 , when user hits save , model object posts controller action, date of birth comes through blank. fails if (modelstate.isvalid) condition, not save database, , sent view blank date of birth. is there way allow user enter incorrect date in field, keep value , post view value , error message generated model? since using jquery input mask, value entered numeric , in mm/dd/yyyy format. model [displayname("date of birth")] [displayformat(dataformatstring = "{0:mm/dd/yyyy}", applyformatineditmode = true)] public datetime? birthdate { get; set; } controller [httppost] public actionresult edit(monet.models.agenttransmission agenttransmission) { ...

jquery - Scroll a div based on a draggable element (reversed) -

i found code scrolling div via draggable element. don't quite understand posted answer , want in reverse. original here : scroll div based on draggable element http://jsfiddle.net/xnlse/8/ i modified fiddle , made scroll down on load, original answer works without scrolling content down. i added block scroll down //modification var timeline = $('#timeline'); var tlparent = timeline.parent(); var tlheight = parseint(timeline.css("height")); var tlpheight = parseint(tlparent.css("height")); //scroll down content on load var newpos = 0 - (tlheight - tlpheight); timeline.animate({"top":newpos + "px"},800,"linear"); //end modification my modification : http://jsfiddle.net/j3toxicat3d/hxbgd/ help anyone? thanks hey battled script , got working in reverse - //modification var timeline = $('#timeline'); var tlparent = timeline.parent(); var tlheight = timeline.height(); var tlpheight = tlpar...

Facebook App: How do I cause new chat messages to appear minimized? -

when user messaged while using app, there way make chat window appear minimized rather auto-opening? appears uberstrike: https://apps.facebook.com/uberstrike/ has way of doing this. cannot find being done in js on page though. can following: when examining difference between minimized , non-minimzed (uberstrike vs fb profile page) div title of chat has classes: uberstrike: fbnub _50-v _50mz 50m _5238 highlighttab highlighttitle fb profile page: fbnub _50-v _50mz 50m _5238 highlighttab opened highlighttitle the difference inclusion of "opened" class. additionally, when delve deeper html see there table represents contents of chat window. in uberstrike, discussion doesn't populate while on profile page, there many tags containing discussion. this leads me believe there must setting convince fb treat game's page differently. know how cause application behave same way.

php - Is there any way to determine the *actual* session save path? -

i know there half dozen ways value of session.save_path directive ( phpinfo() , session_save_path() , etc.), when value empty string, default, actual path can of several locations. i've read it's /tmp , except when it's /var/lib/php5 , on os x mountain lion it's /private/var/tmp . on windows, it's c:\windows\temp , knows. i specify location, won't me. i'm trying diagnose tricky problem , know current location on server don't have full access to. if there's right way it, haven't been able find it. i'm open clever hacks. i have not reviewed php source code confirm this, looks when session.save_path empty, php uses value of sys_get_temp_dir() (which varies user).

java - How can I make the button move from the first JTabbedPanel to the next one? -

i created window panel displays 6 tab panels, , made next , previous buttons move tab tab. problem able make go first tab last tab. buttons skip other tabs , can't seem find way make go through each tab. did: next = new jbutton("next"); next.addactionlistener( new actionlistener() { @override public void actionperformed(actionevent e) { for(int = 0; <= tabs.getselectedindex(); i++) tabs.setselectedindex(i); } }); previous = new jbutton("previous"); previous.addactionlistener( new actionlistener() { @override public void actionperformed(actionevent e) { for(int = 0; >= tabs.getselectedindex(); i++) tabs.setselectedindex(i); } }); i'm still going try figur...

javascript - "TypeError: can't convert undefined to object" when Dynamically Resizing 2D Array -

i read text, consisting of triads of comma separated numbers 1 triad per line, 2d array. not know in advance array dimensions be. use following code. // read data matrix var inputdata = [[]]; while (alltextlines.length>0) { datarecord=alltextlines.shift(); entries = datarecord.split(','); var xcoord=parseint(entries.shift()); var ycoord=parseint(entries.shift()); var zcoord=parseint(entries.shift()); if (ycoord>=inputdata.length) inputdata[ycoord]=[]; inputdata[ycoord][xcoord]=zcoord; } this results in typeerror: can't convert undefined object from firebug when try call if (ycoord>=inputdata.length) inputdata[ycoord]=[]; or inputdata[ycoord][xcoord]=zcoord; i thought javascript arrays dynamically resized assigning value index higher current size. they can dynamically resized when exist . there...

synchronization - Filter lock mutual exclusion property -

the following generalised version of peterson's 2-thread lock algorithm, allowing 'n' threads/processes compete critical section. basically there 'n' levels , 'n' threads. threads inactive or executing in non critical section region @ level 0. level n-1 critical section. every thread/process must cross n-1 levels before entering critical section. there 2 arrays, level[n] & victim[n]. first array indexed threadid of thread, , entry level[i] stores current level of thread threadid 'i'. second array indexed level number, , entry victim[i] stores threadid of recent thread enter level 'i'. all elements of level[] initialized 0. no specific initialization victim[]. 1 void lock() 2 { int me = threadid.get(); 3 (int = 1; < n; i++) 4 { level[me] = i; 5 victim[i] = me; 6 while ((∃k != me) (level[k] >= && victim[i] == me)) ; 7 } 8 } 9 10 void unlock() 11 { int me = threadi...