Posts

Showing posts from April, 2010

jquery - Uploadify Error in IE8 -

i can't uploadify (jquery plugin) work in ie8, works fine in other browsers. when go upload file i'm getting error: object doesn't support property or method and it's on line in uploadify.js: document.getelementbyid(jquery(this).attr('id') + 'uploader').startfileupload(id, false); i can't figure out. the javascript looks this: <script type="text/javascript"> $(document).ready(function() { var scriptdata; $.get('/lib/upload_params.php', {'key': "files/<?=random?>/"}, function(data) { scriptdata = { 'awsaccesskeyid': data.awsaccesskeyid, 'key': encodeuricomponent(data.key), 'acl': "private", 'policy': encodeuricomponent(data.policy), 'signature': encodeuricomponent(encodeuricomponent(data.signature)), 'success_action_status': "201", ...

connecting to sql server express remotely -

i have beginners question, , apologize if stupid. i beginner @ sql server. can sql pretty well, dont know connecting. i have: microsoft sql server management studio , sql express what process of allowing remote connections it? i leave laptop online @ home management studio running , access home sql server through remote connection. i know how allow 1 of databases accept remote connections? what connection string be? laptop's ip address or what? is dangerous accept remote connections? i have done following btw: http://blogs.msdn.com/b/sqlexpress/archive/2005/05/05/415084.aspx and when works: sqlcmd -e -s localhost\sqlexpress,2301 however when try not work sqlcmd -e -s my.ip.add.ress\sqlexpress,2301 anyway, after work how connect specific db?? by default, sql server express 2005 , 2008 not allow connections anywhere local computer... not difficult change it. in short, want run sql server surface area configuration program , enable appro...

c# - Limit execution time in SharePoint Timer Job? -

i have situation need move huge data using timer job. can't using onetimeschedule may impact performance of sharepoint application during peak hours. i want make run maximum of 5 hours day starting @ 20:00 everyday. what best way? you create sharepoint timer job. make timer job run every day @ given time. inside job use system.threading.timer stop main loop after 5 hours , exit job. within main loop move data - should make sure somehow persist state of main loop. in case job crashes or severe error occurs can continue processing stopped. hope helps...

android - Playing m.youtube content in webview -

ok, have java , plugins enabled. can explain why can play many online flash videos in webview, nothing on m.youtube.com works? i more satisfied workaround passes video youtube app. intent = new intent(intent.action_view); i.setdata(uri.parse("vnd.youtube:video_id")); startactivity(i); also, check out: http://it-ride.blogspot.com/2010/04/android-youtube-intent.html edit: can amongst lines of: intent = new intent(intent.action_view); i.setdata(uri.parse("http://www.youtube.com/watch?v=video_id")); startactivity(i); which (i think) give user choice of whether open in browser or youtube app. useful new devices have flash , may not have youtube app.

mfc - DDV_MinMaxUInt : Custom Validation Message -

i using mfc, develop mobile app. 1 of cedit controls, in dialog box, declared variable long int follows. ddv_minmaxuint(pdx, m_txtcurrentvalue, 1, 2000); so whenever, try close dialog box invalid values (integers not in range specified or alphabetic characters.) throws message , focuses particular control.( done automatically) now question that, have button , when ever button clicked, how can same validation, functionality called? you can call these routines yourself. did many years ago. this link may help: http://msdn.microsoft.com/en-us/library/57weza95%28v=vs.80%29.aspx

sql - Why does column = NULL return no rows? -

possible duplicate: why null = null evaluate false in sql server if generate query insert data in table "mytab" column --- age, sex, dob, id insert mytab values (22, '', '', 4) what'll value in column sex & dob ? null ? if value null --- select * mytab sex=null above query gives output ---- no rows selected --- why ?? if value not null --- select * mytab sex null above query gives output ---- how ?? null special value in sql denoting absence of data . such, cannot queries like: select fields table column = null null cannot compared anything, including null itself. instead, you'd need: select fields table column null however in case inserting empty value in sex , dob . , empty value not null . you'd have query for: select fields table column = ''

c# - Silverlight in browser UnitTesting Mock<FileInfo> -

i'm facing difficulties in silverlight (inbrowser) unittesting using mock read file viewmodel. gives me accessdenied error message. there alternative method kind of problem? unittesting draganddrop image file in silverlight 4. eg: unittesing.cs var fileinfo = new mock(); //i can't mock fileinfo var fileinfo = new fileinfo("test.jpg"); thanks jonny, did follow , not working , here sample code snipped. new interface class public interface ifileinfo { string name {get;set ;} filestream open(filemode mode); } new wrapper class public class fileinfowrapper : ifileinfo { private fileinfo fileinfo; public filestream openread() { return this.openread(); } public string name { { return this.name; } set { this.name = value; } } } in test class [testmethod] [asynchronous] public void multifiledroptest() { list wrapperlist = new list(); fileinfo.setup(fl => fl.name).returns("testing.jpg"); fileinfo.setup<stream>(fl =>...

c# - Secure connection using SOAP -

i need call .net soap webservice in secure way. must secure in such way others can't call webservice methods, , should not possible "the middle man" understand content of messages. the caller .net webapplication installed on iis. can design webservice methods want, no restrictions there. i have been researching https/ssl certificates, don't know if solves problems in way? example, anoying if certificates has expiration date, although it's not showstopper in way. so how go in way..? thanks help. as @brokenglass said, ssl encrypts traffic between points. doesn't handle securing individual functions usage without authorization. here article on such topic using soap headers: how to: perform custom authentication using soap headers this can mixed form of authentication except windows integrated. use windows authentication, you'll need have separate library accesses active directory through directoryservices namespace.

sqlite - Help Building SQL query -

i have following 2 tables channels: id int pk title varchar subchannels: channelid int subchannelid int when receive data service i'm trying persist sql. receive few channel instance, store in channels table, after i'm trying persist every subchannel (every channel contains list of subchannels), so, store subchannels in same table channels, , store theirs ids subchannel table in following way: channelid - subchannelid. so, need tree of channels 1 query i'm trying this query: select * channels except select channels.id, channels.title channels inner join subchannels on channels.id = subchannels.subchannelid but doesn't work correctly. using mssql works fine, in sqlite going wrong. could please me query, or advice me other solution store tree in sql. my channel class looks this: int id string title list<channel> subchannels thanks in advance could try: select id, title channels except select channels.id, channels.title ...

A weird expression in c++ - what does this mean? -

i've seen code finding minor of matrix: regmatrix regmatrix::minor(const int row, const int col)const{ //printf("minor(row=%i, col=%i), rows=%i, cols=%i\n", row, col, rows, cols); assert((row >= 0) && (row < numrow) && (col >= 0) && (col < numcol)); regmatrix result(numrow-1,numcol-1); // copy content of matrix minor, except selected (int r = 0; r < (numrow - (row >= numrow)); r++){ (int c = 0; c < (numcol - (col > numcol)); c++){ //printf("r=%i, c=%i, value=%f, rr=%i, cc=%i \n", r, c, p[r-1][c-1], r - (r > row), c - (c > col)); result.setelement(r - (r > row), c - (c > col),_matrix[r-1][c-1]); } } return result; } this first time encounter code line this: r < (numrow - (row >= numrow)). what mean? (row >= numrow) boolean expression. if operator>= has not been overloaded, should evaluate true if row greater or equal numrow , , false otherwis...

iphone - Creating and Resizing a UIImageView -

i able add uiimageviews screen , able re-size them, rotate them etc during run-time. how images resized, rotated etc.? opengl needed this? thanks about resizing can use frame property of uiimageview about rotating, should try applying transform uiimageview : yourview.transform = cgaffinetransformmakerotation(45.0*m_pi/180.0); good luck !

ODATA Consume Service Operation from C# ASP.NET 4.0 -

i connecting odata service via c# asp.net application, has service operations such as: getitems(int? itemid, double? price) i can consume without issues in browser, e.g. http://api.mycompany.com/companycatalogue/getitems?itemid=4 i understand how use linq entities consume odata service, can't find decent explanation of how consume service operations 1 above in c#. have made web reference service in visual studio solution. so far, have usual consuming of data: using companycatalogue; //my web reference ... protected void page_load(object sender, eventargs e) { companycatalogueentities datacontext = new companycatalogueentities (new uri("http://api.mycompany.com/companycatalogue/")); var result = in datacontext.items select i; //just example //this problems var operationresults = companycatalogue.getitems(6, 20.5); //i made } any pointers? ok, got answer: using companycatalogue; //my web reference ... protected void page_load(...

java - Why doesn't h:dataTable inside ui:repeat get correct ID? -

code: <ui:repeat var="obj" value="#{demo2bean.somelist}"> <h:panelgroup id="foo" /> <h:datatable id="bar" /> </ui:repeat> result: <span id="j_idt55:0:foo"></span> <table id="j_idt55:0:bar"><tbody><tr><td></td></tr></tbody></table> <span id="j_idt55:1:foo"></span> <table id="j_idt55:0:bar"><tbody><tr><td></td></tr></tbody></table> as can see, id datatables same 'j_idt55:0:bar' panelgroups grows (as should): 'j_idt55:0:foo', 'j_idt55:1:foo'. why so? because it's bug in uidata#getclientid() . i've reported issue 1830 .

javascript - The Windows Media Player doesn't play *.mov files :( Plese give me any suggestions -

<html> <head> <title>so-wmp</title> <script> onload=function() { player = document.getelementbyid("wmp"); player.url = "test.mp3"; }; function add(text) { document.body .appendchild(document.createelement("div")) .appendchild(document.createtextnode(text)); }; function handler(type) { var = arguments; add(type +" = "+ playstates[a[1]]); }; // http://msdn.microsoft.com/en-us/library/bb249361(vs.85).aspx var playstates = { 0: "undefined", // windows media player in undefined state. 1: "stopped", // playback of current media item stopped. 2: "paused", // playback of current media item paused. when media item paused, resuming playback begins same location. 3: "playing", // current media item playing. 4: "scanforward", // curr...

php - phpBB automated email notifications to all members regarding all posts -

while search 1 out on own, may 1 provide quick answer. thank in advance. so enjoy google groups , how every member receives notification new things happen in group. new topics, old topics, added replies , on. need our own forum, group went phpbb forum on our site. i want board send out notificatiosn members. members on phone not have present on forum physically. any 1 faced issue before, quick solutions? settings in phpbb can address right away. may custom setting groups? ============================================================================== as have found out, every user can subscribe forums. haven't been looking hard enough or missed it. produces desired effect me. far have no idea of way force behavior users regardless of actions. preferable small board. news if nativily supported phpbb bet can write code extend feature. the thing can think of somehow forcing every member subscriber every applicable forum/thread. via back-end query, not through php...

java - How to refer to dataTable parent within the dataTable? -

consider dummy case: <h:form id="wrapperform"> <h:panelgroup id="rowscontainer"> <h:datatable id="rowstable" value="#{bean.rows}" var="row" > <h:column> <h:commandbutton value="click me update (#{component.parent.parent.parent.clientid})"> <f:ajax render=":#{component.parent.parent.parent.clientid}" /> </h:commandbutton> </h:column> </h:datatable> </h:panelgroup> </h:form> on button click, id=rowscontainer gets updated should. however, if add ui:repeat there, not work anymore: <h:form id="wrapperform"> <ui:repeat id="blocksrepeat" var="block" value="#{bean.blocks}"> <h:panelgroup id="rowswrapper"> <h:datatable id="rowstable" value="...

jsp refers to an PDF streaming servlet - security question -

somewhere behind our firewall sits server full of pdfs. pdfs contain private information need restrict access pdfs. public can log in our web site , request pdfs. our software went production recently. we're redirecting them pdf server's url. fails because public can't access our pdf server. thing though have preferred prove before launch. i wrote pdf servlet stream pdf users' browsers. our jsps refer servlet using <object> html tag. prototype works fine. i don't want world have direct access servlet since fiddle url , inappropriately grab pdf. now, finally, questions. can jsp refer pdf servlet if servlet behind firewall? pdfs display in-line? users "save?" dialog box? can jsp refer pdf servlet if servlet behind firewall? the pdf request counts separate http request. servlet has no idea if behind firewall or been called jsp. safest approach check presence of user credentials in either http headers or in http s...

equations - Latex - \multicolumn within an align* environment -

i have \multicolumn effect within align* environment, shown in code snippet (which doesn't work) below. i.e., want text aligned leftmost column, shouldn't affect alignment characteristics of equation otherwise. \intertext{...} unfortunately flushes left margin, when equation centered. \begin{align*} 1 & 2 & 3 & 4 & 5 \\ \multicolumn{5}{l}{some text want appear here..} \\ %\intertext{some text want appear here} \\ 7 & 8 & 9 & 10 & 11 & 12 \end{align*} how make happen? many in advance! \begin{align*} 1 & 2 & 3 & 4 & 5 \\ \omit\rlap{some text want appear here...}\\ 7 & 8 & 9 & 10 & 11 & 12 \end{align*} generally, replacement \multicolumn within align-like environments, 1 try experiment \multispan , seems interfere badly alignment in case.

java - When to use ArrayList over array in recursion -

so have problem. trying code program print valid possible arrangements of brackets i.e. 3 brackets can have ((())), (()()), ()()(), (())() etc. i have working code public static void main(string[] args) { int number = 3; // no. of brackets int cn = number; int on = number; // open , closed brackets respectively char[] sol = new char[6]; printsol(on, cn, sol, 0); } public static void printsol(int cn, int on, char[] sol, int k) { if (on == 0 && cn == 0) { system.out.println(""); (int = 0; < 6; i++) { system.out.print(sol[i]); } } else { if (on > 0) { if (cn > 0) { sol[k] = '('; printsol(on - 1, cn, sol, k + 1); } } if (cn > on) { sol[k] = ')'; printsol(on, cn - 1, sol, k + 1); } } } now problem want using arraylist instead of using char array. t...

jquery - parameter Issue -

hello guys developing mvc application, want call action (with 2 parameter) when click on button , on event handler of button following : var url = '<%: url.action("someaction", "someconroller") %>' $(location).attr('href', url, new { param1 : value1 , param2: value2 }); but not working .. how can pass parameters in case ??? ??? you want pass in 2 parameters url.action method: var url = '<%: url.action("someaction", "someconroller", new { param1 = value1, param2 = value2 }) %>' sorry, realised parameter values may not accessible in method. add placeholders , replace them afterwards: var url = '<%: url.action("someaction", "someconroller", new { param1 = "val1", param2 = "val2" }) %>'; url = url.replace("val1", encodeuricomponent(value1)); url = url.replace("val2", encodeuricomponent(value2)...

database - Using Java, I upload an image to postgres DB size is 4000. But when I download it, the size is 8000 -

here latest code. wanted try different still getting same results. i using postgres db , created column called file data type bytea. image uploaded db (i can see in there when view table's data). i tried several images. size appears correct when upload doubles in size when download it. (which breaks image). any on why not working appreciated. public void uploadimage(file image, string imagename) throws sqlexception { try { conn = connectionmanager.connecttodb(); string sql = "insert images (name, file) "+ "values(?,?)"; system.out.println("your image name " + imagename); system.out.println("uploaded image name " + image); preparedstatement stmt = conn.preparestatement(sql); stmt.setstring(1,imagename); fis = new fileinputstream(image); stmt.setbinarystream(2, fis, (int) image.length()); system.out.println("image size = " +image.le...

vba - Save an Excel file as PDF to a specific path -

i save excel file .pdf file specific location , send file in mail. i'm using office 2000 :| this code far: application.activeprinter = "pdf995 on ne00:" activesheet.pagesetup.printarea = range("a68").value activewindow.selectedsheets.printout copies:=1, activeprinter:= _ "pdf995 on ne00:", collate:=true set wb = activeworkbook set oapp = createobject("outlook.application") set omail = oapp.createitem(0) omail .to = range("b61").value .subject = "approved" .body .display rows("81:134").select selection.entirerow.hidden = true end i can save file , mail it, can't save specific location. i need able specificy path "c:\path\file.pdf". if have file saved fixed location you're unable choose where, last resort use fso's movefile move specified location eg. if ...

Mapping C data structures and typedefs to .Net -

i'm trying write interface communicating network protocol, ieee document describes protocol @ bit level information split accross single byte. what best way go handling c typedef such as typedef struct { nibble transportspecific; enumeration4 messagetype; uinteger4 versionptp; uinteger16 messagelength; uinteger8 domainnumber; octet flagfield[2]; integer64 correctionfield; portidentity sourceportidentity; uinteger16 sequenceid; uinteger8 controlfield; integer8 logmessageinterval; } msgheader; when porting compatibility layer .net? fieldoffsetattribute may of you, although there no way represent values smaller byte. i use byte represent 2 values interop purposes, , access value via property getters. unsafe struct msgheader { public nibble transportspecific; //enumeration4 messagetype; //uinteger4 versionptp; // use byte place holder these 2 fields public byte union; public ushort messagelength; public...

java - glassfish file descriptor recommendations -

on glassfish v 3.0.1, use too many open file exception raising after while. file descriptor limit set 1024 glassfish user launch server. wonder if there recommended file descriptor limit avoid annoying exception. met me know. thanks imo, there no "universal" value, depends on things host(s), app, number of clients... in chapter 5 tuning operating system , platform , show how set 8192 on solaris seems reasonable first step. see thread: "too many open files" error in linux .

java - Calling notifyDataSetChanged() throws exception -

i have listview i'm binding adapter. adapter protected member of main class. have listener thread receives data , updates source list adapter. when call adapter's notifydatasetchanged() method, an exception thrown: runtime exception: phonelayoutinflater(layoutinflater).inflate(int, viewgroup, boolean) line: 322 i've read notifydatasetchanged() method has called on ui thread, , i'm doing that. in fact, sure, update listview's data source on ui thread. in listener thread update protected member houses data. here's example of i'm doing (note don't have part of code calls asynctask, it's fired listener): public class main extends activity() { protected linkedlist<hashmap<string, string>> adapterdatalist = new linkedlist<hashmap<string, string>>(); protected mydataobject dataobject; protected simpleadapter dataadapter; @override public void oncreate(bundle savedinstancestate) { //call parent oncre...

c# - Difference between DataView.Sort and DataTable.OrderBy().AsDataView()? -

i have datagridview bound datatable contains column of custom types need sort by. custom type ( mycustomtype ) implements icomparable<mycustomtype> how wanted sorting work. i tried 2 methods create dataview use grid's data source: mydatatable dt = new mydatatable(); dataview dv = new dataview(dt); dv.sort = "mycustomfield"; this did not work - "almost" worked, rows not sorted correctly. second method: mydatatable dt = new mydatatable(); dataview dv = dt.orderby(row => row.mycustomfield).asdataview(); this seems doing want. question is, what's difference between these 2 methods? possible dataview.sort not using icomparable<t> implementation, , linq-enabled dataview is ? why case? furthermore, know relative performance of non-linq-enabled , linq-enabled dataview s? seems if there isn't huge performance hit, there's no longer reason use non-linq-enabled version. when call .sort on dataview, sorts p...

casting - How to define cast operator in super class in C# 3.5? -

i have container class adding properties standard data types int, string , on. container class encapsulate object of such (standard type) object. other classes use sub classes of container class getting/setting added properties. want sub classes can implicitly cast between encapsulated objects , without having code in it. here simplified example of classes: // container class encapsulates strings , adds property tobechecked // , should define cast operators sub classes, too. internal class stringcontainer { protected string _str; public bool tobechecked { get; set; } public static implicit operator stringcontainer(string str) { return new stringcontainer { _str = str }; } public static implicit operator string(stringcontainer container) { return (container != null) ? container._str : null; } } // example of many sub classes. code should short possible. internal class subclass : stringcontainer { // want avoid f...

recursion - Getting NDepend to recurse through an input directory finding all assemblies/source across multiple projects -

i using nant build script call ndepend required command line arguments. <exec program="ndepend.console.exe" basedir="${ndependpath}"> <arg line="${ndependprojectfilepath} /indirs ${ndependindirs} /outdir ${ndependoutputdir}" /> </exec> but looking ndepend recurse through subdirectories of specified 'input directory' assemblies listed in ndepend project file. i used nant copy assemblies recursively specified folder , pointed ndepend input. method results in many missing metrics relating code itself. any ideas how without listing explicit path of of assemblies (it large project); can metrics across whole solution specifying top level directory? recursive through input directory find assemblies accross multiple project feature available from: ndepend start page >>> analyze .net assemblies in folders >>> direct/recursive child folders thanks ndepend.api can programatically search assemblies ...

amazon ec2 - Recommendation for an EC2 Instance Stack -

our development servers on amazons ec2. we ideally following: php 5.3.x oracle drivers mhash mcrypt apache does have recommendation on place stack meet of needs minimum of additional configuration? for updated base ami's can check ubuntu canonical ami's found @ eric's site: www.alestic.com. the amazon ami release if prefer centos distro. http://bit.ly/a5fcz3 for security reasons, suggest build own lamp stack. of course there many existing lamp ami's can find.

regex - Problem with newline in JavaScript regexp -

i tried not show "spam" in string below using regex: alert("{spam\nspam} _1_ {spam} _2_".replace(/{[\s\s]+}/gm, "")); what supposed see "~1~ ~2~" (or that) got ~2~. why? } , { elements of character class [\s\s] . should avoid matching by: /{[^}]+}/g so regex stops once } found.

c# - ArrayList object to array of Point objects -

i have custom class curvepoint define set of data items draw on screen using drawcurve i written cast routine convert curvepoint point, getting error at least 1 element in source array not cast down destination array type. when try use .toarray method in arraylist i can cast objects fine using code: point f = new curvepoint(.5f, .5f, new rectangle(0, 0, 10, 10)); but if fails when using point[] plots=(point[])_data.toarray(typeof(point)); (where _data arraylist populated 5 curvepoint objects) here full code: public partial class chart : usercontrol { arraylist _data; public chart() { initializecomponent(); _data = new arraylist(); _data.add(new curvepoint(0f, 0f,this.clientrectangle)); _data.add(new curvepoint(1f, 1f, this.clientrectangle)); _data.add(new curvepoint(.25f, .75f, this.clientrectangle)); _data.add(new curvepoint(.75f, .25f, this.clientrectangle)); _data.add(n...

WCF NetDispatcherFaultExcption when passing byte array from Service to Client -

i trying pass file (byte array) service client. receive "the formatter threw exception while trying deserialize expecting state 'element'.. encountered 'text' name '', namespace ''" error. ideas on how fix appreciated. thanks, raja after breaking head 4 freaking hours found answer problem. wssf(web service software factory) culprit. while generating data contract had generated list file instead of byte[]. changed list byte[] in proxy , works now. hope helps someone. thanks, raja

c# - How and when to deal with database that is down? -

my problem have deal somehow cases when database down in mvc application. so, should try{} catch{} open connection in every controller? or best practice? note: sample database access isolated in few "manager" classes work repository kind of way. why opening connection in every controller. should isolated within it's own reusable class. you may want check out repository pattern implement data access.

maven 2 - How to attach an artifact with assembly-plugin during custom lifecycle -

i'm trying create plugin custom lifecycle : /** * @goal my-goal * @execute lifecycle="my-custom-lifecycle" phase="attach-foo" */ public class mymojo extends abstractmojo { ... with src/main/resources/meta-inf/maven/lifecycle.xml file : <lifecycles> <lifecycle> <id>attach-foo</id> <phases> <phase> <id>package</id> <executions> <execution> <goals> <goal> org.apache.maven.plugins:maven-assembly-plugin:single </goal> </goals> <configuration> <descriptorrefs> <descriptor>adescriptor.xml</descriptor> </descriptorrefs> </configuration> </execution> </executions> </phase> </phases> </lifecycle> </life...

How Can I Adjust Android SeekBar Sensitivity -

i attempted use seekbar first time, , disappointed results. have app needs use slider cover 80 spots. want user able move in .5 increments (i.e. 10.5, 11.0). max range 40, why doubled 80 account decimals. everything worked, when put on droid, performance terrible in opinion. when trying stop on 21.5, slider stopped @ 22.0 or 22.5, , had take time try , inch over. other times try select slider , unresponsive. i'm not concerned unresponsiveness, can not put seekbar in app if requires user have exact precision hit spot. is there can adjust seekbar easy hit number trying land on without difficulty? i'm not sure if problem occurring because seekbar contains large amount of possible values, , screen size limited forces numbers smashed closer together? or if way behaves in general. if there isn't way adjust sensitivity, there alternative can use provides similar functionality? i'm not sure if problem occurring because seekbar contains large amount of ...

coldfusion - How do I pass an onclick argument to a CFC to update the database through AJAX? -

new ajax. trying simple ajax/cfc vote yes/no app. can’t work what trying accomplish simple vote "yes or no" app shows number of votes cast next each link. example: yes (882 votes) no (163 votes) . when visitor votes, database should updated vote , record voter in different table (so can't vote again). finally, confirmation message displayed new vote count: you voted "yes" (883 votes) or you voted no (164 votes) now had working updating database. tried reworking javascript (ajax) call cfc adding ($.ajax) , moving response messages within ajax part. however, it’s not working @ all. did wrong? below new code came with. keep question simple, showing "no" vote portion. on right track? seem simple. voting link <a href="javascript:()" onclick="votenoid('#ideaid#');"> <span id="votenomessage">no</span> </a> - <span id="newnocount">#nocount#...

C++: access to container of shared_ptr should return raw or shared ptr? -

if use container of shared_ptrs , explicitely allow access elements, should return shared_ptrs or raw pointers if intend container 1 responsible "cleaning up"? class container { private: std:vector<shared_ptr<foo> > foo_ptrs; public: shared_ptr<foo> operator[](std::size_t index) const {}; // or foo* operator[](std::size_t index) const {}; }; is there reason return shared_ptrs in such situation, or raw pointers ok? greets! return reference only return shared_ptr if intend accessors share in lifetime management. valid design said container solely responsible cleanup. shared_ptr implementation detail of containter , fact there vector of shared_ptr s used implement container shouldn't exposed through interface. don't return pointer unless make sense null container . not. user wants access i-th element of container , reference perfectly. what want std::vector<std::unique_ptr<foo>> . container 1...

linq - wpf overriding getHashCode and Eqaul in ContentControl -

hi have class derives contentcontrol , i'm not able override gethashcode , equal method. error error 5 cannot override inherited member 'system.windows.dependencyobject.gethashcode()' because sealed there way override method ? need use union method linq need compare object different condition normal. there way ? yes - implement iequalitycomparer<t> separately, , pass relevant overload of union . basically you'll telling how compare 2 items equality, , how take hash code of 1 item. union use custom comparison when building hash sets etc. don't need override existing methods.

java - Problems with Making a Highscore and Loops and Overall Issues -

hey guys , thanx previus help..... time it's homework meaning want me make highscore shows playername,score (tries took) , time. wants: write game in user guess random number between 1 , 1000. program should read number keyboard, , print whether guess high, low or correct. when user has guessed correctly, program prints out numbe of guesses made , time , playername.when game started program must print entire high score list, sorted number of guesses in ascending order. note: list must maintained long game-object alive! example without time; guess high! > 813 guess high! > 811 **** correct! **** guessed correct number in 11 guesses please enter name: > niklas want play again?(y/n) >y current highscore list: name guesses niklas 11 my questions are; code provided below enough mainten these requirements, if not should add because don't know do? , please consider i'm still in learning phase take easy comments :) here code: package testa; import java.uti...

mysql - How to change this SQL so that I can get one post from each author? -

in sql below have last 5 posts. these posts same author. want select last 5 1 per author. select `e` . * , `f`.`title` `feedtitle` , `f`.`url` `feedurl` , `a`.`id` `authorid` , `a`.`name` `authorname` , `a`.`about` `authorabout` `feed_entries` `e` inner join `feeds` `f` on e.feed_id = f.id inner join `entries_categories` `ec` on ec.entry_id = e.id inner join `categories` `c` on ec.category_id = c.id inner join `authors` `a` on e.author_id = a.id group `e`.`id` order `e`.`date` desc limit 5 edited i've ended it: select a.id, e.date, e.title, a.name feed_entries e, authors e.author_id =a.id order e.date desc limit 5 in query, how can 1 post each author? what about select a.id, a.name, e.date, e.titulo feed_entries e inner join authors on e.author_id = a.id -- recent feed_entry , e.date = (select max(e1.date) feed_entries e1 e1.author_id = a.id) order e.date desc i haven't tested work.

forms - Module for Saving Drupal node page without "closing" -

is there drupal module out there allows users save changes node creation form while still keeping form in edit mode? if preview, node isn't saved, if save editing form closed. save & edit the module adds button titled "save & edit" on node types selected in admin section. using button when saving node redirect edit form rather returning node page, or /admin/content/node page.

session - How do I get the Spring Security SessionRegistry? -

i can't seem find how reference spring security (v3) sessionregistry inside of struts action. i've configured listener inside of web.xml file: <listener> <listener-class>org.springframework.security.web.session.httpsessioneventpublisher</listener-class> </listener> and i've tried use @autowired annotation bring action: @autowired private sessionregistry sessionregistry; @override public string execute() throws exception { numberofusersloggedin= sessionregistry.getallprincipals().size(); return success; } public sessionregistry getsessionregistry() { return sessionregistry; } public void setsessionregistry(sessionregistry sessionregistry) { this.sessionregistry = sessionregistry; } the http configuration looks this: <session-management invalid-session-url="/public/login.do?login_error=expired" session-authentication-error-url="/public/login.do" session-fixation-pr...

What is the simplest way to asynchronously communicate between C++ and C# applications -

i have c++ application needs communicate c# application (a windows service) running on same machine. want c++ application able write many messages wants, without knowing or caring when/if c# app reading them, or if it's running. c# app able should wake every , , request latest messages, if c++ app has been shut down. what simplest way achieve this? think kind of thing msmq for, haven't found way in c++. i'm using named pipes right now, that's not working out way i'm doing requires connection between 2 apps, , c++ call writeline blocks until read takes place. currently best solution can think of writing messages file timestamp on each message c# application checks periodically against last update timestamp. seems little crude, though. what simplest way achieve sort of messaging? well, simplest way is using file store messages. suggest using embedded database sqlite, though: advantage better performance , nice way query changes (i.e. select * messa...

Communicating between C# and Visual C++ over IPC port (OR: Sharing a type between a Visual C++ DLL and a C# application) -

i have dll written in visual c++ , application written in c#. application written in c# uses ipc between multiple instances of ever runs 1 instance (it attempts start ipc server, , if can't assumes there's 1 running, in case sends command line arguments on ipc existing application). now want send commands visual c++, however, when create type definition in visual c++ matches 1 in c# (on implementation level), rejects connection because fundamentally still 2 different types (from 2 different assemblies). i thought using reflection in visual c++ fetch type c# assembly, can't because i'd have ship assembly along side dll (which defeats purpose of dll being api application). i'm not sure of other way it, other store class in yet dll , make both application , api dll reference class in that, not ideal solution i'd single api dll distribute. are there suggestions how can connect on ipc (other forms of communication tcp not permitted) send requests applica...

datetime - JavaScript date parsing producing wrong date -

i have script: var a="thu oct 07 16:50:0 cest 2010"; var b=a.split("cest"); var d = new date(b[0]); alert(d);​​​​​​​​​​​ but doesn't work how want. in fact date result differs original in string. the input thu oct 07 16:50:0 cest 2010 result different sat oct 07 2000 16:50:00 gmt+0200 (cest). wrong? you're losing information year. split splits string array @ 'cest' of parse first element (the part of string left of 'cest'). either need add right part of string again or use better suited method replace : var a="thu oct 07 16:50:0 cest 2010"; var b=a.split("cest"); var d = new date(b[0]+b[1]); alert(d);​​​​​​​​​​​ var a="thu oct 07 16:50:0 cest 2010"; var b= a.replace('cest',''); var d = new date(b); alert(d);​​​​​​​​​​​

javascript - Cross-browser JS inconsistencies -

i have php script allows image upload. modified load newly uploaded image modal window in order allow manual crop, if needed. it seems got working in firefox (all way until actual crop). ie throws error: "object not support property or method" , opera chokes , not know show... i out of ideas causing this. here's page, click "add new scene" , submit image upload view described behavior: any insight highly appreciated. update: decided go different class. javascript libraries not loaded. check view source jquery file included. check jquery version also. ok now var addthis_config = { ui_cobrand: "slatecast.com", ui_header_color: "#ffffff", ui_header_background: "#cc0000", services_compact: "aolmail, hotmail, live, typepad, ymail, google, squidoo, stumbleupon, delicious, reddit, googlebuzz, digg, linkedin, favorites, more", services_exclude: "print", data_track_c...

c# - Silverlight: How to consume a REST API? -

i'm building silverlight app want hosted in azure , use azure table storage. i have class represents main data entity, expenseinfo . has many data annotations ria validation, such [required] . i following tutorial set rest service access sl. wants there class in web role data serialization. class contain same data expenseinfo . so, want expenseinfo be? want separate classes in each project? put in 1 project, , instantiate in both? weird have class data annotations in server side web role? thanks, i'm new sl , azure. the pattern you're looking here data transfer object (dto) pattern . here's good article on pros , cons of pattern. personally, don't mind additional classes dto and/or , adapter pattern brings (you see adapter type patterns used on place, mvvm hot 1 right now). have strong dislike sharing business logic in assemblies across trust boundary, use dto/adapter in architectures.

Azure: Can't find TableStorageDataServiceEntity class -

i've been working way through tutorial . got stuck when asked me make class inherits tablestoragedataservicecontext . can't seem find .dll or namespace or whatever. dataservicecontext works fine. tutorial bit old. has class been moved or no longer exists or something? the tutorial you're following when azure in ctp, of class names changed when came out of ctp (they've been stable since then). class think meant refer tableservicecontext . it in microsoft.windowsazure.storageclient.dll installed in c:\program files\windows azure sdk\v1.2\ref if didn't change of settings while installing sdk . it might worth finding more date tutorial though, i'm not sure other minor differences there might be.

TypeError: 'NoneType' object is not iterable in Python -

what error typeerror: 'nonetype' object not iterable mean? i getting on python code: def write_file(data,filename): #creates file , writes list open(filename,'wb') outfile: writer=csv.writer(outfile) row in data: ##above error thrown here writer.writerow(row) it means "data" none.

visual c++ - Using CMPH in VC++ -

i use minimal perfect hash cmph . idea how can use on vc++ project? i created new project using vc++ 2008 express edition here , add header , source files output compilation errors. 1>------ build started: project: cmph, configuration: release win32 ------ 1>compiling... 1>wingetopt.c 1>vstack.c 1>vqueue.c 1>select.c 1>.\select.c(24) : error c2054: expected '(' follow 'inline' – looks project delivered source-only, have download source code , build platform's compiler. when done, have cmph.h , associated library. you have edit visual studio project , add header file project or put location include path, , edit project put location .lib is.

java - Google Reader API Authentication -

i trying authenticate on google api service using snippet: resttemplate resttemplate = new resttemplate(); list<httpmessageconverter<?>> converters = new arraylist<httpmessageconverter<?>> resttemplate.getmessageconverters()); converters.add(new propertieshttpmessageconverter()); resttemplate.setmessageconverters(converters); properties result = preparepostto(authentication_url) .using(resttemplate) .expecting(properties.class) .withparam("accounttype", "hosted_or_google") .withparam("email", email) .withparam("passwd", password) .withparam("service", "reader") .withparam("source", "google-like-filter") .execute(); string token = (string) result.get("auth"); now have token like: dqaaai...kz6ol8kb56_afnfc (more 100 chars length) , try ur...

oracle - Can we store anything other than a valid date or null value in a date field? -

i'm working on oracle , perl. have 3 fields in table (a, b, c), , form, every row in table, string a_b_c using "join". c refers date. can take null values. in case , "join" return warning "use of uninitialized values in join". know have select nvl(c,something) a_b_something when c null. can suggest me "something" can be, if want distinguish between these rows , other rows. in short, can store other valid date or null value in date field? i know have select nvl(c,something) a_b_something when c null selecting isn't storing value in column, , oracle passes datetimes clients strings, it's entirely possible can use nvl(col, '') without confusing dbi @ all. if doesn't work out, can build whole thing in sql: select a || '_' || b || '_' || (case when c null '' else to_char(c) end) as 1 of columns.

Perform a full text search for partial matches where shortest match has the highest relevance in MySQL? -

i'd perform fulltext search against column, looking partial word match (ie: against('fra*' in boolean mode) ). receive results assign higher relevancy shorter words match. so, example, if perform search 'fra' , results 'frank', 'fran' , 'frankfurter', them ordered in terms of relevancy this: 'fran', 'frank', 'frankfurter'. is there someway can achieved? select token tokentable token '%fra' order char_length(token) asc to fullfill example, fast due btree indexing. can do: select document documents document '%frankfurter%' , document '%würstel%' order char_length(document) asc but nonsense of relevancy calculation. simple answer: if autosuggestion based on prefix, method above fine. theres no need use match against. if want search fulltext search cant such criteria, should @ lucene/ solr

asp.net - Required Field Validators firing in Chrome & Safari when button has CausesValidation="false" -

i'm having problems asp.net 4 application in chrome & safari (works in firefox , ie). i have button declared using following code: <asp:button id="btneoi1" runat="server" cssclass="buttoncss" text="lodge expression of interest" onclick="btneoi_click" causesvalidation="false" /> in code-behind file have following code: protected void btneoi_click(object sender, eventargs e) { response.redirect("default.aspx", true); } also on page logincontrol has 2 requiredfieldvalidators , regularexpressionvalidator: <asp:requiredfieldvalidator id="usernamerequired" runat="server" controltovalidate="username" errormessage="please enter user name." setfocusonerror="true" display="none"> </asp:requiredfieldvalidator> <asp:regularexpressionvalidator runat="server" id="regularexpression...

c++ - How do I know when one is done entering cin with \n? (loop) -

from australian voting problem: a bot keep putting information , can reach 1000 lines. example of he'll enter: "1 2 3 2 1 3 2 3 1 1 2 3 3 1 2 " how know when has finished entering information? there \n @ end , that's guess on go. cin doesn't seem detect \n, getchar() apparently does. \n after first line of course, , getting work has become rather difficult. how accomplish this? std::string line; while( std::getline(std::cin,line) && !line.empty() ) { std::istringstream iss(line); int i1, i2, i3; iss >> i1 >> i2 >> i3 if( !is ) throw "dammit!" process_numbers(i1,i2,i3); } if( !std::cin.good() && !std::cin.eof() ) throw "dammit!";

c# - All built-in .Net attributes -

i have used appdomain.currentdomain.getassemblies() list assemblies, how list built-in attributes in .net 2.0 using c#? note appdomain.getassemblies() list loaded assemblies... it's easy: var attributes = assembly in assemblies type in assembly.gettypes() typeof(attribute).isassignablefrom(type) select type; .net 2.0 (non-linq) version: list<type> attributes = new list<type>(); foreach (assembly assembly in appdomain.currentdomain.getassemblies()) { foreach (type type in assembly.gettypes()) { if (typeof(attribute).isassignablefrom(type)) { attributes.add(type); } } }

iterator - Converting types in Java -

java noob here, i have iterator<typea> want convert iterator<typeb> . typea , typeb cannot directly cast each other can write rule how cast them. how can accomplish this? should extend , override iterator<typea> 's next, hasnext , remove methods? thanks. you don't need write yourself. guava (formerly google-collections) has covered in iterators.transform(...) you provide iterator , function converts typea typeb , you're done. iterator<typea> itera = ....; iterator<typeb> iterb = iterators.transform(itera, new function<typea, typeb>() { @override public typeb apply(typea input) { typeb output = ...;// rules create typeb typea return output; } });

.net - How to prevent duplicate code generation when placing winforms event handlers in other partial files -

in winforms application have myform.cs starts quite large. solve have created new file(myform.leftpanel.cs) using partial class of myform class subset of gui functionality. however once in while, not always, when go designer event handlers have moved myform.leftpanel.cs gets regenerated in myform.cs empty functions. causes compiler error until manually remove them in myform.cs. how can prevent these functions being regenerated? i saw question placing these kind of files under main.cs in project , solution tell visual-studio find existing functions? using method in winform partial classes placed myform.leftpanel.cs below myform.cs. so far seem have solved problem.