Posts

Showing posts from August, 2015

c++ - Difference Between GUI debugger and terminal debuggers -

what advantages gui debugger in eclipse , advantages using command line debugger such gdb? industry use command line debuggers? , if so, situations people use command line debuggers? i use gdb, advantages can think of off top of head: being command line, debugging binaries on remote systems easy opening ssh connection. great scripting support, , ability run many commands per breakpoint (see continue keyword) much shorter start-up time , faster development cycle. copy&pastable commands , definable functions let repeat common commands easier gdb speaks well-defined protocol, can debug code running on lots of obscure hardware , kernels. typing short commands shorter , more efficient in long run working around gui (in opinion). however, if you're next system or runtime you've never used before, using visual debugger can easier started get-go. also, having debugger tightly integrated ide (if use one) can big boost in productivity. visual debugger , com...

javascript - open layers LineString not working -

sorry bother guys, i'm stuck problem half day. i want draw poly line in openlayers using linestring object, i've copied example documentation. runs ok can't see line on screen code looks this <!doctype html public "-//w3c//dtd html 4.0 transitional//en"> <html> <head> <title></title> <script type="text/javascript" src="http://openlayers.org/api/openlayers.js"></script> <script src="http://www.openstreetmap.org/openlayers/openstreetmap.js"></script> <script src='http://maps.google.com/maps?file=api&amp;v=2&amp;key=abqiaaaajpkac9epgem0liq5xcmiuhr_wwlpfku8ix9i2sxyrvk3e45q1bqud_bef8dtzket_eteajpdgdwqpq'></script> <script type="text/javascript"> var map; var linelayer ; var points; var style; var polygonfeature function test() { linelayer = new openlayers.layer.vector("line layer...

Quick way to parse an xml string (field/value pair) into Dictionary object in C# -

i have string containing field/value pairs in xml format , want parse dictionary object. string param = "<fieldvaluepairs> <fieldvaluepair><field>name</field><value>books</value></fieldvaluepair> <fieldvaluepair><field>value</field><value>101 ways love</value></fieldvaluepair> <fieldvaluepair><field>type</field><value>system.string</value></fieldvaluepair> </fieldvaluepairs>"; is there quick , simple way read , store field/value pairs in dictionary object? no linq please. also, there possibility value field can contain xml string itself . solutions provided wonderful fails if value xml iteself. example: if value like <?xml version="1.0" encoding="utf-8"?><getcashflow xmlns="myservices"><inputparam><ac_unq_id>123123110</ac_unq_id></inputparam></getcashflow> it errors out mes...

php - ColdFusion get method -

Image
i sending value of variable http url cfm page, not sure how value on other page. in php use $_get['variable'] ; not sure equivalent of in coldfusion. coldfusion has option of accessing these variables you're doing in php: php: $foo = $_get['variablename']; $bar = $_post['variablename']; cfscript: foo = url['variablename']; bar = form['variablename']; cfml: <cfset foo = url['variablename']> <cfset bar = form['variablename']> edit: discussion of form scope case insensitivity, , workaround coldfusion (helpfully?) convert form fieldnames uppercase in form scope. in cases fieldname repeated, multiple values merged single comma-separated value. when don't have control on form itself, can lead frustration. given form: <form name="main" action="handler.cfm" method="post"> <input type="text" name="confusion" value="abc...

entity framework - C#/EF and the Repository Pattern: Where to put the ObjectContext in a solution with multiple repositories? -

i have multiple repositories in application. should put objectcontext? right now, have reference objectcontext ctx; in every repository. smartest , safest way go this? a design multiple objectcontext instances acceptable if repository methods commit transaction. otherwise, possible external calls commit transaction may not persist intend, because hold references different instances of objectcontext . if want restrict objectcontext single instance, can build repositoryprovider class contains objectcontext , , manages propagation of repository actions data commits. can best accomplished either, - injecting objectcontext reference each repository, or - subscribing repositories' events eventhandler s call appropriate methods on objectcontext . the following highly pluggable implementation have used: repository provider interface public interface irepositoryprovider { irepository this[type repositorytype] { get; } } repository factory interface t...

jQuery & PHP: Upload an image and refresh gallery page with new thumbnail -

i have page contains thumbnails photo gallery. on page link upload more images. when click link modal opens contains upload form (jquery colorbox in iframe) allow upload 1 image (plus name, caption, etc) @ time using php. when form submitted image uploads , page refreshes in modal allow more uploads. since modal sitting on top of existing thumbnails i'd user see new thumbnail added page after it's uploaded. possible? how this? i'm assuming modal in iframe . if that's case, when upload submitted, , modal form reloads allow upload, send uploaded file info (thumbnail url) parent frame. example: parent.uploadcallback('http://my.domain.com/newly-uploaded-thumbnail.jpg'); then have uploadcallback function in main frame creates img object , appends list of thumbnails.

How to use Java's DecimalFormat for "smart" currency formatting? -

i'd use java's decimalformat format doubles so: #1 - 100 -> $100 #2 - 100.5 -> $100.50 #3 - 100.41 -> $100.41 the best can come far is: new decimalformat("'$'0.##"); but doesn't work case #2, , instead outputs "$100.5" edit: a lot of these answers considering cases #2 , #3 , not realizing solution cause #1 format 100 "$100.00" instead of "$100". does have use decimalformat ? if not, looks following should work: string currencystring = numberformat.getcurrencyinstance().format(currencynumber); //handle weird exception of formatting whole dollar amounts no decimal currencystring = currencystring.replaceall("\\.00", "");

python - "y" or "yes" -- expectations not met -

in following code, answer() works expected , returns true if input "y" , false when not, in answer2() , returns true. can explain why case? def answer(): answer = raw_input() if answer == "y": return true else: return false def answer2(): answer = raw_input() if answer == "y" or "yes": # <- notice extra: or "yes" return true else: return false if answer() == true: print "true" else: print "false" if answer2() == true: print "true" else: print "false" the expression, "y" or "yes" evaluate "y" . want is: if answer in ('y', 'yes'): return true

Java Socket RPC protocol -

i've been asking questions adapting command protocol use in client server environment. however, after experimentation, have come conclusion not work me. not designed scenario. i'm @ loose end. i have implemented sort of rpc mechanism before whereby had class entitled "operation". had enum entitled "action" contained names actions invoked on server. now, in old project, every time client wanted invoke action on server, create instance of 'operation' , set action variable value "action" enum. example operation serveroptoinvoke = new operation(); serveroptoinvoke.setaction(action.create_time_table); serveroptoinvoke.setparameters(map params); serverreply reply = networkmanager.sendoperation(serveroptoinvoke); ... on server side, had perform horrible task of determining method invoke examining 'action' enum value load of 'if/else' statements. when match found, call appropriate method. the problem was messy, ha...

mysql - Sql join 3 tables -

i have struggle produce sql. relationship part of application. have 3 tables : users('id'), relationship('user_id', 'member_id'), relationship_block('user_id', 'blocked_member_id') i members belonging user user_id not blocked. records of first table 'users' in 'relationships' table not in 'relationship_blocked' table. first 2 can join, want remove blocked. thanx. edit: found info here: http://explainextended.com/2010/05/27/left-join-is-null-vs-not-in-vs-not-exists-nullable-columns/ select * users u inner join relationship r on u.user_id = r.user_id left join relationship_block rb on r.user_id = rb.user_id , r.member_id = rb.blocked_member_id rb.user_id null

parsing - How to Parse Boolean Search Queries -

i need parse search query boolean parameters. example, if have query (mexico or peru) , ((air , wind) or (big , little)) i want create several sub-queries based on operators. so, query give me following sub queries mexico , air, wind mexico , big , little peru, air , wind peru, big , little does have idea algorithm use or maybe library me that? thank you!

c# - problem with hexadecimal values in xml document -

i have simple c# function takes 1 string encode , return it: public static string encodestring(string input) { byte[] bchipertext = null; rijndaelmanaged rp = new rijndaelmanaged(); rp.key = utf8encoding.utf8.getbytes("!lb!&*w_4xc54_0w"); rp.iv = utf8encoding.utf8.getbytes("6&^fi6s5saks_ax6"); icryptotransform re = rp.createencryptor(); byte[] bcleartext = utf8encoding.utf8.getbytes(input); memorystream mstm = new memorystream(); cryptostream cstm = new cryptostream(mstm, re, cryptostreammode.write); cstm.write(bcleartext, 0, bcleartext.length); cstm.flushfinalblock(); bchipertext = mstm.toarray(); cstm.close(); mstm.close(); return system.text.asciiencoding.ascii.getstring(bchipertext); } after call function parameter "hello" xml file this: <?xml version="1.0" encoding="utf-8"?>...

javascript - Adding console.log to every function automatically -

is there way make function output console.log statement when it's called registering global hook somewhere (that is, without modifying actual function itself) or via other means? here's way augment functions in global namespace function of choice: function augment(withfn) { var name, fn; (name in window) { fn = window[name]; if (typeof fn === 'function') { window[name] = (function(name, fn) { var args = arguments; return function() { withfn.apply(this, args); return fn.apply(this, arguments); } })(name, fn); } } } augment(function(name, fn) { console.log("calling " + name); }); one down side no functions created after calling augment have additional behavior.

python - pycurl - 302 redirect/page moved -

trying page/headers (response/request) using pycurl. can using java/htmlunit. i'm missing subtle new/redirected page. i was/am trying "new" redirected url, fed pycurl new page. thanks the sample test code is: #setup base url curl initurl="http://louisville.bncollege.com/" #sets pycurl object crl = pycurl.curl() qq=stringio.stringio() header=stringio.stringio() # # init curl parse # test1=0 test=0 while test==0: print "aaaaattttt \n" try: crl.setopt(pycurl.url, initurl) crl.setopt(pycurl.header, 1) #appears allow/disallow display of header data #crl.setopt(pycurl.header, 0) crl.setopt(pycurl.useragent, user_agent) crl.setopt(pycurl.followlocation, 0) crl.setopt(pycurl.cookiefile, cookiefile) crl.setopt(pycurl.cookiejar, cookiejar) crl.setopt(pycurl.writefunction, qq.write) crl.setopt(pycurl.headerfunction, header.write) crl...

java - Creating an ArrayList and adding items -

im learning java , having problem arraylist. firstly have class called item, create various item objects. have class catalogue array list , should hold list of item objects create. @ moment can manually add items catalogue invoking additem method on catalogue object , manually entering name of item object want add (item1 item2 item3 etc) wanted know if there way add items arraylist automatically each time create item object? i should mention, list needs hold infinite amount of items, have not specified size in code. appreciated :) thanks import java.util.arraylist; public class catalogue { private arraylist<item> catalogue; public catalogue () { catalogue = new arraylist<item>(); } public void addanitem(item item) { catalogue.add(item); } } one way this, if passed catalogue constructor of item class, , once item set up, add item catalogue @ point. it may this public item(catalogue catalogue) { // set item...

jquery - add class to a div when hover another one (Javascript) -

i have limited understanding of javascriptan trying add class div when hover div right can add class same div able add let's class blue div called first when hover #second , #third. current code : $(document).ready(function() { $("#second, #third").hover(function(){ $(this).addclass("hover"); $(this).removeclass("hoverable"); }, function(){ $(this).removeclass("hover"); $(this).addclass("hoverable"); } ); }); my live website can seen @ : www.designinterieurm2.com/dev $(document).ready(function() { $('#second, #third').hover(function(){ $('#first').addclass('blue'); }, function(){ $('#first').removeclass('blue'); }); });

java - How to use multiple upper bounds in generics -

i have interface foo has generic type - public interface foo<t> { boolean apply(t t); } having class bar implements interface want generic type of bar should collection of type interface , b, below definition giving compiler error - public class bar implements foo<collection<? extends & b>>{ @override public boolean apply(collection<? extends & b> collect){ ... } } can suggest correct way achieve this? i can use multiple bounds @ method level only? wouldn't work? public class bar<t extends & b> implements foo<collection<t>>{ @override public boolean apply(collection<t> collect){ ... } }

.net - Embed a WPF UI object into a Word/OpenOffice document? -

i'm working on project needs embed custom objects documents (either microsoft word or openoffice writer). objects microsoft equation or openoffice formula objects, except render , allow editing of content specific our business. ultimately, documents exported pdf. since else in project based on wpf , our development environments , build processes based on .net, nice able create these objects using exclusively or exclusively wpf/.net. the obvious choice embedding objects documents ole, far can tell, wpf has little support ole. what options have? what's best (reliable, performant, , simple) this? (or if knows sure there isn't way other going ole language c++ or vb6, know too) you can inside wpf richtextbox , insert inlineuicontainer (or blockuicontainer ) can put uielement button or more complicated. you can convert richtextbox content, orginally flowdocument , rtf or xaml or html, or office openxml format (.docx) openxml sdk. maybe it's possibl...

wpf - When to call the IDataErrorInfo's AddError method -

i have viewmodel class implements idataerrorinfo interface . in each property's set validate value passed in , if fails validation call method called adderror add error property. adderror method adds item underlying data type i'm using manage errors (a dictionary(of string, list(of string))). currently things working during data entry. if user enters invalid values property, frameworkelement used input data highlighted tooltip set error message. now, here's problem. say object contains invalid fields start.... example, if have person class required field "name" , create new instance of person class. name field not highlighted "error" because name property's set method hasn't been called yet. so, put validation property's get well. this seems works but......it feels hack. , property validation has done model (as opposed viewmodel i'm working with). model bubbles appropriate error message should set can't error mes...

mysql - PHP - Solution - File Password Protect -

so, have client requesting solution password protect files. wants have solution similar opendocman. showed me client password protects file no user name. can upload files, put password on file, send links directly file , when users click on link prompted password , clients puts in , file released. know of solution can exact requirement? you can setup basic validation page when user visits page enter document id (or it's encoded in link) , put simple form password field , submit button. if password matches stored in database document id. send file user. keep uploaded files outside /web directory don't have worry people hacking system guessing filenames. the files won't have passwords on them, way outside file have password.

asp.net - Loading AjaxControlToolkit Scripts from Microsoft's CDN using ScriptManager/ToolkitManager -

i know there question asking same thing, hasn't gotten attention months now: https://stackoverflow.com/questions/3786088/how-to-force-ajax-control-toolkit-scripts-loading-from-cdn i've upgraded website .net4, , i'm using scriptmanager's enablecdn="true" tag. ajax scripts being referenced microsoft cdn how expected, can't seem ajaxcontroltoolkit scripts load cdn. instead load locally through scriptresource.axd. i know cdn files located, , know reference files every time use control, i've got lot of legacy code loads on own scriptmanager, pulling scriptresource.axd files. any suggestions how control toolkit scripts load cdn? have standard webforms.js, etc. let me know if there can clear up, here script manager i'm using: (i have tried toolkitscriptmanager) <asp:scriptmanager id="scriptmanager1" runat="server" enablepagemethods="true" enablecdn="true" enablescriptlocalization="false"...

terminology - Model driven development vs model driven architecture vs model driven engineering -

could explain what's key difference among concepts (mdd vs mda vs mde)? this website explains quite nice diagram boot: http://modeling-languages.com/blog/content/relationship-between-mdamdd-and-mde the difference between mdd , mde admittedly vague , have heard of other people use terms interchangeably.

animation - Animate image along path on Android? -

possible duplicate: android, move bitmap along path? is there way animate imageview's position along path on android cgpath on iphone? have scoured web solution this, no 1 has seemed ask it. didn't see in android docs describing functionality. i created subclass of animation named pathanimation, can animate along path. you can create new pathanimation path, , use other animations. https://github.com/coocood/pathanimation

asp.net - Best way to have an ASP/.NET ajax driven page updated using flex/flash? -

i have mapping application written in flex/flash app. app used bounding coordinates visible data on map. want put in asp page using ajax update search results. search results defined bounding coordinates. these bounding coordinates search query. best way update search current coordinates flex app? not sure of best way have flex interact web page. how tell ajax driven asp .net page update results based on data flex app? use as3 externalinterface class communicate javascript. in as3 : private function senddata(boundingcoordinates:object):void { if(externalinterface.available) { externalinterface.call("senddatatoasp", boundingcoordinates); } } in javascript : function senddatatoasp(boundingcoordinates) { // doajaxstuffwithboundingcoordinates(); }

performance - How to compare two elements in a list in constant time -

suppose have list of elements [5, 3, 1, 2, 4] , , want compare 2 elements position. whichever comes first in list greater, or true . so: compare(5, 3) # true compare(2, 1) # false compare(3, 4) # true how can in constant time? 1 way thought of doing using maps, key element , value position in list: order = {5: 0, 3: 1, 1: 2, 2: 3, 4: 4} then have amortized o(1) time, o(n) space. have more elegant solution? your map idea looks pretty good. fact map o(n) memory shouldn't problem, because can't less o(n) unless use compression techniques (a list o(n) well). also, since map stores indices of each element, forget original list, , use map. is, unless need list reason. if need insert element middle (say @ position 3), can update map in linear time iterating on element , incrementing necessary indices. so, map looks efficient solution list basic operations, added awesomeness of o(1) compare function. elegance, map pretty hard beat since doens't require work...

javascript - Controlling the display of selected item using jQueryUI Autocomplete widget -

i'm using jqueryui autocomplete widget data json web service. similar example below: <script> $(function() { $( "#city" ).autocomplete({ source: function( request, response ) { $.ajax({ url: "http://ws.geonames.org/searchjson", datatype: "jsonp", data: { featureclass: "p", style: "full", maxrows: 12, name_startswith: request.term }, success: function( data ) { response( $.map( data.geonames, function( item ) { return { label: item.name + (item.adminname1 ? ", " + item.adminname1 : "") + ", " + item.countryname, value: item.id } })); } }); ...

java - WindowLeaked exception right when thread finishes and calls dialog.dissmiss(); -

i have tab layout app needs download few files right when starts, in main.java file in oncreate method call: myprogressdialog = progressdialog.show(controller.this, "please wait...", "doing extreme calculations...", true); downloadfile(name_local, name_server, true); downloadfile separate thread looks likes this: protected void downloadfile(final string localfilepath, final string remotefilename, final boolean ascii) { // fire off thread work shouldn't directly in ui thread thread = new thread() { public void run() { logger.setlevel(level.debug); try{ //create client log.info("creating client"); ftp = new filetransferclient(); log.info("setting remote host"); ftp.setremotehost(host);...

python - In SQLAlchemy, can you filter a polymorphically associated model by the type of its associated record? -

i'm using polymorphic association in sqlalchemy described in this example . can found in examples directory in sqlalchemy source code. given setup, want query address es associated user s. not a user any user . in raw sql, this: select addresses.* addresses join address_associations on addresses.assoc_id = address_associations.assoc_id address_associations.type = 'user' is there way using orm session? could run raw sql , apply address class each row in results? ad-hoc joins using orm described at: http://www.sqlalchemy.org/docs/orm/tutorial.html#querying-with-joins for address in sess.query(address).join(address.association).filter_by(type='users'): print "street", address.street, "member", address.member

PHP Performance question: Faster to leave duplicates in array that will be searched or do array_unique? -

i have code adds values array. array later searched in part of code. values added array not unique, it's possible end duplicate values in array being searched. technically speaking, duplicates present in array being searched, code works fine , i'll able find value. want know if value in array being searched, , don't care if it's in array 1 time or 10,000 times. my question whether it's preferred (for performance and/or style reasons) array_unique() on array being searched before search. so example, suppose want search array this: $searchme = array("dog", "cat", "mouse", "dog", "dog", "dog"); note "dog" present 4 times. if want search value "dog", in array, work fine , able tell it's present. mentioned above, don't care how many times it's present, want know if it's present @ all. so should first before searching , search against de-duped array? $searchme_c...

iphone - Sending MMS and Email from within app -

Image
how 1 pop menu selection email, mms etc used when image selected on iphone. another thing, how can 1 add things menu e.g. facebook share, twitter share? name of menu? this menu called uiactionsheet , write code determines presented yourself. handle tap through actionhandler , can use code below present menu. can enter own nsstring facebook, twitter, etc. uiactionsheet *actionsheet = [[uiactionsheet alloc] initwithtitle: [[nsstring alloc] initwithformat: @"how should something?"] delegate: self cancelbuttontitle: @"cancel" destructivebuttontitle: nil otherbuttontitles: @"choice 1", @"choice 2", @"choice 3", nil]; [actionsheet setactionsheetstyle: uiactionsheetstyleblacktranslucent]; // need in main view otherwise "z-order" tab bar takes precedence , "covers up" lower half of // cancel button [actionsheet showinview: [self view]]; [actionsheet release]; you able register delegate notific...

actionscript 3 - Using the currentLabel property -

i doing project in as3. simple "slot machine." when handle clicked there 3 movieclips play starting @ random frames , when clicked again stop on random frame. now, part i'm having trouble with: need evaluate 3 frames (using currentlabel) , if match launch function called playwin. if don't match nothing happen. i tried standard "if" statement currentlabel property tripping me up. don't know how compare 3 statements. i've had practice comparing two. any appreciated! package com.chandelle { import flash.display.movieclip; import flash.display.framelabel; import flash.events.mouseevent; public class main extends movieclip { var _spinner1:spinner = new spinner(); var _spinner2:spinner = new spinner(); var _spinner3:spinner = new spinner(); var _lights:lights = new lights(); public function main() { var machine:machine = new machine(); this.addchild(machine); machine.x = stage.stagewidth/2; ...

c# 4.0 - What is the limitations and advantages of Cross Compiler for C# to java? -

i want migrate entire c# 4.0(.net 2010) desktop application java.i don't know tool available that?please suggest me one. also, know limitations , advantages of cross compiler c# java? please guide me out of problem... saravanan.p crosscompilers produce rather messy code, , code doesn't compile. (maybe most) force new code having bindings custom libraries crosscompiler, , forever linked product. your new code hard maintain , expand result, , might offer poor performance compared old code when compiled. in general, better off rewriting application (or hiring people so) if going have used , maintained actively more short, transitional period. that said, things crosscompiler can helpful. example start crosscompiled version , on time replace codebase newly written code, working more , you'd not have maintain 2 separate code bases, in 2 different languages, using 2 toolsets, @ same time.

Upload new photo to picasa by http request actionscript 3 -

i want add new photo picasa server using picasa api in as3. can tell me form of http request , how create binary image data put in request. api directory v2.0: https://developers.google.com/picasa-web/docs/2.0/developers_guide_protocol thanks help. you can binary data image this. var bd:bitmapdata = new bitmapdata(myimage.width, myimage.height, true,0xffffffff); bd.draw(myimage); now have bitmap data of 'myimage' in var 'bd'.

java - How to pass a String argument to ArrayList parameter -

i trying pass string argument arraylist parameter so: class { public void testa (arraylist arrayinput) { // implement function system.out.println("in testa function"); } string = "new"; testa(a); } i because want use same function pass both string values , arraylist values. there work around? thanks, sony // option 1: print in string - preferred public void testa(arraylist<string> list) { for(string str : list) testa(str); } public void testa(string s) { system.out.println(s); } // option2: print in list - not preferred public void testa(arraylist<string> list) { for(string str : list) system.out.println(str); } public void testa(string s) { arraylist<string> list = new arraylist<string>(); list.add(s); testa(list); }

Is it possible set a hint for android buttons? -

is possible set hint button in android? the hint property taken account default substitute if button text absent. not real "tooltip" in html title attribute can see when hover on element.

android - Life cycle of the application: How to do some clean jobs when the process is terminated? -

my application straightforward, main activity -> activity 1 -> activity 2, , there worker thread doing downloading jobs. , started within same process. i want downloading thread not terminated until activities destroyed, or @ end of process. in java, simple: ok adding clean code in main method. don't know right way in android. because every activity possible recycled system, don't know put clean code of worker thread, , dont't know end point of total application. could give me ideas? thanks. not sure if helps, can start service in main activity , have clean code in service's ondestroy method. service destroyed when application destroyed onterminate works on emulator - stated in docs.

jquery - Nested Li Elements Hover Alternate Background Color -

here's quick overview of problem. i've got list initial background color 1 this: <ul> <li>item 1 <ul> <li>sub item 1 <ul> <li> sub sub item 1</li> <li>sub sub item 2</li> </ul> </li> <li>sub item 2</li> </ul> </li> <li>item 2</li> </ul> what want that, first level items (item 1, item 2), when hovered upon, has background changed color two . when sub item 1,2 hovered upon, background color changed color 1 . when sub sub item 1,2 hovered upon, changed color 2 , on nesting goes deeper. means alternate levels of nesting, background color alternates between 2 colors on hover goes deeper. any idea how using jquery or css or both? the problem having multiple hover events fired when hover on sub items. since sub part of parent element, parent technically getting hovered too. can fix wrapping text...

java - catch oracle sequence and set it to another field in JPA -

an enity bean has generated sequence id (oracle primary key). need catch sequence somehow on persist , set field. example: class entity { @id long id; @column long parentid; } the idea make parentid same id generated oracle if empty. example: @prepersist void prepersist() { if (parentid = 0) parentid = id; // id not yet generated } currently use db trigger achieve this, can done in jpa (preferably without hibernate specific classes)? when persist entity in jpa, our entity object become managed, , @ point should have id populated. pre-persist, not post-persist, not have id populated.

c# - yet another forum form authentication problem asp.net -

i developing application in integrated yaf forum 1 problem facing when user login in application , move page yaf:forum integrated again need login in forum, current forum authentication code string usrname = txtusername.text; string password = txtpassword.text; int expdate = 0; expdate = 10000; string userdata = dtuser.rows[0].itemarray[0].tostring() + "," + dtuser.rows[0].itemarray[1].tostring() + "," + dtuser.rows[0].itemarray[2].tostring() + "," + dtuser.rows[0].itemarray[3].tostring() + "," + dtuser.rows[0].itemarray[4].tostring() + "," + dtuser.rows[0].itemarray[5].tostring() + "," + dtuser.rows[0].itemarray[6].tostring(); formsauthenticationticket authticket = new formsauthenticationticket(1, usrname, datetime.now, datetime.now.addminutes(expdate), false, userdata); string encryptedticket = formsauthentication.encrypt(authticket); //'check encryptedticket should not nothing'...

testing - soapUI: How to access Test Step property from assertion script? -

i'm new soapui , groovy, experienced java programmer. i created testcase 2 test steps: properties step called cid single property correlationid , value ${=java.util.uuid.randomuuid()} . test request put <correlationid>${correlationid}</correlationid> in request. it works , submits unique correlationid value every time run tests. now want add new script assertion test step 2 ( test request ) compares computed correlationid property value test step 1 ( cid ) data test step 2 response. problem can not seem able access generated value of correlationid there. if try this: log.info "${correlationid}" i get: no such property: correlationid class: script19 if try this: log.info "${cid#correlationid}" i get: startup failed: script43.groovy: 1: unexpected char: '#' @ line 1, column 16. log.info "${cid#correlationid}" ^ org.codehaus.groovy.syntax.syntaxexception: unexpected char: '#'...

c - Program hangs connecting to FIFOs (named pipes) -

i'm trying implement pipelining in operating systems shell project creating number of fifo pipes using mkfifo(). currently, program seems hang after opening first fifo writing. additionally, fifo appears when doing ls on working directory. using freopen() wrong in instance? void execute_external() { int backgrounding = 0; if (raw_command[strlen(raw_command)-1] == '&') { pmesg(2, "backgrounding requested.\n"); raw_command[strlen(raw_command)-1] = '\0'; raw_command = realloc(raw_command, strlen(raw_command)-1); backgrounding = 1; } int numcommands = 1; char **commands; commands = malloc(sizeof(char *)); if(strstr(raw_command, "|") != null) { numcommands = separate_pipeline_commands(commands); } else { commands[0] = malloc(strlen(raw_command) * sizeof(char)); commands[0] = raw_command; } int i; char *fifo = malloc(...

unit testing - Writing Test Cases using Code Igniter -

does know how can write test case controller/model using codeigniter. can please provide reference link if possible. new test cases using codeigniter. have checked on ci site didn't find how implement test cases in ci. have search on google didn't appropriate guide same. please me out asap need implement on urgent basis. regards, atul consider foostack: http://www.foostack.com/foostack/ i've been using while, , works. seems it's been tested version 1.7.2

php - CakePHP: Translating database 'inheritance' into app models/controllers -

i designing database system containing number of different user types. schema this: ## users id int name varchar(60) email varchar(60) ## doctors id int user_id int specialism varchar(60) qualification_id int essentially, doctors table child of users table. now, when i'm creating models , controllers , models in cake, thought logical create user model , subclass doctor model . doesn't seem work when testing $scaffold (the 'has one' , 'belongs to' relationships work relatively well, way not subclassing users classes). what approach suggest database designed in way? cakephp not designed this. cakephp uses activerecord pattern. pattern works great when models match database tables. breaks down when want set models in way trying now. setup, you'd need data mapper pattern (as implemented e.g. zend_db). in case, set user , docter 2 separate models hasone/belongsto relation. far easier go cake-ish flow fight it.

netbeans - Java(TM) Platform SE binary has stopped working -

when opened netbeans 6.9.1, showed me message box "java(tm) platform se binary has stopped working. problem caused program stop working correctly. windows close program , notify if solution available." clicked close program button , waited solution. it's still problem. can please suggest or me fix problem, thanks. i use window 7 64bit, jdk 1.6.0_23. i fix issue restart computer in safe mode , run installer. in case, problem caused monitor process corrupting installation's files while installation process executed. similar bug reported before: the problem in monitoring tool called "logitech process monitor" (lvprcsrv.exe). please make sure not running or other processes monitoring tool. so, running in safe mode disable process interfere in installation.

Asp.net 4.0 webform routing is not working with Window azure -

i've developed web application uses asp.net 4.0 routing. working fine without using window azure. but when use window azure, not working, giving me 404 not found error . means routing not working. i've follows link: http://www.michaelckennedy.net/blog/2009/05/27/aspnetroutinginwindowsazureusingwebforms.aspx , try implement accordingly. working fine framework 3.5 but same thing applied framework 4.0 not working. my application build on .net framework 4.0 please me. urgent. thanking you by default web role asp.net web forms created operating system image based on windows server 2008 mvc applications support routing web role image based on windows server 2008 r2. so manually switching os family 1 2 in service configuration file on web role published on r2 instead , solved problem routing me (for web api beta on .net 4.0). guess contains iis configurations allows routing not present in default web forms role image. i found solution in blog post (in ge...

Magento Advance Search - Drop down box of color - Option "All" not coming -

i working on magento project advanced search page built. have 1 attribute called "color" having following values , have made attribute property yes advance search. blue green yellow. i have updated form.php of mage/...so instead of multiselect, drop down box come. now, in advance search color drop down, not able set "all" option. want because blue preselected , in each search, criteria added. have not done updates in other pages. please me. jeff actually vary useful question , @jeff's comment great solution. report better formatting: comment out code: // 2 - avoid yes/no selects multiselects if (is_array($options) && count($options)>2) { $extra = 'multiple="multiple" size="4"'; $name.= '[]'; } else { array_unshift($options, array('value'=>'', 'label'=>mage::helper('catalogsearch')->__('all...

SharePoint Publishing Site - how do I implement reader and search engine friendly URLs? -

i have developed publishing portal in moss 2007 environment. have pages urls difficult end users read, , causing search engines not index pages properly. i went through articles implementing 'friendly url' in sharepoint. stumbled upon external tools 'tinyurl.com', don't want use third party tools accomplishing this. i downloaded 'url rewrite' extension iis microsoft suggested many. tried setting up, giving internal url name , friendly url name while creating rule. request made friendly url instead of internal url. don't know going wrong. should keep trying make things work extension, or there feasible approach can try?

php - How to fetch data from MySQL -

i executing query in zend: $front = zend_controller_front::getinstance(); $bootstrap = $front->getparam('bootstrap'); $resource = $bootstrap->getpluginresource('db'); $dbadapter = $resource->getdbadapter(); $statement = $dbadapter->query("select * test"); now $statement have zend_db_statement_mysqli object fetched records in don't know how column values zend_db_statement_mysqli . toarray() not working on $statement . thanks to obtain results $statement should this: $results = $statement->fetchall();

How to find the apk's is available or not from another apk in android -

i have android application contains 4 modules(i mean 4 apk's).each module has separate apk.but dependency more among apk's. if apk's available application works fine.but problem user can un-install apk @ time.at time application crash. how solve problem. there anyway find availability of checking apk's availability through programmatically ?.or suggest me regarding issue. please suggest me. in advance. regards murthy if apk data provider can try ask data , catch error.

html - radio button read only without fading -

is possible make radio button read only without fading ? as of people before, don't see use of it, if need it, here's hack: include jquery javascript on page , add class attributes radios: <input checked="checked" name="n" value="1" type="radio" class="rdonly checked" /> <input type="radio" name="n" value="2" class="rdonly"/> and add javascript hack: $(document).ready(function() { $("input.rdonly").change(function() { $('input.checked').attr('checked', true); }); }); this make radios "checked" class instantly become selected when user tries select radio "rdonly" class. looks read only, not faded. i hope you're looking for, again, think i'd advise against it. cheers

windows - Deduplication and filtering of Add/Remove Programs list (VBScript) -

this script works , tells , me installed in program files. two problems duplicate lines i.e avg 2011 ver: 10.0.1204 avg 2011 ver: 10.0.1204 installed: 27/01/2011 and i don't want include lines have key words "update","hotfix","java" can vb gurus out there needed in script? option explicit dim stitle stitle = "installed programs on pc -" dim strcomputer strcomputer = trim(strcomputer) if strcomputer = "" strcomputer = "." 'wscript.echo getaddremove(strcomputer) dim scompname : scompname = getprobedid(strcomputer) dim sfilename sfilename = scompname & "_" & getdtfilename() & "_software.txt" dim s : s = getaddremove(strcomputer) if writefile(s, sfilename) 'optional prompt display if msgbox("finished processing. results saved " & sfilename & _ vbcrlf & vbcrlf & "do want view results now?", _ 4 + ...