Posts

Showing posts from June, 2015

how to setup a local repo of mercurial -

here complete scenario: main repository: http://10.0.1.8:8000/ptest i clone @ host 10.1.0.115 , in folder /local-repo then, publish using command hg serve -p 9900 -d --webdir-conf hgwebconfig hgwebconfig file having [paths] ptest = /local_repo/ptest [web] style = gitweb now, on same host 10.0.1.115, create seperate folder /qa , do: hg clone http://10.0.1.115:9900/ptest and files, want make changes , push them repo on http://10.0.1.115:9900/ptest using command hg push ssh://10.0.1.115//??/ptest i don't know correct value ?? . questions are: how setup user/password push changes repo on 10.0.1.115 ? what corect syntax in case? when try push changes error: hg push ssh://user@10.0.1.115/ptest user@10.0.1.115's password: remote: abort: there no mercurial repository here (.hg not found)! abort: no suitable response remote hg! do need push via ssh:// when pulled via http:// ? after hg clone http://10.0.1.115:9900/ptest clone should able...

difference between c# and java write() -

i trying establish serialport communication between eftpos terminal connected serialport , computer. eftpos manual has c# code testing , in have following lines write port , read port straightaway. port.writeline("@pl"); console.writeline(port.readline()); but in java if use application goes halt. using eventhandlers in java read response eftpos terminal. still couldnot work. have doubt writeline("@pl") of c# , outputstream.write(bytearray) of java. these 2 methods phrases string in same whay when written on port ?? because eftpos respond if message "@pl". solution problem great relief me.. it's possible they're writing in different encodings. if eftpos terminal expecting ascii , java writing utf-16, won't work.

xslt - Find maximum value of all child elements and only get the max row of that child using xsl transformation 1.0 -

for example source xml <records> <record> <personid>111</personid> <location>australia</location> <year>1999</year> </record> <record> <personid>222</personid> <location>netherland</location> <year>1919</year> </record> <record> <personid>111</personid> <location>usa</location> <year>2000</year> </record> </records> now after xsl should below takes latest year's (max on elemtnt year) , discards old records personid: <records> <record> <personid>222</personid> <location>netherland</location> <year>1919</year> </record> <record> <personid>111</personid> <location>usa</location> <yea...

ajax - What's the most efficient / fast way to display website within another website? -

i developing portfolio website , thought nice show websites i've created within portfolio website. so have header navigation of portfolio website , beneath or website portfolio list. i mentioned , i've heard can such job, have no idea of how use them. so please suggest way efficient, browser friendly, wouldn't take lot of server resources display different websites (and job). additionally: way planning having links different websites http://webpage.com/portfolio.php?url= http://anotherwebpage.com when user clicks website shown in (or else) http://anotherwebpage.com . if possible suggest "ajax" method not require page refresh , show different webpage in (or else ;d ) instantly after user clicks on different links thank ))) use javascript , iframe <a href="http://yourpage.com" onclick="document.getelementbyid('iframe').src=this.href;return false">my page</a> <iframe id="iframe"...

.net - What is a "mostly complete" (im)mutability approach for C#? -

since immutability not baked c# degree f#, or framework (bcl) despite support in clr, what's complete solution (im)mutability c#? my order of preference solution consisting of general patterns/principles compatible with a single open-source library few dependencies a small number of complementary/compatible open-source libraries something commercial that covers lippert's kinds of immutability offers decent performance (that's vague know) supports serialization supports cloning/copying (deep/shallow/partial?) feels natural in scenarios such ddd, builder patterns, configuration, , threading provides immutable collections i'd include patterns community might come don't fit in framework such expressing mutability intent through interfaces (where both clients shouldn't change , may want to change can through interfaces, , not backing class (yes, know isn't true immutability, sufficient): public interface ix { int y{ get; } re...

Unable to debug MVC source code in Visual Studio 2010 -

Image
i'm trying debug mvc source code in visual studio 2010 using microsoft symbols server. i've configured debugging options seen below: and project targeting .net framework 4.0. (as said in debug .net framework's source code shows disassembly in visual studio 2010 ) when try load symbols of system.web.mvc.dll, window pops saying they're being loaded. in end, modules window says couldn't found, call stack lines still grayed out , code disassembly window. anyone knows happening? microsoft has not provided symbols/source code entire .net framework via symbol server. mvc opened source can seperately download mvc source microsoft: http://aspnet.codeplex.com/releases/view/58781

node.js - How do I update a property with the current date in a Mongoose schema on every save? -

in database collections, want update 'lastchanged' field every time record updated current datetime. want in same format mongoose's default date like: isodate("2011-10-06t14: 01: 31.106z") any words of wisdom? if want iso string use: new date().toisostring()

visual studio lightswitch - How to hide a column in a code-first entity (RIA) -

i thought have been simple not working. i can, lightswitch screen designer, hide field not visible @ runtime. see lightswitch adds hidden attribute field in lsml file. but, how have default of not visible fields coming ria services ? i tried adding scaffoldcolum(false) attribute entity field... no effect. (even tried true in case misunderstood attribute). furthermore tried other attributes without success. display(autogeneratefield = false) editorbrowsable(editorbrowsablestate.never) when create ria service, & attach data source, lightswitch treats entity/table, same of it's own entities. though lsmls file has "hidden" attributes applied properties, means "display default" checkbox has been unticked property in table designer. unticking box means in auto-generated screens property won't displayed. if create own screen, based on entity, screen designer omit adding properties visual tree. the way know of "hide" pro...

MySQL Auto Generated Unique Text Value? -

i have mysql table looks this: my_number my_unique_text_field in which, my_number integer whenever insert number field my_number , i'd unique text value assigned field my_unique_text_field . possible achieve using mysql directly? or must generate unique text string using client (i using python )? mysql's uuid enough. in case if still worry possible duplicates - you'd better generate in python , handle unique constraint error.

image processing - OpenCV persistent object tracking and hysteresis strategy -

i'm building object tracking api team. my code recognize foreground objects in camera scene. on time, call methods addobject(id, pos) , updateobject(id, newpos) , , removeobject(id) on instances implement listener interface. these post frame-processing events -- might occur 30 times second. how can make sure objects don't flicker in , out of existence? need give objects minimum lifetime. if object disappears 1 frame , reappears in same spot in next frame new id, undesired flickering. (my thoughts far) have thought using object mask accumulator basis instantiation. imagine grayscale image, candidate regions objects intensified in accumulator each frame, object region exceeds threshold, gets instantiated , call addobject(id, pos) method. now, problem is, object can hover around threshold in accumulator , can still exhibit flickery behavior. then, add constant value object region instantiated have lifetime in accumulator. constant subtracted when region crosses bel...

advanced (nexted) has_many :through queries in Ruby on Rails (double-JOIN) -

i having nested database layout, however, seem need it. is, our website visitors may each have single account maintaining multiple users (think of identities) within. may create tickets, grouped ticket sections, , have ticket manager (operator) process incoming tickets. not every ticket manager may see every ticket manager member of given ticket section for. now, totally fine in querying via raw sql statements, failed verbalizing 2 special queries rails way. here (abstract) model: # account system class account < activerecord::base has_many :users has_many :tickets, :through => :users has_many :managing_ticket_sections, ... # ticketsection-collection account (any of users) operate has_many :managing_tickets, ... # ticket-collection account (any of users) may operate on end class user < activerecord::base belongs_to :account has_many :tickets has_many :managing_ticket_sections, ... # ticketsection-collection user operate has_many :managing_tic...

c# - Creating Active Directory of usernames for LDAP access -

i newbie ldap , active directories. i need build active directory of users eligible access particular conputer. when user enters username , password in web interface(created in c#) sent active directory via ldap query active directory. ad return users email address if login successful. is possible setup active directory achieve above scenario locally? using windows 7 ultimate. have installed adam ldap access. regards, john. since you're on .net 3.5 , up, should check out system.directoryservices.accountmanagement (s.ds.am) namespace. read here: managing directory security principals in .net framework 3.5 basically, can define domain context , find users and/or groups in ad: // set domain context principalcontext ctx = new principalcontext(contexttype.domain); // validate username/password combo if (ctx.validatecredentials(username, password)) { // if valid - find user userprincipal user = userprincipal.findbyidentity(ctx, username); if (user...

internationalization - How to format with non-English quotation marks in .NET? -

while on holiday in austria recently, noticed quotation marks looked different ones i'm used seeing here in britain. checking wikipedia shows things quite different around world. given use culture-dependent decimal , list separators in c# code, i'd use correct quotation marks. know where, if anywhere, i'd find relevant characters in .net framework classes? thanks. that'll unicode characters, supported out-of-the-box in .net , character fonts. an obscenely detailed discussion on wikipedia here: http://en.wikipedia.org/wiki/quotation_mark_glyphs . in c#, you'd use e.g. "\u00ab" define left-guillemet: « - , on, based on table in article.

matlab - Layering multiple images in 3D-space -

Image
suppose have matrix of size 49x49x5, corresponding 5 images of size 49x49 stacked along third dimension have total of 5 images. these images should visualize density of gas in 3d space, can think of each image section cut of room @ different locations. is there way make figure in matlab 5 images shown hanging in 3d space "came from"? here image making clearer after: consider following example. uses low-level surface function plot stacked images: %# create stacked images (i repeating same image 5 times) img = load('clown'); = repmat(img.x,[1 1 5]); cmap = img.map; %# coordinates [x,y] = meshgrid(1:size(i,2), 1:size(i,1)); z = ones(size(i,1),size(i,2)); %# plot each slice texture-mapped surface (stacked along z-dimension) k=1:size(i,3) surface('xdata',x-0.5, 'ydata',y-0.5, 'zdata',z.*k, ... 'cdata',i(:,:,k), 'cdatamapping','direct', ... 'edgecolor','none', 'face...

java - Using Android Parcelable with nested objects? -

i have class have implemented parcelable. in class using list of objects jar. wondering how can write list without being able implement parcelable on someobject. class seems writetoparcel fine when reading in having issues. great. thanks if performance not big of deal, (if jar's class implements serializable) call writeserializable() on parcel .

php - What error messaging could I insert into this script to find out the problem -

i'm reading book called php 5 advanced techniques larry ullman. in chapter 4, introduces pear. after long struggle managed pear working mamp , installed auth , mdb2 package required authentication code. however, when run it, i'm getting server errror the website encountered error while retrieving http://localhost:8888/phpvqp2_scripts/ch04/login.php. may down maintenance or configured incorrectly. here suggestions: reload web page later. is there kind of debugging can insert code figure out problem is? i'm bit of newbie detailed instructions helpful. <?php # script 4.3 - login.php /* page uses pear auth control access. * assumes database called "auth", * accessible mysql user of "root@localhost" * password of "root". * table definition: create table auth ( username varchar(50) default '' not null, password varchar(32) default '' not null, primary key (username), key (password) )...

asp.net mvc 3 - handling unique urls for each user -

i want provide each users of website separate url users see same pages. www.myweb.com/user1/logon www.myweb.com/user2/logon similary www.myweb.com/user1/wellcome www.myweb.com/user2/wellcome is there mechanism in asp.net mvc can handle such things? isn't route working you: routes.maproute( "myroute", "{user}/{action}", new { controller = "home", action = "index" } ); you might need custom authorize attribute ensure user token coming url matches 1 in authentication cookie or user1 type in url user2 , see pages, if not requirement you don't need to.

c++ - Rotating the view in openGL? -

i'm new working opengl , attempting create mouse-look camera. i'm not looking code as method opengl uses managing roll, pitch, , yaw of view. checked out glulookat looks more observing individual object, rather manipulating view. rotating around y axis works fine yaw. when rotate around x , z based on yaw, things go haywire. there different methods rotation, personal experience suggest arcball rotation, see this

java - how to create empty folder into my gallery? -

how create folder in gallery 1st need create 1 empty folder in gallery task simple folder creation no need share images in folder, 1st want view folder in gallery....now gallery display lot of image.... package galleryview.galleryview; import java.io.file; import android.app.activity; import android.content.context; import android.content.intent; import android.database.cursor; import android.net.uri; import android.os.bundle; import android.os.environment; import android.provider.mediastore; import android.view.view; import android.view.viewgroup; import android.widget.adapterview; import android.widget.baseadapter; import android.widget.gallery; import android.widget.gridview; import android.widget.imageview; import android.widget.adapterview.onitemclicklistener; public class galleryview extends activity { /** called when activity first created. */ private cursor imagecursor, actualimagecursor; private int image_column_index, actual_image_column_index; gridview imagegrid...

polymorphism - C++: Why does a struct\class need a virtual method in order to be polymorphic? -

following this question , i'm wondering why struct\class in c++ has have virtual method in order polymorphic. forcing virtual destructor makes sense, if there's no destructor @ all, why mandatory have virtual method? because type of polymorphic object in c++ is, basically, determined pointer vtable, table of virtual functions. vtable is, however, created if there's @ least 1 virtual method. why? because in c++, never didn't explicitly ask for. call "you don't have pay don't need". don't need polymorphism? saved vtable.

asp.net - System.IndexOutOfRangeException on SQLDataReader Value Using C# -

i have sqldatareader returns 3 integers. however, there occasions when 2 of integers return null values. to round wrote following: int shoppingcartheadid = 0; int billid = 0; int delid = 0; conn.open(); reader = comm.executereader(); if (reader.read()) { shoppingcartheadid = convert.toint32(reader["shoppingcartheadid"]); if (!reader.isdbnull(billid)) { billid = convert.toint32(reader["billid"]); } if (!reader.isdbnull(delid)) { delid = convert.toint32(reader["delid"]); } } reader.close(); unfortunately i'm still getting error message. suggestions? ps tried no luck if (reader["billid"] != null) i try access index instead of column name, in case passing not existing column name. also, make sure wrap reader using block in case if there exception reader closed , disposed, example in way: ... using(var reader = comm.executerea...

Storing large XML in MongoDB -

i have pretty huge xml (>10mb in size & 40+ elements). store such xml in oracle db , use xquery query , retrieve parts of xml. process slow , takes many db calls. exploring mongodb store xml , query it. justed converted xml json , loaded mongo collection , stored huge json data in flash. , stores xml nodes nested docs. when query (using find) inner element, returns whole doc, containing nodes non-matching element values also. expect few nodes matches given node value. let me know if there best way store such large xml files in mongo db. , let me know how retrieve inner nodes having exact values specified in query. in advance. have thought trying up-to-date xml database, such basex (http://basex.org)? might give better results, in particular if have used xquery before anyway.

system.drawing - Drawing a string with full justified in .NET -

i need sraw string bitmap full justified. know stringformat.alignment doesn't support full justified alignment. so, i'm looking solution draw string on bitmap full-justify. ricttextbox has full justify think uses winapi justify text. maybe can draw text richtextbox don't know how controls bitmap(screenshot) without displaying in form. there trick or alternative 3rd party library system.drawing.graphics? i used method draw richtextbox on bitmap. public class extendedrichtextbox : richtextbox { private const double inch = 1440 / 96;//not 14.4!!, believe me can see use 1.44 doesn't work on big bitmaps. round 1440/96 14.4 works on small sized works. use /96 public void drawtobitmap(graphics graphics, rectangle bound) { update(); // ensure rtb painted intptr hdc = graphics.gethdc(); formatrange fmtrange; rect rect; rect.left = (int)math.ceiling(bound.x * inch); rect.top = (int)math.ceiling(bound....

Is PHP's count() function O(1) or O(n) for arrays? -

does count() count elements of php array, or value cached somewhere , gets retrieved? well, can @ source: /ext/standard/array.c php_function(count) calls php_count_recursive() , in turn calls zend_hash_num_elements() non-recursive array, implemented way: zend_api int zend_hash_num_elements(const hashtable *ht) { is_consistent(ht); return ht->nnumofelements; } so can see, it's o(1) $mode = count_normal .

dom - Create a classList substitute for the browsers that haven't implemented it yet -

there's question looks 1 here: create own classlist object when browser not implement itself problem answer works in browsers not work in ie7 , in flock (at least). i'd have alternative works these browsers. want simple believe it's not simple implement. want able apply code browser build time ie7 or ff 3.0 build: var select = document.createelement('select'); select.classlist.add('guestselect'); how can accomplish that? note don't want use frameworks or libraries. want 1 write code! i'd way specially because want learn how accomplish these kinds of things. maybe don't need answer anymore, other may still looking it. since ie7 doesn't implement element class, can't extend prototype. best can create own element class wraps dom elements, , use everywhere. that's frameworks do, way. mind you, dramatically change code you've written. that's why it's better (simpler?) rely on global functions addclas...

class - Implementing Comparable in java 1.4.2 -

i have java question. i'm trying implement comparable in class. based on research, statement class be: public class proeitem implements comparable<proeitem> { private string name; private string description; private string material; private int bomqty; // other fields, constructors, getters, & setters redacted public int compareto(proeitem other) { return this.getname().compareto(other.getname()); } }// end class proeitem however, compile error { expected after comparable in class declaration. believe because i'm stuck java 1.4.2 (yes, it's sadly true). so tried this: public class proeitem implements comparable { private string name; private string description; private string material; private int bomqty; // other fields, constructors, getters, & setters redacted public int compareto(proeitem other) { return this.getname().compareto(other.getname())...

Ajax response having special characters -

i using ajax validation. using servlet in server side.i writing in response follows response.setcontenttype("text/xml"); response.setcharacterencoding("utf-8"); response.setheader("cache-control", "no-cache"); response.getwriter().write("123"); the response xml coming invalid if have special charcters © ,® , in ie. please let me know how response xml valid having above special characters in it. download apache commons stringescapeutils. has function escaping things ©

c# to f# - Return an FSharpFunc from F# to C# -

i want write function in f#, exposes following type signature c#: public static fsharpfunc<fsharpfunc<unit,unit>,unit> foo(action<action> f) in f# tried writing: let foo (f : action<action>) : ((unit -> unit) -> unit) = ... but produces c# signature: public static void foo(action<action> f, fsharpfunc<unit,unit> x) the f# has treated code equivalently to: let foo (f : action<action>) (g : unit -> unit) : unit = ... of course, these equivalent f#, different in c#. there can produce c# want? (f# 2.0.0.0) as quick hack, rewrote f# to: let foo (f : action<action>) ((unit -> unit) -> unit)[] = ... then use head in c#. if write let foo x = fun () -> ... f# compiler optimizes code , compiles method takes 2 arguments (instead of method returning function need). function value result, need "do something" before returning function: // compiled method taking action, fastfunc , return...

c# - How to merge two lists based on a property? -

i have 2 lists, 1 fake , 1 real, like: before // fake (list 1) { id = 1, year = 2011, x = "" } , { id = 2, year = 2012, x = "" } , { id = 3, year = 2013, x = "" } // real (list 2) { id = 35, year = 2011, x = "information" } , { id = 77, year = 2013, x = "important" } i want merge them looking year, result should be: after { id = 35, year = 2011, x = "information" } , { id = 2, year = 2012, x = "" } , { id = 77, year = 2013, x = "important" } it must remove elements same year on first list , add element equivalent year on second list first list, keeping order. how can using linq? you should able using "left join": from f in fake join r in real on f.year equals r.year joinresult r in joinresult.defaultifempty() select new { id = r == null ? f.id : r.id, year = f.year, x = r == null ? f.x : r.x };

c++ - Can't delete dynamically allocated multidimensional array -

i can't delete dynamically generated arrays. there how create them: template <typename t> t **allocatedynamic2darray(int nrows, int ncols){ t **dynamicarray; dynamicarray = new t*[nrows]; for( int = 0 ; < nrows ; i++ ){ dynamicarray[i] = new t[ncols]; ( int j=0; j<ncols;j++){ dynamicarray[i][j]= 0; } } return dynamicarray; } and initialize 2d array using: long double** h = allocatedynamic2darray<long double>(krylovdim+1,krylovdim); i can't delete it. here variations i've tried: delete[] h; and gives error: "cannot delete objects not pointers" when apply this: (int qq=0; qq < krylovdim+1; qq++){ (int ww=0; ww < krylovdim; ww++){ delete [] h[qq][ww]; } delete [] h[qq]; } is there way clean delete? i'm using visual studio 2010 if helps. try this: for (int qq=0; qq < krylovdim + 1; qq++) {...

.net - How to encrypt a generic dictionary? -

could provide starting point encrypting generic dictionary in .net? update i'm storing bunch of string values string keys. dictionary storing quite few items though. i'm not sure whether encrypting content better vs encrypting dictionary. see this question on encrypting/decrypting strings. if want encrypt whole dictionary object first need copy sortedlist<string, string> or similar. xmlserialization doesn't support idictionary-objects (neither keyvaluepair). here wrapper class dictionary supports serialization.

java - Android NDK Capturing Key Events -

i have android ndk game (ndk 4.) of code in c++ (it's port) in java have activity , glsurfaceview override ontouchevents. i'm trying figure out how receive key press events can forward them on native code handled. i tried having view implement onkeylistener onkey() never called. tried overriding onkeydown() , onkeyup() in view no success. missing something? update the view i'm using it: public class fooview extends glsurfaceview implements surfaceholder.callback, onkeylistener { private gamerenderer _renderer; private gamelistener _listener; public fooview(context context) { super(context); this._renderer = new gamerenderer(); setrenderer(this._renderer); this._listener = new gamelistener(context); baselib.setlistener(this._listener); } @override public boolean ontouchevent(final motionevent event) { // touch code... } @override public boolean onkeydown(int keycode, k...

arrays - C# List of lists (2D matrix) -

im trying implement 2d array class using list of lists. can please me implement function similar t this[int x, int y] function below elements in column given [int x,:] x column. returning array fine. public class matrix<t> { list<list<t>> matrix; public matrix() { matrix = new list<list<t>>(); } public void add(ienumerable<t> row) { list<t> newrow = new list<t>(row); matrix.add(newrow); } public t this[int x, int y] { { return matrix[y][x]; } } } or: return matrix.select(z=>z.elementatordefault(x));

How should I start with tracking file changes/versions? -

i've been working lot of files on go recently, , in process times accumulated several copies of files in different stages of completion/revision. i'm working on number of projects @ given time, it's not easy remember or figure out version should continue working on. what type of options recommend allow me track changes locally , if possible files work on while @ remote location? i've never worked file versioning or tracking systems, not sure direction should looking in. work html, css, , php. any awesomely appreciated! thanks. ps. don't know if should have in separate question options available same type of thing, change tracking/logging files on server? preferably not vaguely notes file has been changed, tracks specific changes have occurred in files. it's seems me github prefect choice requirement. can create repository maintain history, it's easy use , it free https://github.com/

Css float issue -

http://jsfiddle.net/55ruh/9/ . red box doesn't bigger if enter text. <div class="box" style="background: red"> <div class="lefty">text</div> <div class="righty">text</div> </div> .box { background: red; width: 229px; color: white; } .lefty { float: left; } .righty { float: right; } http://jsfiddle.net/55ruh/10/ float causes element out of flow of document. on parent element: zoom: 1; /* ie fix */ overflow: hidden;

.htaccess - Redirecting ? with htaccess -

i'm trying redirect "somepage?open=support" "support", did this: rewritecond %{query_string} ^open=support$ rewriterule (.*) /support? [r=301,l] but works works cases like: "site.php?1=2?open=support" not "?1=2?open=support". i want work every & cases. appreciate advice on issue. by putting ^ , $ in rewritecond saying query string must equal open=support . sounds want contains open=support . like rewritecond %{query_string} ^(|.*\&)open=support(|\&.*)$ note: don't double ? s in examples @ all, ignoring them. if you're allowing ? act delimiter in query string & , maybe rewritecond %{query_string} ^(|.*[\?\&])open=support(|[\?\&].*)$

Does moving a file in SVN delete its revision history? -

i realize might easy question may have overlooked in documentation, didn't find other questions this. when move file, or in case whole ton of files (i moving trunk repo root) lose revision history? thought looks lot it's deleting , adding files , therefore lose history. thoughts? no. svn move equivalent svn copy , , svn delete . copied files share history originals.

I need to find the number of 3, 4, 5 and 6 letter words in a string using VBScript -

here's question have answer assignment: count number of words in string "tx_val" have 3,4,5 or 6 chatacters. show these 4 counts on single line seperated commas in span block id="ans12" . here's i've come with, output incorrect , i'm not sure why. i'll post below. thought i'd give update of @ it. threematch = 0 fourmatch = 0 fivematch = 0 sixmatch = 0 totalmatch = "" cntarr = array() cntarr = split(tx_val," ") i=0 i=0 ubound(cntarr) step 1 if len(cstr(cntarr(i))) = 3 threecount = threecount + 1 elseif len(cstr(cntarr(i))) = 4 fourcount = fourcount + 1 elseif len(cstr(cntarr(i))) = 5 fivecount = fivecount + 1 elseif len(cstr(cntarr(i))) = 6 sixcount = sixcount + 1 end if i=i+1 next totalmatch = (threecount & ", " & fourcount & ", " & fivecount & ", " & sixcount & ".") document.getelementbyid("ans12").innerhtml = tot...

php - finding latest entry in DB and all other before it in a different table -

this easy thing in theory havent got clue how it. need method find latest timestamp/entry in table called 'answers' in mysql db. , upon finding this, find ip's stored in table called 'ip' timestamp occur before said mention 'answers' entry. any ideas? im guessing if() function best way? edit: table structure 'ip' exists. create table if not exists `votes` ( `id` int(250) not null auto_increment, `ip` varchar(30) not null, `answer_id` int(250) not null, `poll_id` int(250) not null, `timestamp` int(250) not null, primary key (`id`) ) engine=myisam default charset=latin1 auto_increment=2 ; and table 'answers' live create table if not exists `answers` ( `id` int(250) not null auto_increment, `poll_id` int(250) not null, `answer` varchar(250) not null, primary key (`id`) ) engine=myisam default charset=latin1 auto_increment=3 ; surely can pure database solution doesn't need doing in php? assuming tables in same databas...

coldfusion - Localhost pointing to different codeFolder locations -

windows xp professional/coldfusion/dreamweaver/fusebox-3 i have same cf-8 code in 2 places * folder a:- c:\coldfusion8\wwwroot\bootsmancode\code * folder b:- c:\wwwroot\bootsmancode\code local:- http://127.0.0.1:8500/bootsmancode/ http://localhost:8500/bootsmancode/ issue:- making code changes in "folder b", testing on http://localhost:8500 . when go home , use vpn, cannot see these code changes when call http://localhost:8500 folder b when use http://localhost:8500/ , code folder a, able see code changes. so url seems magically pointing different folders @ at diffent time. any correction please let me know? would need more detail more definitive answer, i'd happy take closer look. things at/ask/suggest include: if you're using iis, have bindings/host headers route request 1 folder another? following on vas's comment (are talking 127.0.0.1 vs. localhost showing different results issue?) from home, when vpn... ...

signal processing - algorithm for antialiasing an image with sync filter -

i have been reading ways antialiasing , since not processed in real time antialising signal processing seems ideal especial against artifacts. however have read not mention step turning a bitmap image signal , again,so i'm looking algorithm or code examples demonstrate that. the usual way things handled apply filter independently in both x , y directions. way, overall filter g(x,y) = f(x) * f(y) . in kind of situation, g(x,y) called separable filter , , advantage that, applying x- , y- filters separately, straightforward filter convolution takes o(x y f) time, x , y dimensions of image, , f support width of filter f() . arbitrary nonseparable filter of same size (which have o(f^2) samples) requires o(x y f^2) time... if want apply full sinc() ( == sin(x)/x ) filter image, unlimited support of sinc() function make straightforward convolution slow. in case, faster 2d fft of image, filter in frequency domain, , transform back. in practice, though, people use ...

tsql - Sql Query help to get non matching records from two tables -

i trying non matching records 2 tables for ex tablea id account 1 acc1 2 acc2 3 acc3 tableb opp accountid opp1 1 opp2 2 opp3 4 i need know accountid present in tableb not available in tablea. wonderful explain how approach query. required record opp3 of tableb thanks prady create table #one (id int,acc nvarchar(25)) insert #one (id , acc) values(1,'one') insert #one (id , acc) values(2,'two') insert #one (id , acc) values(3,'three') create table #two (acct nvarchar(25),ids int) insert #two (acct,ids) values('one',1) insert #two (acct,ids) values('two',3) insert #two (acct,ids) values('four',4) select ids #two except select id #one drop table #one drop table #two test one

Change PHP PEAR for mysql connection -

i'm working along tutorial on how import excel data mysql. problem have used pear: database connection , don't know how works. convert code commonly used mysql connection string. i'm sure i've never seen pear or db::connect used before. here's code below. <?php require_once( "db.php" ); $data = array(); $db =& db::connect("mysql://root@localhost/names", array()); if (pear::iserror($db)) { die($db->getmessage()); } function add_person( $first, $middle, $last, $email ) { global $data, $db; $sth = $db->prepare( "insert names values( 0, ?, ?, ?, ? )" ); $db->execute( $sth, array( $first, $middle, $last, $email ) ); $data []= array( 'first' => $first, 'middle' => $middle, 'last' => $last, 'email' => $email ); } if ( $_files['file']['tmp_name'] ) { $dom = domdocument::load( $_files['file']['tmp_name'] ); $rows = $dom-...

How to expand a list to function arguments in Python -

this question has answer here: *args , **kwargs? [duplicate] 11 answers is there syntax allows expand list arguments of function call? example: # trivial example function, not meant useful. def foo(x,y,z): return "%d, %d, %d" %(x,y,z) # list of values want pass foo. values = [1,2,3] # want this, , result "1, 2, 3": foo( values.howdoyouexpandme() ) it exists, it's hard search for. think people call " splat " operator. it's in documentation " unpacking argument lists ". you'd use this: foo(*values) . there's 1 dictionaries: d = {'a': 1, 'b': 2} def foo(a, b): pass foo(**d)

c# - In CQRS, should my read side return DTOs or ViewModels? -

i'm having debate coworkers in design of read side of cqrs application. option 1: application read side of cqrs application returns dtos, e.g: public interface iorderreadservice { public orderdto load(int id); } public class somecontroller { public actionresult someaction(int id) { var dto = objectfactory.getinstance<iorderreadservice>().load(id); var viewmodel = mapper.map<orderdto, someviewmodel>(); return view(viewmodel); } } public class someothercontroller { public actionresult someotheraction(int id) { var dto = objectfactory.getinstance<iorderreadservice>().load(id); var viewmodel = mapper.map<orderdto, someotherviewmodel>(); return view(viewmodel); } } option 2: application read side returns viewmodels, e.g.: public interface iorderreadservice { public someviewmodel loadsomething(int id); public someotherviewmodel loadsomethingelse(int id); } public c...

javascript - Follow all users on a twitter page -

i'm on https://twitter.com/#!/username/followers ; there greasemonkey script follow twitter users on page? here's new 1 employs delay prevent spam issues. var follow_pause = 1250; var follow_rand = 250; var page_wait = 2000; __cnt__ = 0; var f; f = function() { var eles; var __lcnt__ = 0; eles = jquery('.grid-cell .not-following .follow-text').each(function(i, ele) { ele = jquery(ele); if (ele.css('display') != 'block') { console.trace('already following: ' + i); return; } settimeout(function() { console.trace("following " + + " of " + eles.length); ele.click(); if ((eles.length - 1) == i) { console.trace("scrolling..."); ...

sql - Create a comma-separated string from multiple rows of one column? -

i've access table this id | username | carbrand ------------------------- 0 peter vw 1 peter ferrari 2 mike audi 3 peter dodge 4 heidi bmw 5 heidi ford i need names carbrand field comma separated list report. is there way (without vb, maybe using coalesce alternative?) create comma-separated string this, without name: part? peter: vw, ferrari, dodge mike: audi heidi: bmw, ford as it's report there other ways this, maybe using expressions in report? you cannot access without vba. coalesce not exist, can write udf has of functionality, example http://allenbrowne.com/func-concat.html however, once use udf, query no longer viable outside access.

c - printf before assert doesn't work -

i think i've seen issue before , bet there's better solution out there asking.. during debugging found printf before assert don't work well. they're not printed of time. tried adding fflush(stdout ) doesn't seem help. any other thoughts or alternatives? example: printf... <- not printed printf... <- not printed due assert. stdout not flushed? assert() call fflush(stdout) before assert . or, if stdout has not been redirected , refers terminal, writing newline @ end of message should sufficient. default, stdout buffered (line buffered on terminals; buffered otherwise) , output not written until output buffer overflows or newline (in line-buffered mode) or fflush encountered.

java - What are fields i should change for my codes to suit my own codes? -

what fields in example (below) should change in relation mainactivity.java file? sorry i'm kinda new in android/java therefore don't know fields change suit existing code. can help? my mainactivity.java file file dirlist = new file(environment.getexternalstoragedirectory() + "/videolist"); if(!(dirlist.exists())) dirlist.mkdir(); file tempfile = new file(environment.getexternalstoragedirectory() + "/videolist", dateformat.format(date) + fileformat); this example found not know fields should change here suit code above. want preserve existing function of calculating size of directory. private static long dirsize(file dir) { long result = 0; stack<file> dirlist= new stack<file>(); dirlist.clear(); dirlist.push(dir); while(!dirlist.isempty()) { file dircurrent = dirlist.pop(); file[] filelist = dircurrent.listfiles(); (int = 0; < filelist.length; i++) { if(file...

ruby - How to remove a trailing comma? -

given strings like: bob bob, bob bob burns, how can return w/o comma? bob bob bob bob burns also, want method not break if passed nil, return nil? def remove_trailing_comma(str) !str.nil? ? str.replace(",") :nil end my thought use string.chomp : returns new string given record separator removed end of str (if present). does want? def remove_trailing_comma(str) str.nil? ? nil : str.chomp(",") end

c++ - problem with calling libraries -

hi i'm watching c++ tutorial , instructor includes libraries # include "map.h" #include "set.h" but when use code error fatal error c1083: cannot open include file: 'set.h': no such file or directory so have write # include <map> #include <set> but have problem when create set or map ob , methods can use different shown in tutorial example in tutorial instructor create , navigate set or map set<int> ss; set<int>::itrator itr = ss.itrator(); while(itr.hasnext()){ cout<<itr.next(); } but ss , object doesn't have methods ss.itrator(); itr.hasnext() itr.next(); an have write code set<int> ss; set<int>::itrator itr = ss.begin(); while(!itr.end()){ cout<<*itr; } what problem ? pretty obviously, tutorial doesn't use standard template library, , uses custom library of own. #include "set.h" looks set.h file in user search path, current directory...

"Automatically" creating non-member wrappers for C++ member functions -

i have class bunch of member functions mathematical operation , return result. example: class foo { public: double f(double); double g(double); double h(double); // ... } double foo::f(double foo1) { // ... } // , on at several points in program i'm working on, need numerically integrate of these functions. numerical integration routine i'd use has signature extern "c" double qgauss(double (*func)(double, void*), void* data, double a, double b); and i've been reading seems best way pass member functions integration routine create wrapper functions: double f_wrapper(double x, void* data) { return ((foo*)data)->f(x); } but dozen member functions f , g , h , etc. wrap, , perhaps more added later, gets pretty repetitive. can (or perhaps should ) use template or macro or condense amount of code have write in order create these wrapper functions? as aside, solution i'm using reimplement integration routi...

c++ - Building an Object System Around shared_ptr -

i using shared_ptr garbage collection toy language working on compiles c++. objects derive common base class above there strings , numbers there vectors , maps. on c++ side passed wrapped in shared_ptr s containers hold shared_ptr when destroyed content destroyed too. scheme works feels bit weird in containers base objects holding shared_ptr s. there flaw design? if yes alternative hierarchy around approach? here's how i'd set up: namespace toylang { class object; // main handle type; use object references // replace boost::intrusive_ptr or similar if inefficient typedef std::shared_ptr<object> obj; class object { // whatever }; class number : public object { int x; // etc }; class array : public object { std::vector<obj> a; // etc } note toylang arrays in scheme vectors of pointers, giving language reference semantics. in fact quite common in dynamic languages: lisp, python, , others work that. long don't have circ...

Android code won't generate R.Java after cleaning -

this question has answer here: developing android in eclipse: r.java not regenerating 63 answers recently android program won't generate auto-generated r.java file under gen in android project. tried doing project->clean , still doesn't work. restarted eclipse multiple times. any ideas? make sure don't have errors* under problems tab in eclipse. try use fix project properties under android tools when right click on project. if doesn't fix problem, try modifying androidmanifest.xml (just add space , save). i've heard force r.java rebuild. * except errors says r cannot resolved variable - these errors go away once correct other errors , force r.java rebuild.

How do I correctly reference Users in GQL queries on App Engine? -

i have db.model has db.userproperty. example: class photo( db.model ): owner = db.userproperty() title = db.stringproperty() when want photos user, this: photos = photo.gql( "where owner = user(:1)", users.get_current_user().nickname() ) this causing problems, however, between google , non-google nicknames. when testing locally, if use email address test@example.com, nickname "test@example.com". if use test@gmail.com, nickname "test". when test gmail account, have append "@gmail.com" .nickname(). is there better way hard-coding + "@gmail.com" database queries? photos = photo.gql("where owner = :1", users.get_current_user())

ruby - rails new project_name using rvm -

i use rvm in rails project , specify gem versions in gemfile. however, problem right different. want create rails 3.1 project using rails new project_name current version of rails rails 3.0.3 i know can update rails gem version future executions of rails new project_name create 3.1 project? how can set things can create rails 3.1 projects while other times creating rails 3.0 projects? rvm 1.9.2 rvm gemset create rails310 rails303 rvm 1.9.2@rails310 gem install rails -v 3.1.0 rails new my_310_app rvm 1.9.2@rails303 gem install rails -v 3.0.3 rails new my_303_app http://beginrescueend.com/gemsets/basics/

compiler optimization - GCD test - to test dependency between loop statements -

i understand how gcd works on trivial example below: for(i=1; i<=100; i++) { x[2*i+3] = x[2*i] + 50; } we first transform following form: x[a*i + b] , x[c*i + d] a=2 , b=3 , c=2 , d=0 , gcd(a,c)=2 , (d-b) -3 . since 2 not divide -3 , no dependence possible. but how can gcd test on doubly nested loop? for example: for (i=0; i<10; i++){ (j=0; j<10; j++){ a[1+2*i + 20*j] = a[2+20*i + 2*j); } } while subscripts can delinearized, gcd test simple apply directly. in example, subscript pair [1+2*i + 20*j] , [2+20*i + 2*j] , we're looking integer solution equation 1 + 2*i + 20*j = 2 + 20*i' + 2*j' rearranging, get 2*i - 20*i' + 20*j - 2*j = 1 compute gcd of coefficients, 2, -20, 20, , -2, , see if divides constant. in case, gcd 2. since 2 doesn't divide 1, there's no dependence.

WCF Hosting Options Suggestion -

i looking suggestion hosting wcf enterprise application. the app. require run without stopping @ server. use tcp yield best performance @ intranet environment. i thinking host @ window service because iis recycle process, , has timeout. however, find msdn http://msdn.microsoft.com/en-us/library/ff649818.aspx : window service...lack of enterprise features. windows services not have security, manageability, scalability, , administrative features included in iis. does mean window service not suitable enterprise application? how ms sql, oracle, mysql etc. host @ win. service right? regards bryan windows service suitable enterprise application! quoted text means iis has lot of built-in management features not available in custom hosting (like windows service) unless implement them @ own. one of such features recycling want avoid helps application keep low resource consumption (server in healthy state). such feature iis checking of worker state. if worker proc...

html - sticky footer does not stay down when window is resized smaller and than scrolled -

i'm using sticky footer not stay down if resize window smaller , scroll up. image main wrapper not scaling down proplery if resize window. working url: http://www.nvcc.edu/home/ssuh/footer/index2.html screenshot of problem - http://www.nvcc.edu/home/ssuh/footer/help.html is there way keep footer on bototm of page until hits content? html: <body class="yui-skin-sam splash_asp"> <div id="parature_wrapper"> # has background image not scale right <div id="parature_content"></div> #this has backgorund image works. </div> <div id="footer"></div> </body> css: *, body { margin: 0; padding: 0; } body { font: 62.5% verdana, geneva, sans-serif; background: url(background.jpg) no-repeat center top fixed; height: 100%; } html { height: 100%; } #parature_wrapper { /* wrap of content */ width: 960px; margin: 0 auto; position: relative; background: url(to...

c# - Adding Methods To Windows Form? -

i have 2 windows forms, parent , child. parent main form. child dialog user can edit details. when button clicked on parent form, loads child form. so: private void add_account_click(object sender, eventargs e) { this.account_add_edit = new form2(); account_add_edit.test(); account_add_edit.showdialog(); } as can see i've created new form, tried call function new form, , showed form. problem method form not being called. getting error on ide says windows.forms.form not contain method test. i've created method in child form: public static string test(string val) { this.username = val; } any ideas i'm doing wrong? your method defined static , not posiible call on instace. should eaither not make static, or call static: form2.test();

c# - zlib.net compression returning null data -

i'm working on c# app auto create files updater. updater expects array of zlib data(file split 2048 byte sections each compressed). i'm missing minor but, anyway here's function public bool compress(fileinfo file) { int max = 0; int buffsize = 2048; rppackage pack = new rppackage(); string tmp = "rohan patch v1.0"; pack.header = new char[32]; tmp.copyto(0, pack.header, 0, tmp.length); if (g.version != 0) pack.version = pack.oversion = g.version; else { console.writeline("please enter patch file version: "); g.version = convert.toint32(console.readline()); //g.version = pack.version = pack.oversion = 151132417; } pack.type = 10; pack.omodify = file.lastwritetime; pack.always1 = 1; //pack.outputfile = file.name; pack.outputfile = new char[64]; file.name.copyto(0, pack.ou...

Whats "now" in SQL Server? -

i want set default value now datetime field in sql server, this? i've tried now() msdn answers @ length http://msdn.microsoft.com/en-us/library/ms188751.aspx the link includes various ways time , date people after when ask when now() select sysdatetime() ,sysdatetimeoffset() ,sysutcdatetime() ,current_timestamp ,getdate() ,getutcdate(); /* returned: sysdatetime() 2007-04-30 13:10:02.0474381 sysdatetimeoffset()2007-04-30 13:10:02.0474381 -07:00 sysutcdatetime() 2007-04-30 20:10:02.0474381 current_timestamp 2007-04-30 13:10:02.047 getdate() 2007-04-30 13:10:02.047 getutcdate() 2007-04-30 20:10:02.047