Posts

Showing posts from August, 2011

Simplest way to get a polygon from Illustrator to Java? -

what's simplest way polygon (doesn't need curves etc, array of points) illustrator (or other vector graphics program, matter) java polygon object? i'm not eager implement heavy svg class, app needs light-weight possible. i know it's wide question, may answers be. in advance, guys. you might want try "fxg converter (webstart)" (http://idisk.mac.com/han.solo-public/fxgconverter.jnlp) http://harmoniccode.blogspot.com/ .

NextGen gallary for WordPress not displaying correcting in chrome -

the nextgen gallery isn't displaying in chrome, works fine in firefox. has found fix problem? even sample page gallery display isn't displaying correctly. http://nextgen-gallery.com/gallery-tags/ when open image view it, after moving second image, image moves down bit , after few images sitting below website, not near top or in middle. making unusable. thank you better yet: <style type="text/css"> #shdisplay { top:15%!important;. } </style> worked me, , not have absolute value, better different sized monitors!!

c++ - C++11: std::thread inside a class executing a function member with thread initialisation in the constructor -

i'm trying use std::thread c++11. couldn't find anywhere if possible have std::thread inside class executing 1 of function members. consider example below... in try (below), function run(). i compile gcc-4.4 -std=c++0x flag. #ifndef runnable_h #define runnable_h #include <thread> class runnable { public: runnable() : m_stop(false) {m_thread = std::thread(runnable::run,this); } virtual ~runnable() { stop(); } void stop() { m_stop = false; m_thread.join(); } protected: virtual void run() = 0; bool m_stop; private: std::thread m_thread; }; class mythread : public runnable{ protected: void run() { while(!m_stop){ /* something... */ }; } }; #endif // runnable_h i'm getting error , others: (same error , without $this) runnable.h|9|error: no matching function call ‘std::thread::thread(<unresolved overloaded function type>, runnable* const)’| when passing pointer. runnable.h|9|error: is

Resources for learning how to design good API wrappers in ruby -

i'd learn how design api wrappers in ruby. i'm looking for: blog articles tutorials best code , library learn code directly (well commented , designed) books ... , also, what of favorite api wrappers , makes them special? any source welcome in advance update jun 29 2011 building platform api on rails update: 13/06/2011 have @ great post on how develop an api wrapper/interface client: - http://www.arailsdemo.com/posts/56 chapter 2 of ruby best practices might helpful. you can read free here .

vb.net - WCF 'sub main' not found -

i must losing mind... after getting test wcf hosted in windows service, i'm trying 1 (practice, practice, practice). i created wcf service library, added 1 function. created windows service, , added wcf project. did rest of stuff located here (http://joefreeman.co.uk/blog/2010/03/creating-a-setup-project-for-a-windows-wcf-service-with-visual-studio/) now i'm getting "sub mian not found in [wcf app]" error when try build solution. i didn't think wcf projects required sub main services , not applications. doing wrong? didn't have sub main in last project. ideas? the wcf service doesn't need sub main, windows service does. compare against built, working windows service. edit: using c#, when create new project using windows service template, following initial code in program.cs file ( static void main sub main ). i'd very surprised if don't have in windows service. static class program { /// <summary> /// mai

java - load resource from Jar file at runtime -

i trying load resource jar file added in @ runtime , not getting far. here code (groovy): url url = new url("jar:file:/out/resource.jar!/test.resource") def urllist = [] << url url[] urls = urllist.toarray() urlclassloader classloader = new urlclassloader(urls, this.class.getclassloader()) inputstream stream = url.openstream() i error: java.util.zip.zipexception: error in opening zip file @ java.util.zip.zipfile.open(native method) questions: 1) need put "test.resource" in url? 2) relationship between urlclassloader , current class's classloader? 3) proper way stream in resource (obviously have doesn't work)? thanks if want add jar file current thread's classloader you'd create new urlclassloader, use current class's classloader parent , add new jar urls. may not put test.resource in url. don't forget assign new classloader current thread. see example below: url url = new url("file:/out/resource.ja

Detecting mime-type of a MySQL BLOB in Java -

yes know shouldn't store images on database , thanks. that said, there way detect in java mime type of blob stored in mysql? it images (.gif, .png, .jpeg, etc.) don't need common purpose tool. thanks lot guys bonus points if proposed solution not involve 3rd party libs :) i imagine can take @ headers. need read data byte array , examine bytes see if match headers different file-types. for example, gif, first 3 bytes "gif" (47 16 49 16 46 16 ) followed either "87a" (38 16 37 16 61 16 ) or "89a" (38 16 39 16 61 16 ). so should work (uses fileinputstream demonstration purposes, can binary data blob using resultset#getbinarystream(int) or resultset#getbinarystream(string) ): import java.io.fileinputstream; import java.io.fileoutputstream; import java.io.ioexception; import java.util.arrays; public class identifyimage { public static void main(string[] args) throws ioexception { fileinputstream in

flash - Accessing SimpleButton TextField -

i've been trying change text within simplebutton instance using this: var drawbutton:simplebutton = main.drawbutton; var upbutton:displayobjectcontainer = drawbutton.upstate displayobjectcontainer; var upbuttontext:textfield = upbutton.getchildat(1) textfield; upbuttontext.text = "pause"; i found solution here: how can change texts in dynamic textfields in simplebutton instance (button symbol)? unfortunately, upbuttontext return null. according debug, upbutton has 3 children, tried getchildat([0-2]) try , text didn't happen. tried getting instance name, no luck. know why isn't working? appreciate help. for others' information first of set tlf text editable. then used code string inside button: var upstate:sprite = sprite(drawbutton.upstate); var uptext:string = tlftextfield(upstate.getchildat(2)).text; and change text: tlftextfield(upstate.getchildat(2)).text = "paused"; this works, , tested. thanks user elekwent tip

cocoa touch - What's the correct use of NSErrorRecoveryAttempting, NSError, and UIAlertView in iOS? -

i'm having trouble finding examples of correct way use nserror , uialertview , , nserrorrecoveryattempting on ios. of documentation , examples can find cover equivalent functionality on os x, relevant behaviors integrated cocoa. in ios seems necessary do "by hand", , can't find examples of how it's done. i'd appreciate few examples of best practice in using information in nserror support recovery attempts nserrors reported user. according apple's documentation: important: nserror class available on both mac os x , ios. however, error-responder , error-recovery apis , mechanisms available in application kit (mac os x). so, i'm not sure if can use nserrorrecoveryattempting though appear defined in documentation (it looks area of uikit docs have not yet been updated after being copied appkit's documentation). here how handle errors in code: nserror *error = nil; id result = [someclass dosomething:&error]; if (!result

SAML 2.0 Browser/Post Profile Single Sign-On to classic asp web site -

i'm new in saml 2.0 single sign-on implementation. client needs provide them single sign-on on classic asp website saml 2.0 browser/post profile. client provide me xml meta data , certificate don't know solution i'll provide them. could possible saml 2.0 browser/post profile classic asp site? task , solution need do? please advise. in advance. certainly possible - although have challenges in classic asp environment. know if acting identity provider or service provider in sso setup? sounds of it, expect service provider - in case need parse & validate incoming saml assertions, , possibly send saml authnrequests idp. metadata partner provides guide on protocols/url's/certificates using. to handle saml protocol, re-invent wheel writing own code in asp. of course time consuming , risky, simpler if used proven solution. there may i'm not aware of free/open source asp implementations, might want consider commercial solution component space (htt

captcha - Update 2 exact same images source using javascript -

i using php captcha called cryptographer captchan.fr site i need use 2 captcha on same page have problem generated when click refresh first 1 refreshes, refresh code looks this. document.images.captcha.src='cryptographp.html?cfg=0&&'+math.round(math.random(0)*1000)+1; i tried code works first 1 anyway document.getelementbyid('captcha').src='cryptographp.html?cfg=0&&'+math.round(math.random(0)*1000)+1; now wanted added name="captcha" image not work reason can me fix it? document.getelementsbyname('captcha').src='cryptographp.html?cfg=0&&+math.round(math.random(0)*1000)+1; i have jquery attached page if thats easier. you can't have more 1 element same id on page. may why it's hitting first one. if add class both images called "captcha" can jquery: $('.captcha').attr('src', 'cryptographp.html?cfg=0&&'+math.round(math.random(0)*1000)+1);

.net - Regex to match escapable strings? -

i wrote regex match strings: (?>(?<quote>""|').*?(?<!\\)\k<quote>) i.e., text enclosed in quotes. supports escaping, match "hello\"world" in entirety without stopping @ first quote, want. forgot double-escaping. "hello\\"world" not valid, example. i'm pretty sure possible fix balancing groups , i've never used them before. know how write this? regular expressions not meant used escaped constructs. i don't think it's possible in "nice" kind of way (if @ all), although i'll post edit if figure out otherwise. balancing group definitions nested constructs. nesting doesn't happen in strings, balancing group definitions don't seem right tool this. edit 1: it depends on how many features you're looking for. if want match next escaped quotation, can use pattern ^"([^\\\"]|\\.)*" which, when escaped code, turns out like "^\"([^\\

.net - Create a custom action which msiexec will ignore its' error code -

i use visual studio 2010 create setup package .net framework 4.0 project. create custom action using installer class dll built .net framework 4.0. setup package installed successfully. if remove package , after removing .net framework 4, ok. however, if remove .net framework, after remove setup package, error: "1001 installutillib.dll unknown erro" . think reason can't remove setup package because msiexec call custom action installer class using .net framework 4.0 while .net framework 4.0 removed before -> installer dll can't called , return error ->removing msi failure. please me how avoid error or how ignore error code of custom action. thanks. you can try this: open msi orca go customaction table , find custom action add msidbcustomactiontypecontinue flag existing value in type column save changes visual studio doesn't support directly.

java - How to get data through JSON in a particular format -

following code snippet used online roster gtalk if (status == true) { roster roster =connection.getroster(); collection<rosterentry> entries =roster.getentries(); system.out.println(roster.getentrycount()); int count1 = 0; int count2 = 0; for(rosterentry r:entries) { presence presence = roster.getpresence(r.getuser()); if(presence.gettype() == presence.type.unavailable) { // system.out.println(user + "is offline"); count1++; } else { string rosternamesjson = new gson().tojson(r.getname()); string rosteruserjson =new gson().tojson(r.getuser()); response.setcontenttype("application/json"); response.setcharacterencoding("utf-8"); //array of 2 elements string rosterinfojson=response.getwriter().

php - How can I get the Latitude and Longitude of a ZIP Code? -

i need latitude , longitude dynamically of zip code entered user. can work show shop address on area of zip code. google running kind of geocoding, should check out, might http://code.google.com/apis/maps/documentation/geocoding/

What would be best approach to write JQuery Code in asp.net for Inser,Edit and Delete operation? -

i have 3 button insert,edit , delete on sample.aspx page in .net application.i doing client side operation on every button click event using jquery.what best approach write jquery code performance point of view. 1.)should write separate click event each button click given below $("#btninsert").click(function(){ //insertcode }); $("#btnedit").click(function(){ //edit code }); $("#btndelete").click(function(){ //delete code }); 2.) should write common function given below $("#btninsert").click(function(){ operation("i") }); $("#btnedit").click(function(){ operation("e") }); $("#btndelete").click(function(){ operation("d") }); function operation(optype) { if( optype = "i") { //insert } if( optype = "e") { //edit } if( optype = "d") { //delete } } 3.)should use onclientclick

.net - How to package a SharedAddin to ClickOnce deployment -

we have shared addin excel , want go clickonce deployment. know generates msi file when setup shared addin project, not sure how package this... me there great article how here this walks through whole process step step.

Verbose name for admin model Class in django -

is possible create verbose name actual class model? class user(models.model): fname = models.charfield(max_length=50, verbose_name = 'first name') so in admin panel referenced verbose name , not 'user' ? class user(models.model): fname = models.charfield(max_length=50, verbose_name = 'first name') class meta: verbose_name = "users"

html - Need help to display an icon image in a command button -

just basic need cannot work. have primefaces button display image, without text. but button contains ^ character , not displaying image, has size of 16x16. so, primefaces button : <p:commandbutton image="ui-icon-csv" title="csv document" ajax="false"> <p:dataexporter type="csv" target="gridrpbdetails" filename="#{tinputbean.exportfilename}" /> </p:commandbutton> this css file : .ui-icon-csv { background-image: url(images/csv_small.png); } and generated html button : <button type="submit" onclick=";" name="gridrpbdetails:j_idt82" id="gridrpbdetails:j_idt82" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-icon-primary" role="button" aria-disabled="false"> <span class="ui-button-icon-primary ui-icon ui-icon-csv"></span><span

asp.net - Radio button in multiple columns -

i have table in have place radio buttons in multiple columns. these buttons, 1 radio button can checked. how achieve these. have 5 columns viz.a,b,c,d,e , want place radio button each column. //here code .aspx page <%@ page title="" language="c#" masterpagefile="~/interviewer /interviewermasterpage.master" autoeventwireup="true" codefile="appratingform.aspx.cs" inherits="interviewer_appratingform" %> <asp:content id="content1" contentplaceholderid="head" runat="server"> <style type="text/css"> .style1 { width: 100%; } </style> </asp:content> <asp:content id="content2" contentplaceholderid="contentplaceholder1" runat="server"> <table cellpadding="2" width="100%"> <tr> <td colspan="2"> &nbsp;</td> </t

.net - change a virtual key after a keysroke and send to application -

i wanna change virtual key after keysroke, used raw inputs device information. actulay have 2 keyboards(a keyboard , barcode scanner) , raw input can keystorke come one. need chage virtual keys if come barcode scanner. change them "keychar = convert.tochar(0);" possible, how? i'm not sure you're asking or exact environment you're in, i've been working barcode scanners using winforms, , had requirement first fetch scanned text, change it, send on form. capturing key strokes easy, how gonna know if come barcode scanner or keyboard? the trick used in barcode format. have start , stop sign, $. use scanner , scan notepad , you'll see. then use sign way of start capturing key strokes. each $ start capture every following keystroke made, @ next $ stop capture, take string , whatever want it. shot result form using sendkeys (assuming have @ least removed start/stop sign). note, works code-xxx bar codes. gtin standards, don't use start or s

html - Remove redundant CSS properties between 2 or more CSS files -

i have 2 css files have redundant css properties set between them. for example, in foo.css : #test { border: 0; font-size: 16px; } in bar.css : #test { border: 0; font-size: 32px; width: auto; } with this, i'd want remove border: 0; bar.css . i expected find answer in existing question, life of me couldn't find anything. there must quick tool process 2 or more files? there's add-on firefox called dust-me selectors scans stylesheets on page , gives list of ones used , aren't used. this can useful detecting styles can safely rid of. (though still need put intelligence it, there might styles show unused used dynamically, etc)

jquery - making the axis labels in jqplot clickable -

how can make axis labels (of category x axis) clickable. if less problematic, ok click lead new link (and not javascript code) is there way can this? thanks, boaz. here simple script: $(".jqplot-xaxis-label") .css({ cursor: "pointer", zindex: "1" }) .click(function(){ location.href = "http://google.com"; }); the important thing happening above zindex being set 1 sits above canvas object. can click it. cursor style makes have friendly rollover mouse icon. now, can whatever want inside click event.

jquery - Floating div at center doesn't work in IE -

let's have fallowing html- <div id="submitpage" align="center" > <div id="middlecontainer"> <p align="center" id="loading-image">&nbsp;<img src="/cso/images/loading.gif" border="0" > <font color="red" >submiting order...</font></p> </div> </div> i trying float submitpage div @ center of page...i ahve used fallowing css , it's working fine in mozila don't know why it's not working in ie-8.. #submitpage { border: 1px solid black; width: 746px; height:201px; background: aqua; text-align: center; z-index: 99; position: fixed; display: block; margin:90px auto; } #middlecontainer{ text-align: center; width: 91px; margin: 0 327px; } #loading-image { position: absolute; top: 74px; left: 299px; z-index: 100; } please let me if doing wrong or missing needs added ie.any way doing using jquery appreciated.

php - How to retrieve PID of a photo? -

$pid = $fb->api(array( 'method' => 'fql.query', 'query' => 'select first_name user uid='.$session['uid']) ); try { $fb->api( array( 'method' => 'photos.addtag', 'pid' => $pid[0], 'tag_uid' => '100000492080016', 'tag_text' => "hello", 'x' => 65, 'y' => 65, ) ); } catch (facebookapiexception $e) { print_r($e); } when use above code in facebook app, shows error param pid must valid merged photo id. how can resolve problem? or can explain how retrieve pid of pic in other way? in query select first_name user uid='.$session['uid'] retriving first_name database, thats problem think. so think need change query. select first_name,pid user uid='.$session['uid'] i not familiar facebook apis , might m true.

video streaming - Who has the guide for dropCam iPhone library -

i have downloaded dropcam iphone library https://github.com/dropcam/dropcam_for_iphone . but have no guide. there no readme. there libdropcam.a , lib folder. i need use library on including ffmpeg. i can not compile decoder wrapper because of ffmpeg library. so going use libdropcam.a. how use libary?

Bluetooth connection gets disconnected after sometime in android -

i have connected bluetooth device , android phone via bluetooth. able send , receive data device. receive data continuously device, after sometime bluetooth connection dies , no more data received bluetooth device. could please tell me how avoid this, need receive data bluetooth device untill user stops it.

visual studio 2010 - Missing "Create Unit Tests..." menu item in Solution Explorer -

i'm using vs2010 ultimate recently i've installed: resharper -http://www.jetbrains.com/resharper/features/index.html vs2010 power tools - http://blogs.msdn.com/b/jasonz/archive/2010/06/07/announcing-vs2010-productivity-power-tools-and-modeling-feature-packs.aspx since installing 1 of these 2 things (not sure which) i've lost right-click menu allow me create unit tests within solution explorer does know how redisplay menu item? i've looked high , low through settings i've tried disabling "hide overriden vs menu items" option in r# any appreciated. thanks! i see using vs2010. have same set of tools , never had issue. sku problem? unfortunately in vs2012 it's known "issue" vs team didn't address since rc: where "create unit tests" selection? .

java - no throws clause -

this program correct , compile , run. why method 'a' not have throws declaration? class exception1 { public void a() { int array[] = new int[5]; try { system.out.println("try"); array[10]=1; } catch (exception e) { system.out.println("exception"); throw e; } { system.out.println("finally"); return; } } public static void main(string[] args) { exception1 e1 = new exception1(); try { e1.a(); } catch(arrayindexoutofboundsexception e) { system.out.println("catch"); } system.out.println("end of main"); } } the problem return in finally block: s

oauth - MAking API request always got "token_rejected" error -

i have developed oauth component, , completed yahoo's oauth process, got oauth_token. but when make api call yahoo api (like contact or yql), "token_rejected" error message. http 401 signature: 6fr3vdyggrrco+wrs6tld3hjhmi= base_string: get&http%3a%2f%2fsocial.yahooapis.com%2fv1%2fuser%2fmomjs2m2ksmqkt2d q4o7ns4jfu%2fprofile%2fusercard&oauth_consumer_key%3ddj0yjmk9zmzzufvqblzzm1jvjmq 9wvdrou9gbfnrmujutmprbwnhbzlovfuytwprnu9ewxkmcz1jb25zdw1lcnnly3jldcz4ptjk%26oaut h_nonce%3d2366072fe9829333b98eb6f2a7539afa%26oauth_signature_method%3dhmac-sha1% 26oauth_timestamp%3d1305099596%26oauth_token%3da%3d4cneo.njj1_c6xtkvr3o5x3voyqrn hhk3sbfh76pptcka07wf69oadx8zu7o0dpsraun77uibw.5bek5opw15a8ssemxquervhhhpuahtm0sb uugbosmxapwbdu1.e4oeqqmxivkrfhy81evbidclbcxzeg.y.eeudnfdkp_suvakko.i6tazpbfkqa1c __7baqo5m74cisalgwyyi8z99eitplzq_llb7czzhowjtvzvavh_hou2jbbjswp00agb.ovxqt0ayf0. whg2v7hhfhvh.mex6h0oa8rgpuszr68dviiiplfv6g.fgcf3gsne4uvnidwm2.x4lf37slpgwqmjuttx b8uvltqu0au

How can I get the raw XML response from a .NET generated SOAP client rather than serialized objects? -

i need access raw response xml .net generated soap client (using svcutil ). believe can intercepting custom behaviour, don't need deserialized objects @ (and rather not take performance hit of creating them). there way can bypass default serialization , access raw response xml directly? http://msdn.microsoft.com/en-us/magazine/cc163302.aspx this article describes notion of inspectors - can 'raw' message in there. this not address avoiding .net serialisation though...

c# - Validation on confirming Alert -

script <script language="javascript" type="text/javascript"> function finalfunction() { //your first script return confirm('are sure submit test?'); } </script> <asp:button id="button1" runat="server" text="button" onclientclick="javascript:finalfunction();" onclick="button1_click" /> this script showing confirmation alert message either on clicking ok or cancel button, page redirecting page. what want when click on cancel button, page should on same page, should not redirect page. how do it? onclientclick = "return finalfunction();"?

What is the best way to design for mobile websites? -

i notice there jquery mobile. but limited default themes. can customize fix mobile applciation needs or there other framework should use check post: how create jquery mobile theme

c# - Using T4 Templates with VS2010 Express and XNA -

i'm using vs2010 express create game built xna . i'm trying use t4 templates (to produce strongly-typed classes of content locations, using level1location = content.levels.level1 instead of level1location = @"content\levels\level1" . i've read t4 templates aren't set in express editions, if create file extension .tt should work. when create .tt file in xna class library following warning (and no code file): the custom tool 'texttemplatingfilegenerator' failed. not load file or assembly 'microsoft.visualstudio.servicesproxy, version=10.0.0.0, culture=neutral, publickeytoken=b03f5f7f11d50a3a' or 1 of dependencies. system cannot find file specified. i've searched , searched , can't find useful. has encountered problem before? know if solution? i've tried changing custom tool texttemplatingfilepreprocessor suggested, same error. edit: i've discovered issue it's in xna project / library. works fine in normal cla

compiler errors - How to compile java classes which are inside multiple folders? -

i new java world. have got few classes inside nested folders. my namespace has following folder structure (assume companyname folder on c:\ ): companyname -> isuname -> projectname -> module1 -> sampleclass1.java companyname -> isuname -> projectname -> module2 -> sampleclass2.java companyname -> isuname -> projectname -> module3 -> codepart3.1 -> sampleclass3.java companyname -> isuname -> projectname -> module3 -> codepart3.2 -> sampleclass4.java my problem is, want compile of these classes command prompt. i tried following command not working : c:\> javac -sourcepath companyname\*.java but not working. getting following error : javac: no source files usage: javac <options> <source files> please compile of these classes , possibly create jar out of it. i looked @ the manual page javac , , seems you'll have spell out source files on command line, or you'll have list them in separ

adobe analytics - How to track category,subcategory and product details in omniture? -

how track category, subcategory , product details being viewed user in omniture sitecatalyst? if talking groupging products categories , on, best practice method omniture capture individual products (e.g. sku), , manage groupings of these through saint classifications. basically text file lookup has skus, along various categories etc want assign each. synchronise sitecatalyst gui. this works better trying record these groupings @ time code fires.

sql - How can I create a trigger in sqlite database? -

i have create trigger in sqlite database. there 3 tables in database questions (question_id) options (option_id, question_id) answers (answer_id, question_id) whenever row deleted question table, corresponding data should deleted option , answer tables. i trying create trigger using create trigger question_delete before delete on questions each row begin delete options question_id= old.question_id , delete answers question_id= old.question_id; end i error. should create 2 different trigger perform operation or changes required in above statement? please let me know. thanks nidhi remove and after first delete statement: delete options question_id = old.question_id; delete answers question_id = old.question_id;

github - Is there a canonical fork of mustache.js? -

i'm looking @ pulling mustache.js project, , quick glance @ its network graph revealed has ton of heavily-committed-to forks. are of these considered canonical/preferable? or best off starting download of janl's original distribution until need fork? this tough one. if root repo need , doesn't seem buggy, it's best start there. unless owner of root repo has stated active development has been passed on specific fork. can explore forks later, or make own fork , pull stuff want in it.

c# - XML file loaded as a string -

i have noticed code wrote few years , whilst thinking optimizations thought maybe area improved. have following: var xml = new stringbuilder(""); foreach (var product in products) { xml.append(product.asxml()); // gives xml string. } return string.format("<products>{0}</products>", xml); the xml string large number of products in database increase, wondering if there better way this. jd i use linq xml link you try this: var prod = new list<string>(); prod.add("apples"); prod.add("oranges"); var doc = new xelement("product"); foreach(string p in prod){ doc.add(new xelement("products", p)); } debug.writeline(doc.tostring()); outputs this <product> <products>apples</products> <products>oranges</products> </product> this mean no mucking around strings. cheers iain

c# - Map SQL Query to Business object in Nhibernate -

i want map sql query business object using nhibernate . there lot fields in employee table, getting 3 , want map one. here sql query <sql-query name="findemployeesinfo"> <return alias="emp" class="calibr.businessdocuments.bos.employee, businessdocuments"/> <![cdata[ select (emp.eid) {emp.id},(emp.firstname) {emp.firstname},(emp.lastname) {emp.lastname} employee emp ]]> </sql-query> here have make constructor map columns public employee(int id, string firstname, string lastname) { this.id = id; this.firstname = firstname; this.lastname = lastname; } db employee table column names: eid, firstname,lastname,............ i getting exception could not execute query [ select (emp.eid) eid1_0_,(emp.firstname) firstname1_0_,(emp.lastname) lastname1_0_ employee emp edit: if select columns, work perfect -- select * employee emp thanks help. i think benefit using nhibernate'

websphere 6.1 - XMLAccess in WebSpherePortal 6.1? -

hi want install , configure new theme , skin websphereportal server 6.1. 1 give reference or document xmlaccess. before configuring themes , skins have copy our themes file:\$server_root$\installedapps\ibm-710bb15a391\wps.ear\wps.war\themes\html , skin file:\$server_root$\installedapps\ibm-710bb15a391\wps.ear\wps.war\skins\html skin: 1)register skin registerskin.xml: <?xml version="1.0" encoding="utf-8"?> <request xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:nonamespaceschemalocation="portalconfig_6.1.0.xsd" type="update" create-oids="true"> <portal action="locate"> <skin action="update" active="true" objectid="rockskin" uniquename="rockskin" resourceroot="w3skin"> <localedata locale="en"> <title>rockskin</title> </localedata> </skin> </portal>

Conversion from jQuery into JavaScript -

i've script: <form id="myform"> <input type="text" value="" id="input1"> <input type="text" value="" id="input2"> <input type="submit" value="submit"> </form> <img id="image" src="http://mydomain.com/empty.gif" /> <script> $(document).ready(function () { $("#myform").submit(function (ev) { ev.preventdefault(); var val1 = $("#input1").val(); var val1 = $("#input2").val(); $("#image").attr("src", "http://mydomain.com/image?val1="+val1+"&val2="+val2); }); }); </script> how if written in javascript? <img id="image" src="http://mydomain.com/empty.gif" /> <script> window.onload = function() { // not browsers support domcontentloaded document.getelementbyid(&q

c# - Perform Aggregate function of DataTable -

i have perform aggregate function on datatable datatable.compute compute return object want perform aggregate function on datatable , datarow . _summarytable.compute("min(fareadult)", whereclause + "airlinedisplayname='" + convert.tostring(airline["airlinedisplayname"]) + "' , ( stops=0) "); but above code return min(fareadult) want select 2 column based on above condition datatable. how can through linq have select min(fareadult) , totelprice value of same row use select instead compute _summarytable.select("filterationexpression"); datarow[] dr = _summarytable.select("min(fareadult),airlinedisplayname='" + convert.tostring(airline["airlinedisplayname"]) + "' , ( stops=0) ");

JMS, Message Queing Service, ESB related question -

assume there 2 web services , b setup in soa infrastructure. web services depends on information available locally installed desktop application (its legacy application based on c++ programming , provides c++ api give information needed web service a). the scenario this: human actor (which can considered consumer of web service b)logs website , clicks button requests service provided web service b. part of request, id sent. web service b sends request web service id. web service uses id somehow determine way talk locally installed desktop application of human actor originated request. the main problem how can web service connect desktop application , information in reliable way using soa infrastructure. assume in soa java based except desktop application. the desktop application crm application own internal database , not traditional database mysql. provides basic textual information human actor , customer(s) of human actor in installed crm desktop application. i want u

PyGTK properties versus python properties -

when deriving gobject class in pygtk, can define gobject properties in c, using __gproperties__ dict, , do_get_property / do_set_property methods, described here in sub-classing gobject in python . note written before had @property decorator in python. gobject properties have advantage can connect object's notify::property-name signal receive notification whenever property changes. other that, there reason use gobject properties instead of python's @property decorator? why not use them? simplified version provided python bindings, defining gobject properties not different defining python properties. having said that, there couple of advantages other notification. 1 i've made use of in past property setting in gtk.builder files. example, in ui file, <object class="gtkimage" id="image"> <property name="stock">gtk-missing-image</property> </object> sets stock property on image object when const

knockout.js - Does Knockout have a separator template? -

when binding this: <div data-bind='template: { name: "persontemplate", foreach: someobservablearrayofpeople }'> </div> is possible specify sort of separator template, similar separator template in classic asp.net? there not way specify separator template. however, think there few options: include content in "persontemplate" use wrapper template renders persontemplate , separatortemplate , point template binding (that way reuse separator template, if necessary) use afterrender option of template binding insert content.

python - SyntaxError: "can't assign to function call" -

this line in program: invest(initial_amount,top_company(5,year,year+1)) = subsequent_amount causes me error: syntaxerror: can't assign function call how fix , make use of value of function call? syntactically, line makes no sense: invest(initial_amount,top_company(5,year,year+1)) = subsequent_amount you attempting assign value function call, error says. trying accomplish? if you're trying set subsequent_amount value of function call, switch order: subsequent_amount = invest(initial_amount,top_company(5,year,year+1))

c# - Is there an easy way to make EntityFramework use SQL default values? -

for example, of entities have datecreated , datemodified fields. defaults these set getutcdate() in sql server. if try , create entity , don't set these values, exception saying can't run sql insert because date value out of range. makes sense because c# default dates 1/1/0001 while sql server's minimum date 1/1/1753. so there way can tell ef either use sql server default values, or not try , insert columns have not been set? you must set storegeneratedpattern properties identity datecreated , computed datamodified . available in designer. once cannot modify values in application - database can set properties. wrote some article because feature had bug before vs2010 sp1 there reports still doesn't work sometimes.

plsql - Can I delete rows using user defined functions in oracle? -

i created user defined function delete data. doesn't work delete works select. oracle 9i. the function this: create or replace function ufn_purgedata(inputid in varchar2) return number result number; begin result := 0; delete mytable mytable.id=inpid; commit; result := 1; exception when others return(result); end ufn_purgedata; then use select ufn_purgedata('test') dual run got result 0 . the answer question "no". if remove error "handling" find delete failing exception like: ora-14551: cannot perform dml operation inside query i.e. cannot perform insert, update or delete within function called in select statement. to execute function in ide or sql plus, wrap in more pl/sql this: declare l_result number; begin l_result := my_function(123); end; however, need add return statement function first otherwise fail. (nb said "handling" above in quotes because "mishandling"

c# - WPF form should resize to show its content -

Image
when wpf window appear first time, content seem frozen. refresh content need resize form, fixed. or hit tab find listbox -it's not visible- , click , viola! form updates content again. what think? weird huh? in advance! edit: private void window_loaded(object sender, routedeventargs e) { this.show(); while (!appmain.needclose) { system.windows.forms.application.doevents(); dothings(); } } resizing window force internals invalidate , re-paint. try invalidating form when it's loaded force same: private void window_loaded(object sender, routedeventargs e) { this.show(); this.invalidate(); while (!appmain.needclose) { system.windows.forms.application.doevents(); dothings(); } } unless you're doing sort of custom message pumping though, standard forms message pump should while loop you. might find because you're intercepting window loaded event you're stopping initialisation completing. call

Grails application won't run -

after installing export plugin can not run grails application , this java.lang.linkageerror: loader constraint violation: loader (instance of <bootloader>) initiated loading different type name "org/xml/sax/saxparseexception" @ java.lang.class.getdeclaredmethods0(native method) @ java.lang.class.privategetdeclaredmethods(class.java:2427) @ java.lang.class.getdeclaredmethods(class.java:1791) @ java.security.accesscontroller.doprivileged(native method) @ org.codehaus.groovy.util.lazyreference.getlocked(lazyreference.java:46) @ org.codehaus.groovy.util.lazyreference.get(lazyreference.java:33) @ grails.util.pluginbuildsettings.getplugininfos(pluginbuildsettings.groovy:123) @ grails.util.pluginbuildsettings.getplugininfos(pluginbuildsettings.groovy) @ grails.util.pluginbuildsettings$getplugininfos.callcurrent(unknown source) @ grails.util.pluginbuildsettings.getplugininfo(pluginbuildsettings.groovy:167) @ grails.util.pluginbuildsettings$getplugininfo.callcurrent(unknow

Magento: Add customer group to pdf packing slip -

i trying add customer's group pdf packing slips. assuming should done in sales/model/order/pdf/abstract.php, put where? thanks ok, here did. put following code - wrote: /* add customer type invoice */ $write = mage::getsingleton('core/resource')->getconnection('core_write'); $readresult=$write->query("select customer_id `sales_order` increment_id = ".$order->getincrementid()." limit 0,1;"); $row = $readresult->fetch(); $customerid = $row['customer_id']; $myroleid = 1; if (!empty($customerid)) { $write = mage::getsingleton('core/resource')->getconnection('core_write'); $readresult=$write->query("select group_id `customer_entity` entity_id = ".$customerid." limit 0,1;"); $row = $readresult->fetch(); $myroleid = $row['group_id']; } switch ($myroleid){ case 2: $grouptitle = 'wholesaler invoice'; break; case 3: $grouptitle = 'reta

php - Go Link thru iFrame -

i have problem , tried click link doesn't work open link using target: name of iframe. dont want use href because im going make show/hide div. javascript: <script type="text/javascript"> <!--// function godirect(url, targetname) { document.getelementbyid(targetname).src = url; //frame[targetname].location.href = url; } //--> </script> in html , php: $a=0; echo '<a href="#" onclick="godirect("http://www.google.com", iframe_url'.$a.');">click me!</a>'; echo '<iframe class="iframe_url" id="iframe_url'.$a.'"></iframe>'; you have quote strings in javascript. trying id of element passing in variable haven't defined. you using same quote characters delimit html attribute value using delimit js strings. to use approach using, while making minimum number of fixes make work: echo '<a href="#" onclick="go

javascript - Discover which form button triggered submission -

in form, have 2 submit buttons. <input type="submit" name="save" value="save draft"/> <input type="submit" name="send" value="start sending" /> now before submitting form server, want perform specific tasks depending on button clicked. $('form').submit(function(){ if submit equals save task 1; elseif submit equals send task 2 } how check button pressed? $(":submit").click(function() { $("form").data("submit-button", this.name); }); $("form").submit(function() { var button = $(this).data("submit-button"); ... }); add click handler on submit buttons stores name. extract name in submit handler.

java - Amazon SimpleEmail: how to check if an Email has been delivered? -

i tried send emails amazon ses, java aws sdk, , worked. able check (at later time) whether delivery successful. define successful if final mailserver accepted mail delivery. i saw when send email can messageid uniquely identifies email: sendemailrequest request = new sendemailrequest(from, destination, message); sendemailresult result = service.sendemail(request); string messageid = result.getmessageid(); however saw can aggregated statistics, example senddatapoint (represents sending statistics data. each senddatapoint contains statistics 15-minute period of sending activity). i'm not using ses send bulk emails, personalized notifications on low volume , i'd interested check every single message. did overlook something? possible type of check ses? amazon provide mechanism capture bounces, provides contrapositive verification. you can create mailbox receive bounce notifications, tell ses forward bounce notifications there. e.g.: request.s

c++ - Passing parameters to _beginthreadex -

i'm attempting basic parallelisation using _beginthreadex, , passing parameters per example given, won't work. any ideas? #include <iostream> #include <process.h> void mythread(void *data) { std::cout << "hello world!"; } int main() { _beginthreadex(null, 0, mythread, null, 0, null); while(true); } edit: why won't passing null argument work? (since function takes no arguments anyway?) passing null arguments list worked fine _beginthread. your code has 2 errors in it, neither of related parameter thread function --- null fine that, surmised. the problems in signature of thread function, , error getting points out. firstly, must __stdcall function, , secondly must return unsigned int . function __cdecl , returns void . unsigned __stdcall mythread(void *data) { std::cout << "hello world!"; return 0; } should fix problem you.

javascript - how do i fire an event when document readyState is complete -

i want fire , event when dom has loaded. checked out document.readystate it's not event. want fire when readystate complete. how do that? i recommend using jquery library , ready function.

android - Issue trying to detect swipe to change views in ViewFlipper -

i'm trying implement swipe detection change views in viewflipper . i've used code shown below, copied there . while ontouch triggered when touching viewflipper , onfling event never triggered. anybody can help? what's best way detect swipe? thanks public class homeactivity extends activity { viewflipper viewflipper; private gesturedetector gesturedetector; private animation slideleftin, slideleftout, sliderightin, sliderightout; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.home); linearlayout home = (linearlayout) findviewbyid(r.id.home); // gesture detection gesturedetector = new gesturedetector(new mygesturedetector()); // info popup imageview btn_open_popup = (imageview) findviewbyid(r.id.btn_popup); slideleftin = animationutils.loadanimation(this, r.anim.slide_left_in);