Posts

Showing posts from June, 2014

How to make a search bar in XPages? -

i have xpages database ready want make search page/bar search through database , display linked information. beginner in xpages appreciate step step guidance:) or if know website guidance appreciate help:) an instruction implement search function can found here: http://www-10.lotus.com/ldd/ddwiki.nsf/dx/tutorial-introduction-to-xpages-exercise-9 other sites of interest: learning xpages xpages wiki xpages info xpages blog xpages 101 notes in 9 xpages cheat sheet xpages tv domino designer wiki lotus notebook open ntf planet lotus

c# - cmd.Parameters.AddWithValue nullable int -

in data layer class, initialize parameter so: private int? _dependencyid; public int? dependencyid { {return _dependencyid;} set {_dependencyid = value;} } public constructormethod() { _dependencyid = (int?)null; } in class insert() method, attempting cmd.addwithvalue("@dependencyid", _dependencyid); if _dependencyid has value, well. if _dependencyid null, error: the parameterized query '(@param1(nvarchar(10), @param2(nvarchar(255), expects parameter '@dependecyid", not supplied i found [article][1], tried adjusting code so: cmd.addwithvalue("@dependencyid", _dependencyid == null? dbnull.value : _dependencyid); , cmd.addwithvalue("@dependencyid", _dependencyid == null? (int?) dbnull.value : _dependencyid); either way, there issues. how should handle this? thanks in advance help you need add object : cmd.addwithvalue("@dependencyid", _dependencyid == null...

Defining a new Object of a Class within a Template in C++, Error: Missing Template Arguments -

have simple program, can insert string statically defined array of strings of size 20. this program worked fine, until assigned change use templates, code (with modificaiton) support intergers or strings. using class "shelf" in included header, can no longer declare following object int main(), "shelf book;" --as compiler tells me book has not been declared , i'm missing template arguments. #include<iostream> #include<string> #define shelfsize 20 template<class t> class shelf{ public: shelf();//default constructor void insert(t&); private: string bookshelf[shelfsize]; int counter; }; template< class t> shelf<t>::shelf(){ for(int i=0; <shelfsize; i++) bookshelf[i]=""; counter=0; } template< class t> void shelf<t>::insert(t &booknum){ bookshelf[counter] = booknum; counter++; } int main(){ shelf book; string isbn=""; ...

asp.net mvc 3 - How to display dynamic Html.ActionLink label? -

this code works, displays "details" every row of table: @appsgrid.gethtml( tablestyle: "table", headerstyle: "head", alternatingrowstyle: "alt", columns: appsgrid.columns( appsgrid.column(columnname: "code", header: "", format: (item) => html.actionlink("details", "index", "applicationtechstack", new {code = item.code}, null ), however, when try change line format: (item) => html.actionlink(item.code, gives me error. how come? item of c...

Matching lines in Python -

i need match string in text file , want return matching line. let's say, have string in 2d array follows: [['shoo-be-doo-be-doo-da-day', 'henry cosby'], ['my cherie amour (song)', 'stevie wonder'], ["signed, sealed, delivered i'm yours", 'stevie wonder]] so can search in text file string e.g.: ['shoo-be-doo-be-doo-da-day', 'henry cosby'] ['', ''] ['', ''].... in file.txt lines this: abcd shoo-be-doo-be-doo-da-day skakk gkdka kkhhf henry cosby. gfigka stevie wonder hfkhf hghhg fghh cherie amour. fhsgs hlghhg henry cosby shoo-be-doo-be-doo-da-day gkgkl. then should return whole line marking matches string. 1d array following code works: def search(word, sentences): return[i in sentences if word in i] for above 2d-array, how proceed on? how this: def search(sentences, words): return [s s in sentences if all([w in s w in words])]

How do I use certificate-based authentication with WATIR-WebDriver? -

i've been using ruby mechanize several years automated testing of saas product host. site using js more , more, making maintenance of mechanize scripts impossible. i've decided try using watir-webdriver instead. however, login process requires user certificate , password. can't find reference using cert this. if you're using chrome, can ignore certificate errors passing command line option chrome driver: b = watir::browser.new :chrome, :switches => ['--ignore-certificate-errors'] if you're using firefox, try profile = selenium::webdriver::firefox::profile.new profile.assume_untrusted_certificate_issuer = true b = watir::browser.new web_driver, :profile => profile

osx - How to use nerdtree and mvim behave like netbeans or eclipse? -

i want use mvim general purpose text editor code development. want default view directory list view on left vertical split pane , file double click on in right vertical split pane. same in netbeans or eclipse. there anyway set default mvim view, or hotkeys put in mode? on macbook pro, can open mvim typing: mvim . this opens directory tree view of current directory (not split pane). if double click on files, whole screen replaced file , directory listing goes away. want keep it. if highlight file within directory listing , click "t" hotkey, new tab opened showing contents of file (again, not split pane, whole file in it's own tab). however, if highlight folder , click "t" hotkey, new tab opened has new vertical split directory listing on left. furthermore if double click on files in directory listing, go in right pane, want. is there command line arguments set can alias? you seem describing nerdtree plugin "t". might need...

iphone - Objective-C code to generate a relative path given a file and a directory -

given file path , directory path nsstring s, have objective-c code generate path file, relative directory? for example, given directory /tmp/foo , file /tmp/bar/test.txt , code should produce ../bar/test.txt . i know python, @ least, has method this: os.path.relpath . rather continue defend why need this, decided write , share. based off of implementation of python's os.path.relpath @ http://mail.python.org/pipermail/python-list/2009-august/1215220.html @implementation nsstring (paths) - (nsstring*)stringwithpathrelativeto:(nsstring*)anchorpath { nsarray *pathcomponents = [self pathcomponents]; nsarray *anchorcomponents = [anchorpath pathcomponents]; nsinteger componentsincommon = min([pathcomponents count], [anchorcomponents count]); (nsinteger = 0, n = componentsincommon; < n; i++) { if (![[pathcomponents objectatindex:i] isequaltostring:[anchorcomponents objectatindex:i]]) { componentsincommon = i; break; ...

asp.net - Only one instance of a ScriptManager can be added to the page -

i'm trying add toolkitscriptmanager page in order use ajaxcontroltoolkit. here code: <%@ assembly name="$sharepoint.project.assemblyfullname$" %> <%@ assembly name="microsoft.web.commandui, version=14.0.0.0, culture=neutral, publickeytoken=71e9bce111e9429c" %> <%@ register tagprefix="sharepoint" namespace="microsoft.sharepoint.webcontrols" assembly="microsoft.sharepoint, version=14.0.0.0, culture=neutral, publickeytoken=71e9bce111e9429c" %> <%@ register tagprefix="utilities" namespace="microsoft.sharepoint.utilities" assembly="microsoft.sharepoint, version=14.0.0.0, culture=neutral, publickeytoken=71e9bce111e9429c" %> <%@ register tagprefix="asp" namespace="system.web.ui" assembly="system.web.extensions, version=3.5.0.0, culture=neutral, publickeytoken=31bf3856ad364e35" %> <%@ import namespace="microsoft.sharepoint" %> ...

how to "push" a word (string) to a given position in a file without overwriting the text (programming c) -

i wonder how can update existing file, , add word in given position. so let file looks like: this first line in file and want add word "is " in position 6 file like: this first line in file what best method achieve that? should fopen mode? assume file big copy memory, or create temporary clone thanks! there no magic "insert in middle" open mode. have yourself. if can't fit in memory, , don't want/can't create temporary, can rewrite "from bottom". (i.e. read last "block", write shifted amount want, repeat.)

javascript - Concat and minify JS files in Node -

is there module in nodejs concatenate , minify javascript files? if you're using connect, i've had luck connect-assetmanager

java - Multiple Screen? -

well i'm developed android app , confused in screen size , can explanation these words me please , mean example wvga can use in kind of layout folder ? layout-small , layout-large ... ? layout= ? size (wvga , qvga ...) layout-small= ? size (wvga , qvga ...) layout-large= ? size (wvga , qvga ...) layout-large-long= ? size (wvga , qvga ...) layout-large-land=? size (wvga , qvga ...) thank you check android developer page supporting multiple screen sizes .

android - Spinner ignores conditional statements -

so got spinner entries stringarray. string[] spinnerentries = { getresources().getstring(r.string.oldpoint), getresources().getstring(r.string.newpoint), getresources().getstring(r.string.gpslocation) }; spinner spinner = (spinner) findviewbyid(r.id.spinner1); arrayadapter<string> adapter = new arrayadapter<string>(this, android.r.layout.simple_spinner_item, spinnerentries); i want set searchpoint depending on spinner selection, totally igonores cases except first 1 (oldpoint). doing wrong? wheter got tired or stupid, don't see problem. public void onitemselected(adapterview<?> parent, view view, int pos, long id) { string spinneritem = (string) parent.getitematposition(pos); if (spinneritem.equals(getstring(r.string.oldpoint))) { searchpoint = r.string.oldpoint; } else if (spinneritem.equals(r.string.newpoint)) { searchpoint = r.string.newpoint; } else if (spinneri...

Open Source Solution for inventory,Billing In PHP -

i developing application client in want manage medium size company sales/purchase/expenditures/stock , want provide online billing(without online payment) facility. he want set different access levels different persons. i know can develop app scratch don't want waste time searching open source solution in php using mysql backend. i hope if found open source solution can modify per need. so suggest me solution purpose. if find unclear in question please comment on question make clear. -thanks in advance. you can use symfony or zend framework, there both great make bigger project simple website ;-) check out : symfony vs zend

PHP: is there a way to invoke case-insensitive substr_count()? -

just question says: is there way invoke case- insensitive substr_count()? there not native way, can do: substr_count(strtoupper($haystack), strtoupper($needle)); you can of course write function: function substri_count($haystack, $needle) { return substr_count(strtoupper($haystack), strtoupper($needle)); } be aware of turkey test when using case changes compare strings. http://www.moserware.com/2008/02/does-your-code-pass-turkey-test.html from above: as discussed lots , lots of people, "i" in turkish behaves differently in languages. per unicode standard, our lowercase "i" becomes "İ" (u+0130 "latin capital letter dot above") when moves uppercase. similarly, our uppercase "i" becomes "ı" (u+0131 "latin small letter dotless i") when moves lowercase.

objective c - Initialize NSMutableArray -

im new in xcode 3 , need this i developed apps using uitableview , xml showed content. i had 3 .xib files rootviewcontroller , secondviewcontroller , mainview. so problem is: when try executed didselectrow in rootviewcontroller , access nsmutablearray *array in secondviewcontroller , replace *array value new array value in rootviewcontroller before pushed animation. the array value on secondviewcontroller changed first time when pushed button , select other row, secondviewcontroller array kept read previous array not change new one. try initialize no luck this code on rootviewcontroller uitableview (didselectrow): - (void)tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath { if(2ndcontroller == nil) 2ndcontroller = [[detailviewcontroller alloc] initwithnibname:@"secondviewcontroller" bundle:[nsbundle mainbundle]]; //declare xml nsmutable array record listrecord *record = [self.entries objectatindex:indexpath.row]...

actionscript - Does flash suffer performance-wise from the x and y being too large? -

let's movieclip inside movieclip has x of 9000. bad? there cap? thanks there limit applied number type x , y are. it's not bad have large value. see here number.max_value .

Batch input and output in Mathematica? -

recently found old post on mathgroup usage of undocumented command-line options -batchinput , -batchoutput shown: if test.mma contains following commands: a=2+2 b=10!; a+b then, running mathematica in batch mode, output first , third commands goes stdout: # math -batchinput -batchoutput < test.mma 4 3628804 but when trying reproduce behavior under windows first output printed in console window. doing wrong? i tested , got both numbers output. however , if last command not followed carriage return, output posted! so, please check ending last line carriage return.

powershell - Variable not updating when function is called -

i have in profile script. $addablepaths = @{ "python3"=";c:\python32"; "python2"=";c:\python27"; "d"=";c:\d\dmd2\windows\bin"; "gcc"=";c:\mingw\bin"; "verge"=";c:\users\cold\dev\verge\tools"; "ruby"=";c:\ruby192\bin"; "git"=";c:\program files\git\cmd"; "cmake"=";c:\program files\cmake 2.8\bin"; "emacs"=";c:\users\cold\dev\emacs\bin"; "notepad++"=";c:\program files\notepad++"; "boost-build"=";c:\users\cold\dev\c++\boost-build\bin"; "svn"=";c:\program files\sliksvn\bin"; "gtk2"=";c:\program files\gtk2-runtime\bin"; "qt"=";c:\qt\bin"; "komodo"=";c:\program files\activestate komodo edit 6\"; "hg"=";c:\program fi...

javascript - Speeding up call to draw one pixel (thousands of times) in canvas -

i'm creating "bubble generator" background effect run on page. generator works fine, slows down, lot after short while. demo: http://jsfiddle.net/dud2q/ i set demo run @ 1ms intervals it's easy see slow-down when re-launch fiddle (especially if make result window large). the issue have thousands of calls code (one each bubble): ctx.beginpath(); ctx.moveto(x, y); ctx.lineto(x+1, y+1); ctx.stroke(); does know of quicker way draw 1 pixel in canvas? also, if wants take stab @ making bubbles more realistic, wouldn't complain :) instead of drawing bubbles one-by-one, how drawing @ once? i.e. moving ctx.beginpath() , ctx.stroke() out of loop? looks lot faster on firefox. :) $.extend(number.prototype, { times : function(cb){ for(var i=0; i<this; i++){ cb(i); }}, interval : function(cb){ return setinterval(cb, this); }, timeout : function(cb){ return settimeout(cb, this); } }); $(function(){ var $canvas = $('...

escaping - How to construct variable name in Bash? -

i want construct variable name n_foo , n_bar , use values in following: #!/bin/bash n_foo=2 n_bar=3 in { "foo" "bar" } j in { 1..$(`n_$i`) } echo $j done done i want use values of n_foo , n_bar in 2 inner loops , print out 1, 2 , 1, 2, 3, respectively. what's correct syntax? #!/bin/bash n_foo=2 n_bar=3 in "foo" "bar" key="n_${i}" eval count='$'$key j in `seq 1 $count` echo $j done done

Private members in Java inheritance -

i told java subclass can inherit members of superclass. mean private members? know can inherit protected members. can explain me. totally confused. no, private member not inherited because scope of private member only limited class in defined. public , protected member inherited. from java documentation , private members in superclass a subclass does not inherit private members of parent class. however, if superclass has public or protected methods accessing private fields, these can used subclass. nested class has access private members of enclosing class—both fields , methods. therefore, public or protected nested class inherited subclass has indirect access of private members of superclass. from jls , members of class that declared private not inherited subclasses of class. members of class declared protected or public inherited subclasses declared in package other 1 in class declared. a useful link : do...

ruby on rails 3 - how can I test accepts_nested_attributes_for with Rspec Rails3 -

i have model follows: class greeting < activerecord::base attr_accessible :headline, :icon, :content belongs_to :user accepts_nested_attributes_for :user, :reject_if => proc { |a| a[:name].blank? || a[:email].blank? } how can rspec test this? here have shoulda macro testing accepts_nested_attributes_for : http://mediumexposure.com/testing-acceptsnestedattributesfor-shoulda-macros/ . not support options (such :reject_if ), bare accepts_nested_attributes_for . but :reject_if , can create valid greeting model nested attributes user without :name . check if user has been saved, , same blank :email so can this: describe greeting { expect { factory(:greeting, :user_attributes => factory_attributes_for(:user)) }.to change(user, :count).by(1) } { expect { factory(:greeting, :user_attributes => factory_attributes_for(:user, :name => '')) }.to_not change(user, :count) } { expect { factory(:greeting, :user_attributes => factory.a...

listview - Slide In button effect of List View item for Android -

i'm porting iphone app android app , 1 of difficulties recreating functionalities native iphone. i found native functionality of iphone: when user execute slide touch on listed item in list view, delete button appears. is there version in android? can used , reused/customized? this bit more complicated achieve. talking higher level. create custom viewgroup/layout hold list item. inside layout have text lines images or ever have , delete button. here listen gestures hide or unhide delete button. in list adapter going need keep track of item showing delete button , not. also, going need apply click listener each of list item delete buttons. every time assign these states on list item should settag(...) , store list item position when it's clicked can tell item number must deleted. after deleting must refresh list in order take effect. depending on type of adapter using that's going determine how refresh adapter. hopefully makes sense. think eas...

cakephp - Best way to populate a dropdown sitewide that is -

i using cakephp 1.3 , layout includes dropdown of organizations user has access administer, i'm trying populate dropdown organizations contain userid logged in, want populate before user sees can use in header. dropdown needs appear on every page once logged in. tried adding query pull these organizations in appcontroller, userid not yet available use in before filter. or how should this? should in session or there better construct use? element? in app it's no problem use user_id within beforerender (if using auth-component). you can use $this->auth->user('id') . i this: check in appcontroller if user logged in. if is, pull wanted information database (or whereever information from) , store in variable called $dropdown example. if user not logged in, $dropdown false . make variable available view $this->set(compact('dropdown')) now in layout (this important have on every page) can check if $dropdown false or not. if not, can wo...

ubuntu - How to install Metatrader 4 (Windows software) under Unix/Linux based VPS -

i stumbled upon website metatrader 4 installed under unix/linux based vps. it can installed through wine. but how make interface accessible through web browser? you can install kde / gnome on server, install vnc-server , connect it. can see interface directly browser (with of online vnc clients) or install program supports vnc connection , see interface.

flash - Are there any limitations of Flex 4.5 mobile apps on iOS? -

i've looked @ few demos adobe show apps built flex 4.5 running on ios simple list views video capture. has made me wonder if effective solution build cross platform mobile apps. for of have taken flex 4.5 mobile spin, impression on capability , performance on ios. there can't flex 4.5 mobile couldn't native app? there limitations? the mobile story in flex quite strong, in opinion. has attracted me platform , seems bringing life flex community. the experience developing apps in android , ios quite fantastic, actually. velocity in can dev blazing , abstractions provided flex (data binding, state management, skinning, etc) give ability totally rock app. the performance better had expected. not great native app, gets job done. ability share code , uis between android , ios more make in cases. there are, however, limitations. one, not using native widget set. using flex widget set. means not native look/feel. reason, best build apps app... not fle...

iphone - XML Parser for ASIHTTPRequest -

what xml parser library can use best parsing xml response string asihttprequest response? easy setup , can understand, need immediate result project thanks follow , how parse xml in objective c using asihttprequest , handle methods -(void)parser:(nsxmlparser *)parser didstartelement:(nsstring *)elementname namespaceuri:(nsstring *)namespaceuri qualifiedname:(nsstring *)qualifiedname attributes:(nsdictionary *)attributedict -(void)parser:(nsxmlparser *)parser didendelement:(nsstring *)elementname namespaceuri:(nsstring *)namespaceuri qualifiedname:(nsstring *)qname -(void)parser:(nsxmlparser *)parser foundcharacters:(nsstring *)string see link too

How to pause FFmpeg from C++ code? -

i'm writing visualc++ program have code invoke ffmpeg.exe convert video file. wonder possible pause/resume ffmpeg converting thread c++ code? lr. all need suspend , resume ffmpeg child process itself. the main problem is: there no suspendprocess api function. , there no documented or safe way of doing this. the simple way of doing via suspendthread/resumethread. see this article on codeproject how it.

objective c - Core Data: force one attribute to load before others -

i have transient attributes in entity derived 1 other transient attribute (call x). when fetch, seems try load attributes in no particular order, if x taking time calculate, other derived attributes try use x , it's null causes issues. is there way force core data ensure loading 1 attribute before other attributes can read it? or force other attributes reload once attribute x has done loading? other technique recommend? i'm using in ios tableview backed nsfetchedresultscontroller. no can't force attributes "load" in order because attributes don't load. initializing objects here , not reading cells in procedural database. i'm going guess trying calculate value based on attributes or counts of external objects. if so, can serious slow downs while other objects faulted in values can accessed. if so, you've got data model design problem. i've never seen transient value complex calculation impaired operation. need break apart or move ...

Android gridview : error while displaying large number of images -

i have grid view populated using custom imageadapter class extending baseadapter. images dynamically loaded particular folder in sd card. have named images according postition (1.png, 2.png etc.). have set onclicklistener grid items: audio file same name image played sd card. it works when number of images less , fits on screen. but when number large , images doesn't fit on screen, next set of rows displayed scrolling screen downwards repetition of images first few rows rather images @ corresponding position. i find logcat getview() function of adapter class gets called images visible on screen , while scrolling downwards, not being called further positions also entire set of images gets re-arranged. should different basic implementation of grid view displaying large number of images? there else must taking care of? edit - code i'm setting each tab using tabgrid[i].setadapter(new imageadapter(this,i)); this image adapter class @override public int getcou...

javascript - JQuery Mobile + PhoneGap for Android - Error loading index.html -

i trying basic phonegap + jquery mobile program running android platform 2.2 , getting application error "the connection server unsuccessful (file:///android_asset/www/index.html)" in android emulator when try run application in android emulator platform 2.2 on windows xp , eclipse 3.7 . the file loads if remove references , syntax of jquery mobile html file, project fine there's missing initialization of jquery mobile. using phonegap 0.9.6 jquery mobile version * 1.0b1 * jquery version 1.6.1 (i tried jqm version 1.0a2 jquery 1.4.4 same error). if remove references jquery mobile html file able load program in emulator without errors. i looked @ several examples on web , tried them are, of them show same error. files as: <!doctype html> <html> <head> <meta name="viewport" content="width=320; user-scalable=no" /> <meta http-equiv="content-type" content="text/html; charset=utf-8">...

c# - Adding List Array item In A Data Table Using Loop Results Error .. -

i trying put list array(res) item in data table(_hdt) using loop have put values in "res" list erray using loop...but loop results in error: "variable use asd method ?" here _hdt , dt data table , res list array, for (int r = 0; r < _hdt.rows.count; r++) { foreach (datarow row in dt.select("date='" + _hdt.rows[r]["date"].tostring().trim() + "'")) { datetime date = convert.todatetime(_hdt.rows[r]["date"].tostring().trim()); string dateformat = string.format("{0:dddd mmm d}", date); _hdt.rows[r]["date"] = dateformat; _hdt.rows[r]["mtu"] = row["mtu"].tostring().trim(); _hdt.rows[r]["power"] = (convert.todecimal(row["power"].tostring().trim()) / 1000).tostring(); _hdt.rows[r]["cost"] = row["cost"].tostring().trim(); _hdt.rows[r]["vol...

javascript - How to detect some unique browser instance number, or pid number per "window" or per "tab" -

i'm writing web app, , have classic problem session cookie shared between browser instances, , browser tabs. browser doesn't send header. able control requests inside app, i'm wondering if can add own "parameter". so question is, there javascript might identify process id, or instance id, or tab id on client side? can take care of sending server, i'm wondering if knows of tricks on browser side. browser-specific suggestions welcome - i'm happy answers work in 1 browser type. here list of information can javascript: information web browser javascript . don't think can system specific information pids javascript, security issue.

java - ProgressDialog Problem? -

there progressdialog in app. running after finishing process not close. error, i'm doing. thanks. button.setonclicklistener(new view.onclicklistener() { public void onclick(view v) { progressdialog.show(); new thread(new runnable() { public void run() { try { // doing something... progressdialog.dismiss(); } catch (exception e) { e.printstacktrace(); } } }).start(); } }); do this...... button.setonclicklistener(new view.onclicklistener() { public void onclick(view v) { progressdialog.show(); new thread(new runnable(...

How do I authorize Eclipse to retrieve bamboo results? -

i've installed eclipse connector , added repository jira works fine. i've added repository bamboo, showed build on server , selected subset of these builds. when refreshing build information in bamboo view, eclipse reports http 401 error. as might notice description above, connector told me login credentials correct i'm assuming bamboo issue. how can allow eclipse retrieve bamboo build information (i have administrator rights bamboo)? edit i've tried filling in http authentication fields, did not change anything. edit2 using bamboo 2.5.3 build 1716 , eclipse helios (3.6) atlassian connector 3.0.0 plugin , mylyn 3.6.0 plugin.

How to deploy Java web application project from Eclipse to live Tomcat server? -

i have developed web application using html, java servlet , all. while developing using tomcat deploy in order test it. now development done , want make live. have live server new dont know how deploy java web application on live server? so please me if know answer? my project structure projectname ->src ->beanclass ->class1 ->class2 ->easyservlet ->servlet1 ->servlet2 ->servlet3 ->easytrans ->class1 ->class2 ->class3 ->class4 ->build ->webcontent ->meta-inf ->menifest.mf ->web-inf ->lib(contain javascript files) ->web....

NHibernate foreign key set -

i have a: class garage { int garageid; iset<car> cars } should cars class have garageid 1 of properties, in: class car { int carid; int garageid; string name; } that how appears in database, wondering if classes on many side supposed have foreign key property or if orm adds in when performing sql (assuming can specify in mappings file). in short: no. (and yes orm take care of fk based on mapping files) the "car" table have garageid in should not add car class. you can have bi-directional relationship (although opinions vary on whether these idea). a bi-directional relationship make car class this: public class car { public virtual int id {get; set;} public virtual garage garage {get; set;} //you can traverse garage public virtual string name {get; set;} } if me post fluent/xml maps let me know.

mysql - How should I write this query? -

i want show rows except last 2 id. have tried: select f.* failed_order_emailids f id not in (select id failed_order_emailids order id desc limit 2) this giving following error: this version of mysql doesn't yet support 'limit & in/all/any/some subquery' select f.* failed_order_emailids f left join (select id failed_order_emailids order id desc limit 2) last2 on last2.id = f.id last2.id null you use this: select f.* failed_order_emailids f f.id < ( select min(id) ( select id failed_order_emailids order id desc limit 2) last2 )

asp.net - Ajax Update Panel in Nested Listview not working -

i have ajax update panel inside nested listview shown below. <%@ page title="lv ajax" language="vb" masterpagefile="~/masterpages/simplemasterpage.master" autoeventwireup="false" codefile="lv ajax.aspx.vb" inherits="lv_ajax" %> listview ajax <asp:scriptmanager id="scriptmanager1" runat="server"> </asp:scriptmanager> <asp:listview id="outerlistview" runat="server" datasourceid="sqldatasource1"> <emptydatatemplate> no data available. </emptydatatemplate> <itemtemplate> <asp:label id="photoalbumidlabel" runat="server" text='<%# eval("photoalbumid") %>' visible="false" /> <asp:updatepanel id="updatepanel1" runat="server"> <contenttemplate> ...

Titanium iphone with Facebook connect to rails devise app -

i'm developing iphone app titanium doing api calls rails3 app devise/omniauth. and can't seem how fb connect in app , able auth api calls. there's a start here means user has to: fb connect in app send result rails app devise token ask needs using token is there way directly use result of step 1 , rid of step 2? super thanks! you can make facebook connect calls directly titanium application. http://wiki.appcelerator.org/display/td/280+integrating+contacts+&+social+apis

.net - c# mvc area folder structure and class name -

i have web project folders constructed within areas . there, have 2 main folders: admin , home. in home section put concerning end user whereas admin office. within admin folder, divided models , views sub-folders. following example: areas - admin - controllers - categorycontroller.cs - usercontroller.cs - models - category - edit.cs - create.cs - index.cs - user - edit.cs - create.cs - index.cs - views - category - edit.cshtml - create.cshtml - index.cshtml - user - edit.cshtml - create.cshtml - index.cshtml - home ... i guess it's fine far. since using linq sql , have table named category within it, namespace , table name create problem me. in category/edit.cs: namespace myproject.areas.admin.models.category { public class edit { public iquaryable<category> ...

c++ - Qt and dynamic library sample code -

i wanted create software conforms following structure: a gui window , , many qt dynamic libraries , exports function interface. so 2 things clear out , how make plugin qt apps , , how load them , load exported function them. many ! how create qt plugins

How to revoke given permission in Chrome and Firefox? -

one of new apis made available developers geolocation api . it's been defined in specification, browser should take express permission of user when revealing his/her geographic position surfed website. however, it's been said user can revoke given permission @ time. searched everywhere in chrome , firefox , didn't find place revoke given permissions. know how should that? (this case in contacts api ) chrome://settings/content has section allows revoke location permissions.

Restarting Rails for terminal session -

i doing ruby on rails tutorial martl , closed terminal on mac. had reached chapter 10 without problem. when opened terminal nothing working. when run bundle install following error message: /library/ruby/site/1.8/rubygems/dependency.rb:247:in to_specs': not find bundler (>= 0) amongst [rake-0.8.7, rake-0.8.7] (gem::loaderror) /library/ruby/site/1.8/rubygems/dependency.rb:256:in to_spec' /library/ruby/site/1.8/rubygems.rb:1182:in `gem' /usr/bin/bundle:18 how terminal was? sounds rvm environment not being loaded when restart terminal. ruby on rails tutorial glosses on rvm installation rather , thats why step gets missed. check out rvm installation guide here in particular section 2 describes how ensure rvm commands go .bash_profile. let me know if need further help.

drawing - efficient android rendering -

i've read quite few tutorials on game programming on android, , of them provide same solution drawing game, having dedicated thread spinning this: public void run() { while(true) { if(!surfaceholder.getsurface().isvalid()) continue; canvas canvas = surfaceholder.lockcanvas(); drawgame(canvas); /* actual drawing here */ surfaceholder.unlockcanvasandpost(canvas); } } now i'm wondering, isn't wasteful? suppose i've game simple graphics, actual time in drawgame little; i'm going draw same things on , on, stealing cpu other threads; possibility skipping drawing , sleeping bit if game state hasn't changed, check having state update thread mantaining suitable status flag. maybe there other options. example, couldn'it possible synchronize rendering, don't post updates often? or missing , precisely lockcanvas does, blocks , burns no cpu until proper time? thanks in advance l. i tutorials have seen...

sql - text truncated using perl DBI insert -

the problem dbi 's insert leaves long string truncated when inserting ms sql server. here codes: my $insert = $dbh->prepare("insert my_table (field_1, field_2) values (?, ?)"); $insert->execute($value_1, $value_2); where field_2 has data type of varchar(100) , $value_2 text string of 90 characters spaces no other special characters. after statement executed, no error raised, checked database , apparently actual inserted $value_2 truncated @ 80th character, in middle of regular english word (i.e. not special character). i've tried alter data type of field_2 varchar(150) , text . i've used $dbh->quote($value_2) in place of $value_2 . didn't help. why happening? should do? thx!! if using freetds bug identified in freetds mailing list. see freetds silently truncating text/varchar/etc fields 80 characters , http://lists.ibiblio.org/pipermail/freetds/2011q2/026943.html , http://lists.ibiblio.org/pipermail/freetds/2011q2/026...

PHP POST with custom headers giving HTTP 400 Bad Request Response (Bug?) -

i'm having trouble posting data client machine our internal site using php. server accepts data via https basic authentication. here code i'm using post with: $parameters = array('http' => array( 'method' => 'post', 'content' => $data ) ); if ($optionalheaders !== null) { $parameters['http']['header'] = $optionalheaders; } $ctx = stream_context_create($parameters); $fp = fopen($url, 'rb', false, $ctx); with following header: $postheader = "post /index.php http/1.1\r\n". "host:my.host\r\n". "content-type: application/x-www-form-urlencoded\r\n". "user-agent: php-code\r\n". "content-length: " . strlen($postdata) . "\r\n". "authorization: basic ".base64_encode($user.':'.$password)."\r\n". "connection: close\r\n"; now, can work, , posts fine on 1 of clients p...

sql server - Calling a Function in a Stored Proc Cursors -

i have function "split" calling in stored proc cursor. my a_upload table structure is: (int, varchar(100)) upload_id allowed_file_extensions --------------------------------------------------------------------- 1 .xls, .doc, .pdf, .docx, .xlsx, .pptx, .txt 2 .xls, .doc, .pdf, .jpeg, .jpg, .docx, .xlsx, .pptx, .txt table c_file_extensions is: (int, varchar(100), bit) id description is_enabled --------------------------- 1 .xls 1 2 .doc 1 3 .pdf 0 4 .rtf 1 stored proc: declare @is_enabled varchar(10), @allowed_file_extensions varchar(100) set @is_enabled = 'true'; declare cur cursor forward_only select items split((select allowed_file_extensions a_upload upload_id = 1), ',') open cur fetch next cur @allowed_file_extensions while @@fetch_status=0 begin if exists(select * c_file_extensions descr...

iphone - A question about UIEvent -

my question is possible tell uievent object whether tap touch or sweep touch ? have checked documentation, uievent has type , subtype properties. possible values seem differentiate between tap , device motion. subtype values seem indicate motion subtypes. wish tell difference between single tap , sweep tap. hope ... you can use gesturerecognizer.

ios - Synchronized random numbers -

i have 2 devices, , looking way sync random number generation between them. more background: 2 devices connect, 1 device sends other file containing data set. data set loaded on both devices. data displayed randomization @ various levels. want display synced between devices, still randomized. a conceptual example: take stack of pictures. copy of stack sent remote device , stored future use. stacks shuffled same way on both devices drawing first picture on each device result in same output. overly simplified, there far more random numbers required in application optimizations such sharing sort order not applicable... breaking down: need simple way draw same random number pool on 2 devices. not know how many random draws may occur before devices sync, once synced should predictable draw same number of random numbers since using same data sets, there chance 1 draw more other before proceeding next batch (which require re-sync of random data). i'm looking avoid having trans...

vbscript - VB Script get services remote machine not always providing array -

using following vb script code on variey of windows os: dim objcomputer dim computername, computerstr dim rs, objcmd, cobj 'dim olog, ofso, svccnt dim arg1, args set args = wscript.arguments arg1 = args(0) wscript.echo arg1 computerstr = "winnt://" & arg1 set objcomputer = getobject(computerstr) objcomputer.filter = array("service") each aservice in objcomputer wscript.echo aservice.name if aservice.name = "mssqlserver" if aservice.status = 4 wscript.echo "running" else wscript.echo "not running" end if end if next this works fine on every server (45) one. returns array of services , doesn't. succeeds couple of times , fails 15 minutes.

Delphi 2010 image on Tbutton fading/blinking -

when set imageindex , images property of button (from imagelist component/pngs), start program , click button, image blinking slowly/ fading in , out. how prevent , seems problem? reviving old topic... after searching solution on internet , found nothing, took in tcustombutton code. it happens that, internaly, button control on windows has imagelist 6 images, follows: index 0: normal image index 1: hot image (when mouse moving on button) index 2: pressed image (while hold mouse button d own) index 3: disabled image index 4: selected image (when button has focus, not pressed nor mouse on it) index 5: (the 1 need , can't specified in tbutton control; we'll talk it) in tbutton control in delphi, can set imagelist "images" property, , can set "imageindex", "hotimageindex", "pressedimageindex", "disabledimageindex" , "selectedimageindex". properties set, tbutton control creates image list, , copy...

PHP and Ajax String Input/Output Handling Scenario -

Image
i'm still new string processing in php. below diagram of doing. ultimately, generic methodology handling strings in below scenarios. note text tends lot of math symbols , code syntax in scenario. the strings , integer input via standard html-based form (i forgot mention in diagram). step uses: mysql_real_escape_string(input); step b uses: htmlentities($string2) nothing $string1 nothing integer questions: regarding mysql injection, mysql_real_escape_string sufficient guard against this? i still need finish processing output string1. note how text used in 2 different places: html and canvas. htmlentities @ step b make code syntax appear on html5 canvas not in html. vice-versa leaving out (html syntax breaks page). there javascript function identical php's htmlentities? int form should validated make sure int. string2 ouputs "null" html when use character ('–') not standard minus-sign character ('-'). magic quo...

python - CherryPy Custom Tool for user authentication -

i'm trying set simple way of decorating methods in cherrypy controller classes user redirected login page if haven't authenticated yet. going basic python decorator, an answer here suggested use cherrypy custom tool instead. i'm trying that, can't work. here's have: def authenticate(): user = cherrypy.session.get('user', none) if not user: raise cherrypy.httpredirect('/?errmsg=please%20log%20in%20first') cherrypy.tools.authenticate = cherrypy.tool('on_start_resource', authenticate) the /home page page should restricted authenticated users, have this: @cherrypy.expose @cherrypy.tools.authenticate def home(self, **kwargs): tmpl = templatedir.get_template('home.mako') return tmpl.render() however, error when try start web site: traceback (most recent call last): file ".\example.py", line 3, in <module> controller.main import root file "c:\...\controller\main.py...

sql - full text view not return result -

i have view full index on fullname. when run select * vwpersonsearch it returns rows when run: select * vwpersonsearch [full name] ='mark rush') it returns 1 row when run: select * vwpersonsearch contains([full name],'"mark*" , "rush*"') it doesn't return row. why ? according microsoft documentation (see examples c , d) usage of asterisk indicates searching strings prefixed both terms mark , rush. don't think return anything. try changing this: select * vwpersonsearch contains([full name],'"mark*" , "rush"') this search strings prefixed mark , contain rush.

c - how to write an integer to a file (the difference between fprintf and fwrite) -

i've been trying write integer file (open mode w). fprintf wrote correctly fwrite wrote gibberish: int length; char * word = "word"; counter = strlen(word); fwrite(&length, sizeof(int), 1, file); fwrite(word, sizeof(char), length, file); and result in file is: word but if use fprintf instead, this: int length; char * word = "word"; counter = strlen(firstword); fprintf(file, "%d", counter); fwrite(word, sizeof(char), length, file); i result in file: 4word can tell did wrong? thanks! update: change writing binary (i open file in wb mode), there difference in implementation? fprintf writes string. fwrite writes bytes. in first case, you're writing bytes represent integer file; if value "4", 4 bytes in non-printable ascii range, won't see them in text editor. if @ size of file, 8, not 4 bytes.

c# - Is there a better solution to this List<DateTime> sorting? -

i writing class asp.net mvc menu. want able take list of blog entries , make archive menu similar this: 1/2011 (2) 3/2011 (1) 4/2011 (12) etc... here code using: public class archivemenumodel { private list<archivemenuitem> menuitems; public list<archivemenuitem> menuitems { { return menuitems; } } public archivemenumodel(list<datetime> dates, string streamurl) { menuitems = new list<archivemenuitem>(); int itemcount = 0; dates = dates.orderbydescending(x => x).tolist(); (int i=0; i<dates.count; i++) { itemcount++; if(i+1 < dates.count) { if(!(dates[i].month == dates[i + 1].month && dates[i].year == dates[i + 1].year)) { menuitems.add(new archivemenuitem(streamurl, dates[i].month, dates[i].year, itemcount)); itemcount = 0; } } else ...

php - Changing the content between a DIV every day -

i needed js change content of these 2 div's every day on yearly basis. example: on jan 1 date div "jan 1" , moto div moto jan 1, on january 2 date , moto changes not randomly have text each of 365 days. example , can fill out rest. thought js can php on serverside if easier. <div id="date"><h3>jan 1</h3></div> <div id="moto" align="center">example text.</div> just humor request i've provided solution...like other answers say, though: best done server-side. <script> var date = new date(); //get current date var month = date.getmonth(); var day = date.getdate(); var months = ['jan', 'feb', ... , 'dec']; //array of month formats //define mottos multi-dimensional array month , day var mottos = [ [ 'jan 1 motto', 'jan 2 motto', ..., 'jan 31 motto' ], ...

asp.net - Could II7 be blocking Javascript to maintain scroll position on page refresh? -

i have asp.net application webform has user control set refresh every x seconds using <meta http-equiv="refresh" content="60" /> when run web application on local machine visual studio jscript maintain scroll position works fine. when deploy server , run remote client doesn't work, however, work when run server locally. is there config on server i'm missing? rich edit: after doing little more research on issue, looks problem maybe result of script got http://en.hasheminezhad.com/scrollsaver . others have reported problem script not working on page in root folder, seems case me. i've asked author of script possible solution thru blog. i'll let know find out. other edit should check security zone web server in. what happens test locally in local intranet or trusted zone. run against site in internet zone, , things stop working.

intersection - Algorithm for determining whether a point is inside a 3D mesh -

what fast algorithm determining whether or not point inside 3d mesh? simplicity can assume mesh triangles , has no holes. what know far 1 popular way of determining whether or not ray has crossed mesh count number of ray/triangle intersections. has fast because using haptic medical simulation. cannot test of triangles ray intersection. need kind of hashing or tree data structure store triangles in determine triangle relevant. also, know if have arbitrary 2d projection of vertices, simple point/triangle intersection test necessary. however, i'd still need know triangles relevant and, in addition, triangles lie in front of point , test triangles. i solved own problem. basically, take arbitrary 2d projection (throw out 1 of coordinates), , hash aabbs (axis aligned bounding boxes) of triangles 2d array. (a set of 3d cubes mentioned titus overkill, gives constant factor speedup.) use 2d array , 2d projection of point testing small set of triangles, 3d ray/triangle...

hard drive - Reading a small file k times + small writes vs read large file k times + small appends -

i have make decision script shows recent event. each event can less 250 bytes. there 2 ways this write file after every event. read file , output. append file after every event. read entire file, find last item, output. (the size of file can grow pretty big, 1mb) assuming reads frequent(up once per second), writes quite frequent (say around 1000 times per day) which way better hard drive? don't worry it. hard drives cached (read , write). do simplest , easiest understand.

asp.net mvc 3 - Troubleshooting "The resource cannot be found." Error -

i have mvc 3 app few areas built it, 1 of areas admin section of site. working fine. wanted try mvccontrib portable areas make app more modular, installed mvccontrib , after trial , error got couple portable areas , running. then decided move admin area portable area, created new project , stubbed out admin portable area. had rename local admin area not conflict. while moving code admin pa decided did not want headache of moving telerik , other things had wired admin area. moved things down main project area , deleted admin pa. i rewired admin area in , went on involved in setting area. life of me cannot of areas in main project load. keep getting "the resource cannot found." error message. i went far removing reference mvccontrib , portable areas still no luck. @ end of rope not know how debug this. have used custom route handler glimpse neither useful when error thrown. here route in global.asax routes.maproute( "default", // route name ...