Posts

Showing posts from July, 2014

java - EclipseLink entity mapping problem when using property accessor methods -

given class below know why eclipselink implementation of jpa fails map them database entities? following error returned: entity class [class com.my.entity.y] has no primary key specified. should define either @id, @embeddedid or @idclass. if have defined pk using of these annotations make sure not have mixed access-type (both fields , properties annotated) in entity class hierarchy. @entity @access(accesstype.property) public interface y { void setid(long id); @id long getid(); } @entity public class z implements y { long id; @override public void setid(long id) { this.id = id; } @override public long getid() { return id; } } many thanks eclipselink support querying , relationships interfaces, not in annotations. to map interface can use sessioncustomizer. public class mycustomizer implements sessioncustomizer { public void customize(session session) { relationaldescriptor descriptor = new r...

c# - .net Remote Debugging with Visual Studio -- "Can't find path." -

my setup is: debugging computer: visual studio 2008 professional domain access application-running computer: msvsmon.exe workgroup only both computers: windows xp pro same local username , password access same workgroup i log same local username , password on both computers (username == "debugger"), , point vs 2008 remote computer, "robot," under project properties > use remote machine, , instruct vs debug. in short, followed directions here , here . ten second hang ensues error: error while trying run project: unable start program '......\prog.exe'. the system cannot find path specified. a few notes: i tried "run external program" pointing output of project no avail. i'm not trying debug asp.net application. the project source on local computer. please let me know if have solutions or leads. thanks. make executable , debug symbols accessible both computers: in shared or sharea...

ios - Objective-C: self = nil doesn't set instance to null value -

i've got next code, pretty simple: //secondviewcontroller.m if(contentrvcontroller==nil){ contentrvcontroller = [[contentview alloc] initwithnibname:@"contentview" bundle:nil]; //contentview custom uiviewcontroller .... [self.view addsubview:contentrvcontroller.view]; } else{ contentrvcontroller.view.hide = yes; [contentrvcontroller release]; contentrvcontroller = nil; } basically, when code launched button, if uiviewcontroller not exist, create 1 , display (it meant displayed on main bigger desktop view, secondviewcontroller view). if opened, close , remove free resources. now, contentrvcontroller instance of contentview, custom uiviewcontroller. has it's own close uibutton ibaction this: //contentview.m - (ibaction) closeview { self.view.hidden = yes; [self release]; self = nil; } now, when triggered secondviewcontroller, releasing contentrvcontroller works (or seems me), view appears , disappears. when contentv...

MySQL: Counting column from different tables on a certain timeframe -

i have following query: select sum(counted) tcounted (select counted `clicks`.`t1` union select counted `clicks`.`t2` union select counted `clicks`.`t3` ) tmp where , how add time constraint? want count between dates... sorry mysql noobness. thanks! select sum(counted) tcounted (select counted `clicks`.`t1` somedatecol between somedate , somedate union select counted `clicks`.`t2` somedatecol between somedate , somedate union select counted `clicks`.`t3` somedatecol between somedate , somedate ) tmp` http://dev.mysql.com/doc/refman/5.0/en/select.html

c# - WPF DataGrid RowDetails Visibility binding to a property (with XAML only) -

i have datagrid displaying bunch of objects. objects have property isdetailsexpanded , want bind datarows detailsvisibility property property. my first approach works requires code-behind (which rid of) i handle loadingrow event void loadingrowhandler(object sender, datagridroweventargs e) { binding b = new binding() { source = e.row.datacontext, path = new propertypath("isexpanded"), converter = (ivalueconverter)resources["booltovisi"], mode = bindingmode.twoway }; e.row.setbinding(datagridrow.detailsvisibilityproperty, b); } i think there has way achieve similar in xaml unfortunately have not slightest clue. ideas? suggestions? you can use style datagridrow type, so: <datagrid name="datagrid1" margin="12,12,0,0"> <datagrid.rowstyle> <style targettype="datagridrow"> <setter property="detailsvisibility" ...

Access VBA: New tables created in a loop causing error -

i'm grabbing field row 1 table , creating new table each row. new tables have names equal row correspond to. here code: option compare database public function createtables() dim db dao.database dim tdf dao.tabledef dim rst dao.recordset dim fld dao.field dim strsql string strsql = "select skus skus" set db = currentdb() set rst = db.openrecordset(strsql) set fld = rst.fields("skus") 'msgbox fld.value rst.movefirst while not rst.eof set tdf = db.createtabledef(fld.value) set fld = tdf.createfield("skus", dbtext, 30) tdf.fields.append fld set fld = tdf.createfield("count", dbinteger) tdf.fields.append fld db.tabledefs.append tdf rst.movenext loop end function the problem after first iteration of code (the first table created), gives me error "invalid operation" pointing line ... set tdf = db.createtabl...

Known issues with Redmine? -

we planning move on our project management redmine , our git repositories github redmine. there potential hazards or drawbacks should consider? growing team. using these across cross functional teams. members range 20 60 or more (in teams). i can suggest @ list of issues on redmine project's site - naturally, use redmine track them. we have been using redmine year (although not git), have 15 users, , have not experienced issues it. if concerned stability, might idea use older version no known serious bugs, rather latest version.

N-Best support for pocketsphinx Android! -

i have research project in need n-best support in pocketsphinx android. using swig command line tool generate pocketsphinx_wrap.c , , ndk-build generate shared library android. problem writing n-best content required in pocketsphinx.i. can 1 please advise or guide me how write function in pocketsphinx.i? you don't write function write wrapper, it's different thing. discussed in forum thread here: https://sourceforge.net/projects/cmusphinx/forums/forum/5471/topic/4566470 the wrapper should this: typedef struct ps_nbest_s nbest; typedef struct ps_nbest_t { } nbest; %extend nbest { nbest(decoder *d) { nbest *nbest = ps_nbest(d, 0, -1, null, null); return nbest; } ~nbest() { ps_nbest_free($self); } void next() { ps_nbest_next($self); } hypothesis* hyp() { const char* hyp; int32 score; hyp = ps_nbest_hyp($self, &score); return new_hypothesis(hyp, "", score...

android - Activity with EditText in layout, EditText is selected by default -

i have activity simple layout, kind of 'faux' web browser edittext url input, defined follows: <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent"> <linearlayout android:orientation="horizontal" android:layout_width="match_parent" android:layout_height="wrap_content" android:paddingtop="10dp" android:paddingleft="10dp" android:paddingright="10dp" android:paddingbottom="6dp" android:background="@drawable/activity_title_bar"> <edittext android:id="@+id/address" android:layout_width="wrap_content" android:layout_height="match_p...

css - Mis-Aligned Sliding Doors in IE7 -

i have web application designed target ie7. readjusting css make app presentable in latest version of chrome without breaking ie7 users. i've fixed mis-aligned sliding door input boxes throughout site there 1 page cannot sliding door align in both ie7 , chrome. setup simple: <span> <input type="text" ... /> </span> in case span holds left cap of sliding door , input holds right cap , body. i've styled both span , input inline-block same height , no margins or padding. chrome nails , looks great ie7 rendering input 1 pixel lower span so: need more reputation post images if add -1px of top margin input ie7 renders thing correctly , chrome renders misaligned. i've tried comparing instance of other sliding door inputs in app work in both ie7 , chrome cannot life of me see different here.... anyone run problem before? there's better way fix this, without seeing it.. add class broken input such "ie7fix...

ios4 - NSString drawInRect causes CGContextShowTextAtPoint to incorrectly display text -

i using cgcontextref in ios application create pdf, along utility methods created draw items such lines, text, images, etc. i have following method used draw multiple line text string cgcontextref: - (void)drawtextblock:(nsstring *)thetext x:(cgfloat)x y:(cgfloat)y width:(cgfloat)w height:(cgfloat)h { if (thetext == nil) { return; } uigraphicspushcontext(pdfcontext); cgcontextsavegstate(pdfcontext); cgcontexttranslatectm(pdfcontext, 0.0f, pdf_height); cgcontextscalectm(pdfcontext, 1.0f, -1.0f); [thetext drawinrect:pdfcgrectmake(x, 11.0 - y - h, w, h) withfont:[uifont systemfontofsize:fontsize]]; cgcontextrestoregstate(pdfcontext); uigraphicspopcontext(); } this code works fine drawing text blocks, if try draw other text using cgcontextshowtextatpoint after code executes, text comes out way large , upside down. if add line @ end of method, size goes normal, text still upside down: cgcontextsettextmatrix(pdfcontext, cgaff...

parsing - How to Read Time and Date from Text File in Java 5? -

i'm trying read data plain text file using java 5 se. data in following formats: 10:48 07/21/2011 i've looked dateformat , simpledateformat, can't figure out straight-forward way of reading data date object. here's have far: import java.io.file; import java.io.bufferedreader; import java.io.filereader; import java.io.ioexception; import java.text.simpledateformat; import java.util.date; class pim { file datafile; bufferedreader br; string lineinput; date inputtime; date inputdate; public pim() { datafile = new file("c:\\data.txt"); try { br = new bufferedreader(new filereader(datafile)); lineinput = br.readline(); inputtime = new date(lineinput); lineinput = br.readline(); inputdate = new date(lineinput); br.close(); } catch (ioexception ioe) { system.out.println("\n error data.txt file occu...

html - Why does a div with display:none break formatting? -

the html code below consistently results in text , textb not being horizontally aligned removing <div style="display:none;">&nbsp;</div> fixes alignment. discovered using div elements instead of p elements fixing issue, wondering going on. saw behavior in in opera, firefox, ie (ie puts textb on separate line), , chrome. my expectation div display:none not have impact on formatting. <html> <body> <div style="border-top-style: solid;"> <p style="float:left; width:280px;"> text a<div style="display:none;">&nbsp;</div> </p> <p style="float:left;"> textb </p> </div> </body> </html> div not valid child of p , browser applies error correction html end this: <div style="border-top-style: solid;"> <p styl...

iphone - <Google> Must set the rootViewController property of GADBannerView before calling loadRequest: -

i use google admob sdk in iphone app, did set rootviewcontroller property, delegate property self.adbannerview.rootviewcontroller = basedviewcontroller; self.adbannerview.delegate = basedviewcontroller; [self.adbannerview loadrequest:[gadrequest request]]; but keep getting message while running app: <google> must set rootviewcontroller property of gadbannerview before calling loadrequest: i manage 3 gadbannerview @ same time, know status of gadbannerview (does have rootviewcontroller set or not) while debugging app? i think basedviewcontroller not created yet. step 1) create viewcontroler step 2) assign

Android: How do you create spinners that look the same in an activity? -

edit: fixed using same adapter on both spinners. i have 2 spinners in activity , different. 1 looks touch friendly , other doesn't. how make them use same design? spinner spinner1 = (spinner) findviewbyid(r.id.spinner1); arrayadapter<charsequence> adapter = arrayadapter.createfromresource( this, r.array.raddix_array, android.r.layout.simple_spinner_item); adapter.setdropdownviewresource(android.r.layout.simple_spinner_dropdown_item); spinner1.setadapter(adapter); spinner spinner2 = (spinner) findviewbyid(r.id.spinner2); arrayadapter<charsequence> adapter2 = arrayadapter.createfromresource( this, r.array.raddix_array, android.r.layout.simple_spinner_item); adapter.setdropdownviewresource(android.r.layout.simple_spinner_dropdown_item); spinner2.setadapter(adapter2); spinner1.setonitemselectedlistener(this); spinner2.setonitemselectedlistener(this); i imagine somewhere in xml defines 2 spinners. ensure of relevant properties same within x...

jquery - onClientClick executes and then the page postbacks immediately -

i have following code: functions.js => function loadpopup() { $("#backgroundpopup").css({ "opacity": "0.7" }); $("#backgroundpopup").fadein("slow"); $("#popupcontact").fadein("slow"); } //disabling popup jquery magic! function disablepopup() { $("#backgroundpopup").fadeout("slow"); $("#popupcontact").fadeout("slow"); } //centering popup function centerpopup() { //request data centering var windowwidth = document.documentelement.clientwidth; var windowheight = document.documentelement.clientheight; var popupheight = $("#popupcontact").height(); var popupwidth = $("#popupcontact").width(); //centering $("#popupcontact").css({ "position": "absolute", "top": windowheight / 2 - popupheight / 2, "left": windowwi...

android - height not matching - buttons -

Image
i want 3 buttons equally spaced , equally sized. when text of 1 of button more 3 words (new line), button drops below shown in picture. there way fix same in 3 buttons in same line? tried using tablelayout / row did not help. <?xml version="1.0" encoding="utf-8"?> <linearlayout android:id="@+id/linearlayout1" android:layout_alignparentbottom="true" android:layout_width="fill_parent" android:layout_height="wrap_content" xmlns:android="http://schemas.android.com/apk/res/android"> <button android:text="trade" android:layout_weight="1" android:layout_height="wrap_content" android:layout_width="0dip" ></button> <button android:text="set alert"![enter image description here][2] android:layout_weight="1" android:layout_height=...

python - Websockets handshake problem -

i created websockets server in python ( based in gist ) works in localhost not in production server. for example, in localhost have following handshake's messages: //message webbrowser client / http/1.1 upgrade: websocket connection: upgrade host: 127.0.0.1:8080 origin: null sec-websocket-key1: ]2 415 401 032v sec-websocket-key2: 2y7 9y2o 80049 5 cookie: (...) t��t`�� //response of server http/1.1 101 web socket protocol handshake upgrade: websocket connection: upgrade websocket-origin: null websocket-location: ws://127.0.0.1:8080/ sec-websocket-origin: null sec-websocket-location: ws://127.0.0.1:8080/ �@2�j��3@5��ƶ when run same webssocket's server in production, connection fails. in chrome's console following error: " error during websocket handshake: 'connection' header value not 'upgrade' " - in handshake's messages between server , client connection (from server) have right value: //message webbrowser client / ...

What is the "generated" attribute seen in some HTML tag used for? -

i saw used in html label tag have feeling can used html tags. can kinda guess means. more curious what's benefit of using it. tried google reference couldn't find any, come experts. thanks. example: <label for="first_name" generated="true" class="error">this field required.</label> you use hook javascript and/or css. for example... css label[generated=true] { color: #ccc; } javascript var labels = document.getelementsbytagname('label'); (var = 0, length = labels.length; < length; i++) { if (labels[i].getattribute('generated') === 'true') { // something. } } it used on javascript generated elements, such label elements created jquery validation plugin . you use jquery clean up generated elements with... $('*[generated=true]').remove();

c# - asp.net - Bind to a linq datasource and add external column -

i have databound control displays grid. grid bound linq sql data source. use following code: paymentsdatacontext data = new paymentsdatacontext(); var q = act in data.activations act.approved != true orderby act.activationdate ascending select new {activationid = act.activationid, username = act.username, brokername = act.broker.brokername, existingaccount = act.existingaccount, activationdate = act.activationdate, brokeruser = act.brokeruser, approved = act.approved}; activationpending.datasource = q; activationpending.databind(); i want add column grid. want show user's email address. so: var member = system.web.security.membership.getuser(username); string email = member.email; how add field in grid, since it's not in payment db @ all? try this: var q = act in data.activations act.approved != true ...

ios - Tell Superview to ignore touch events? -

i adding subview superview , need know how tell superview ignore touch events view receiving touch events, subview. how done? thanks! set userinteractionenabled property of superview no : view.superview.userinteractionenabled = no;

javascript - Tracking only the page, not the querystring -

i'm looking track page user visits, not querystring (for privacy reasons). is valid? _gaq.push(['_trackpageview', document.location.pathname]); so page that's: x.com/section/page/?test=123 will logged as /section/page cheers yes, work fine. passing second argument log pageview using value rather default value google analytics passing ( location.pathname+location.search ), , pageviews appear without query string.

sockets - Android: Best way to communicate with a server -

i created remote server app connect using sockets. connects , receives data fine when i'm using wi-fi receives data when i'm using 3g. there better way of connecting remotely? what understand may transferring large amount of data on sockets. so, when on faster connection, goes through quickly, when on slower 3g connection, takes long time go through. so, if possible try reduce amount of data gets transferred. you can try mechanism http://download.oracle.com/javase/1.5.0/docs/api/java/util/zip/gzipoutputstream.html there corresponding http://download.oracle.com/javase/1,5.0/docs/api/java/util/zip/gzipinputstream.html . these streams compress data send on socket , decompress on receiving side. so, increases processing time little bit reduces amount of data being transmitted.

iphone - Update in a different view and date picker -

i wanna update date/time view , update date/time textfield in different view , how link ? and date picker how enable hr , mins scrollable @ times , eg. in case if time 10 . onli 10, 11 , 12 able scrollable (black) rest of hrs in grey . for updatinf of textfield picker value need take value picker , pass value view textfield .this can done when push or present view controller or can nsuserdeaults. now picker part can set minimum time , maximum time task wanted do(for picker view) . hope clear.do ask if dont anywhere.

boost - How to add macro's definition in cmake? -

i using mongodb client , boost in c++ application. because mongodb client still using boost old filesystem , c++ application using filesystem version 3 boost 1.47.0, conflict. i found way solve compilation problem, namely add macro definition before include statements header files boost in cpp files: #define boost_filesystem_version 2 but want know how put above macro's definition cmake project files. take @ add_definitions , add definitions compiler command line, e.g. -d gcc, or /d msvc. try like: add_definitions( -dboost_filesystem_version=2 ) in case, go add_definition method, alternative may take @ configure_file . can create header-file template, filled cmake-values , include in source files. can useful if have many, many configurable parameters determined cmake.

asp.net - Is there a way to pass domain credentials from the originating browser in webHttpBinding wcf service? -

is there way pass domain credentials originating browser in webhttpbinding wcf service? i'm thinking should possible when log aspx page windows authentication enabled in iis, can calling user's domain credentials. how setup wcf service in such manner? user identity in wcf service of app pool svc running under? edit i don't have .net 4 -- configuration file below, still error: security settings service require 'anonymous' authentication not enabled iis application hosts service. should explicitly enable anonymous path in iis? think undo efforts domain name. <behaviors> <endpointbehaviors> <behavior name="awesome.project.operationsbehavior"> <enablewebscript /> </behavior> </endpointbehaviors> </servicebehaviors> <behavior name="awesome.project.operationsservicebehavior"> <servicemetadata httpgetenabled="true" /> <servicedebug...

isolatedstorage - Alarm feature in Windows Phone 7 -

i trying controll snooze , dismiss button when alarm sound in windows phone 7. but couldnt find source code example on it. can me it? what want when clicked on snooze or dimiss button something such dismiss button naviagte page. and 1 more thing when alarm triggered can set play music?? because 1 have tried out not play music. private static void createalarm(string title, string time) { var alarm = new alarm(title) { content = "you have meeting team now.", begintime = convert.todatetime(time), }; scheduledactionservice.add(alarm); } private static void resetalarm() { scheduledactionservice.remove("myalarm"); } private void setalarm_click(object sender, routedeventargs e) { string time = convert.tostring(timepicker1.valuestring); createalarm(txttitle.text, time); } private void resetalarm_click(object sender, ro...

python - Unable to compile PIL/pysqlite after OS X 10.7 Lion upgrade -

after lion upgrade, had reinstall python packages, , ran problem installing pil , pysqlite. ... unable execute gcc-4.2: no such file or directory error: command 'gcc-4.2' failed exit status 1 turned out had link gcc-4.2, in /developer/usr/bin i added export path=$path:/developer/usr/bin ~/.bash_profile

javascript - How can I stop an object method call before the ajax has completed -

i have following java script object function eventtypeobj() { alleventtypes = []; // when object created go , event types can included in journey or clusters. $.ajax({ url: "/atomwebservice.svc/getdisplayeventtypes", datatype: "json", success: function(result) { alleventtypes = eval("(" + result.d + ")"); } }); // returns list of event type ids. this.geteventtypeids = function() { var eventtypeids = []; (var = 0; < alleventtypes.length; i++) { eventtypeids.push(alleventtypes[i].id); } return eventtypeids; }; } i wondering if there way stop 1 calling eventtypeobj.geteventtypeids(); before ajax call in constructor has succeeded, , there no data in alleventtypes array? something way better (im not guaranteeing 100% working, concept sound): function eventtypeobj() { this.alleventtypes = []; this.hasloadedeventtypes = false; var loadeventtype...

How do i remove the white spaces in my text file using c program -

how remove white spaces in text file ? reason work behind it, colleague, has lots of text files huge amount of white spaces between them. getting harder him remove them hitting backspace.so planned write code that.and successful upto 99%. check below code have written. #include<stdio.h> int main() { int b; char array[100]; gets(array); \\ file name given here file *p; file *t; p=fopen(array,"r"); t=fopen("./duplicate.txt","w"); for(;(b=getc(p))!=eof;) { if(b==32) { fputc(b,t); me: b=getc(p); if(b==32) goto me; } fputc(b,t); } } the code working perfect thing did it, creating duplicate of original text file.but dont want make duplicate , want rewrite original file itself. tried original text file.but going wrong. i have algorithm how approach saving strings , writing them file think not efficient approach. , g...

jquery - how to make a javascript covered slideup? -

Image
when first click answer text area, pop message box your answer contributing answer stack overflow! please make sure answer question; q&a site, not discussion forum. provide details , share research. avoid statements based solely on opinion; make statements can appropriate reference, or personal experiences. i struggling implement in own system. have checked jquery slideup function , slides text message box down not up. does 1 know how implement it? i assuming uses javascript animation. i'm not sure want, this it? think want use .slidetoggle() html <textarea></textarea> <div class="msg"> 谢谢你!! </div> jquery $(".msg").slidetoggle(); $("textarea").focus(function(){ $(".msg").slidetoggle(); }); $("textarea").blur(function(){ $(".msg").slidetoggle(); }); what want appear , when?

C++ Singleton class returning const reference -

i have class singleton defined follows class mydata { private: mydata (void); // singleton class. // copy , assignment prohibted. mydata (const mydata &); mydata & operator=(const mydata &); static mydata* s_pinstance; public: ~mydata (void); static const mydata & instance(); static void terminate(); void myfunc() { cout << "my function..." ;} }; // in cpp file. mydata* mydata::s_pinstance(null); mydata::mydata(){} mydata::~mydata() { s_pinstance = null; } const mydata& mydata::instance() { if (s_pinstance == null) { s_pinstance = new mydata(); } return *(s_pinstance); // want avoid pointer user may deallocate it, used const referense } void main() { (mydata::instance()).myfunc(); } i getting following error error c2662: 'mydata::myfunc' : cannot convert 'this' pointer 'const mydata' 'mydata&' how avoid above problem , ...

enyo - WebOS VirtualList Problem -

in code tring display sqlite db in vertual list , in code in loop can see commented alerts , conform value want want db. now value want show in vertual list. i know solution setup data in array , render how? can please replay edit code /* copyright 2009-2011 hewlett-packard development company, l.p. rights reserved. */ enyo.kind({ name: "storage.sqlite", kind: headerview, components: [ {name: "createdbbutton", kind: "button", caption: "create database", onclick: "createdb"}, {name: "createtablebutton", kind: "button", caption: "create table1", onclick: "createtable"}, {name: "filltablebutton", kind: "button", caption: "insert row table1", onclick: "filltable"}, {name: "querybutton", kind: "button", caption: "show table1 contents", onclick: "doquery"}, {name: "result...

Grails Spring Security: Switching between dual ROLEs -

in project users have dual roles, if such user logs in how can make him switch between 2 roles has can perform operations particular role provides. appreciate step step process new grails. such literature online example highly appreciated. update:- workridersuser loaduserbyusername(string username, string rolename) throws usernamenotfoundexception { // def conf = springsecurityutils.securityconfig //class user = grailsapplication.getdomainclass("person").clazz schemeuser.withtransaction { status -> schemeuser user = schemeuser.findbyusername(username) if (!user){ throw new usernamenotfoundexception('user not found', username)} userprofile userprofile = userprofile.findbyemail(user.username) representative representative = representative.findbyuser(user) organization organization = organization.get(representative.organization.id) def authorities = user.authorities.collect {new grante...

What is the java.sql.Types equivalent for the MySQL TEXT? -

when using preparedstatement 's setobject method column of type text (in mysql db), should last parameter be? for example, know ok varchar column: stmt.setobject(i, "bla", types.varchar); where stmt preparedstatement , , types java.sql.types . but if db column's type text, should still use varchar? or maybe blob, or clob? the answer (yes, meant use varchar) can found here: http://dev.mysql.com/doc/connector-j/en/connector-j-reference-type-conversions.html (updated outdated broken link) and here info mysql text type http://dev.mysql.com/doc/refman/5.0/en/blob.html

extjs - Using Html Id in ExtJS4 -

i new extjs4.may know how html id in extjs4.if have sample please share me. in extjs4 can dom node it's id using: ext.domquery.selectnode('#example_div'); or using oldschool js: document.getelementbyid('example_div');

php - load data from database instead of array -

i using jquery plugin tag-it autocomplete tags in form input field. plugin loads available tags stored in array. $("#mytags").tagit({ availabletags: ["c++", "java", "php", "javascript", "ruby", "python", "c"] }); i copied following function plugin's javascript code, believe main function load tags: tag_input.autocomplete({ source: options.availabletags, select: function(event,ui){ if (is_new (ui.item.value)) { create_choice (ui.item.value); } // cleaning input. tag_input.val(""); // preventing tag input update chosen value. return false; } }); the plugin works fine , autocomplete tags availabletags array, make small change in it. instead of loading tags array, load tags mysql database table. table has following struct...

common table expression - sql parameterised cte query -

i have query following select * ( select * calltablefunction(@paramprev) .....< whole load of other joins, wheres , etc >........ ) prevvalues full join ( select * calltablefunction(@paramcurr) .....< whole load of other joins, wheres , etc >........ ) currvalues on prevvalues.field1 = currvalues.field1 ....<other joins same subselect above 2 different parameters passed in ........ group .... the following subselect common subselects in query bar @param table function. select * calltablefunction(@param) .....< whole load of other joins, wheres , etc >........ one option me convert function , call function, dont may changing subselect query quite for.....or wondering if there alternative using cte like with sometable(@param1) ...

Android:How create ongoing notification with progress bar? -

i using service in order play background music, , want create on going notification progress bar ,on status bar, in order user can watch progress of current track. can me? thank ... create custom notification , put in notification_layout.xml file: <progressbar android:layout_width="fill_parent" android:layout_height="15dp" android:id="@+id/notificationloadingbar" android:progressdrawable="@android:drawable/progress_horizontal" android:indeterminate="false" android:indeterminateonly="false" /> keep reference notification (make global) , set progress using remoteview 's api. sample code: mnotification.contentview.setprogressbar(r.id.notificationloadingbar, max, progress, false);

salt - Java library for multiple different types of password encryption -

i'm looking library (or preferably built java) able take password , it's hash, determine type of encryption used , validate password. essentially java version of http://xref.dokuwiki.org/reference/dokuwiki/nav.html?inc/passhash.class.php.html to honest i've converted of i'm not sure how create salted md5 password in java (converting hash_smd5 function) , des encryption salt (converting hash_crypt function) any appreciated. is you're trying achieve? given original text (password, or salted password) encrypted text a list of encryption/hashing algorithm (md5, sha1, etc.) figure out encryption algorithm produced enrypted text? presumably achieved applying each algorithm in turn original text until output matches encrypted text? the digestutils class apache commons provides whole bunch of easy-to-use hash functions. bouncy castle provides large number of java implementations of encryption standards.

timeout - Python script executes another script and resumes after second script completes its job -

is there way check if subprocess has finished job? python script executes 123.exe cmd. 123.exe things , in end writes 1 or 0 txt file. python script reads txt file , continues job if '1' , stops if '0'. @ moment can think of, put python script sleep minute. way 123.exe has written 1 or 0 txt file. realization simple @ same time stupid. so question is, there way deal problem without need timeout? way make python script wait til 123.exe stops? use: retcode = subprocess.call(["123.exe"]) this execute command, wait until finishes, , return code retcode (this way avoid need of checking output status file, if command returns proper return code). if need instantiate manually subprocess.popen , go for popen.wait() (and check popen.returncode ).

php - preg_replace: replace everything but -

i want remove unwanted characters following string. here's code. $input="aecąßÄ1,.!?-_'\"/><"; $input=preg_replace('/[^\p{p}\p{l}\p{n}\s]*/u', '', $input); the code seems working fine special characters lost in output. here's get. aec���1,.!?-_'"/ instead of aecąßÄ1,.!?-_'"/ why so? edit based on comment: try use "real" characters: $input= preg_replace('/[^aecąßÄ1,.!?-_\'\"\/]/', '', $input); last answer: if want remove unwanted characters, can remove characters simpler regex: $input= "aecąßÄ1,.!?-_'\"/><"; $input= preg_replace('/[<>]/', '', $input); just put special characters between [ ] in regex. works in case.

android - stack trace and variable values -

is possible variable values included in stack trace? have started using bugsense emails stacktrace me , wonder if there way in code put variable values stacktrace output not default, have yourself: the stack trace tell involved line of code (where exception thrown) , execution stack. but nothing prevents catching exception , include debug information in message: try { ...the code... } catch (throwable t) { // here, catch throwable (exception error such outofmemory // or noclassdeffound), *absolutely not suitable* // else debugging. // can (should, actually) make catch statement more specific // depending of exception or error facing // dump variables here: final string message = "myvar=" + myvar; // statement below rethrows original throwable , adds // own message throw new runtimeexception(message, t); } or put breakpoint in catch { } statement inspect state of application @ stage, understood may not applicabl...

compiler construction - Issue regarding Java Compilation in Hudson -

let have transformation class extending commondomain class. and create daoutil inserting default parameter insert. public static void populatevaluesforinsert(commondomain domain, long userid) { java.util.date today = new java.util.date(); domain.setcreatedby(userid); domain.setcreateddate(today); domain.setupdatedby(userid); domain.setupdateddate(today); } public class transformation extends commondomain { //private static final long serialversionuid = -2800564185309854734l; private long id; private long scenariotype; private string description; //.... set here ... } public class commondomain implements serializable { private static final long serialversionuid = 1l; public static final integer default_baseline_id = 0; public static final string date_format_default = "mm/dd/yyyy"; public static final string date_format_with_time = "mm/dd/yyyy hh:mm:ss"; public long maxrowcount; private st...

regex - How do you understand the output of re.pm when debug turned on? -

[root@ test]# perl -e 'use re "debug";"a" =~ /.*/'; compiling rex `.*' size 3 got 28 bytes offset annotations. first @ 2 1: star(3) 2: reg_any(0) 3: end(0) anchored(mbol) implicit minlen 0 offsets: [3] 2[1] 1[1] 3[0] matching rex ".*" against "a" setting eval scope, savestack=3 0 <> <a> | 1: star reg_any can match 1 times out of 2147483647... setting eval scope, savestack=3 1 <a> <> | 3: end match successful! freeing rex: `".*"'` anyone can interpret this? the output has 2 important parts: pattern compilation , runtime matching. the first part describes nodes, of there three, in compiled automaton. star(n) matches 0 or more of following node , continues through node n . reg_any matches character except newline ( i.e. , /./ ) end marks end state of automaton. mbol matches beginning-o...

c# - delegates across diffferent machines -

it seems should dead easy, couldn't find in google on it: have video store server, , has multiple client applications, installed on users' machines, communicating via (let's say) web services. when dvd returned, i'd able notify useres have been waiting dvd. when dealing single application, that's no problem using delegates. question is- can approach work remote clients well? you can use duplex wcf service that. but if dvd handling service user doesn't need notified immediately, recommend solution users' clients poll server every 10 minutes. far more simple implement.

Sending data to webservice without using querystring in jQuery -

i have following jquery using send data webservice. var value1="this val1"; var value2="this val2"; $.ajax({ url: "test.asmx/postdata", data: { data1: value1, data2: value2 }, success: function (html) { strreturn = html; }, async: false }); if (strreturn == "") { //some error occured or data did not send webservice } else { //the data send webservice } now problem since data posted query string. if length of data in value1 & value2 long, data not send webservice. how can avoid sending data using querystring. i've tried setting ajax parameters "processdata" false , "type" post still no luck. it great if send me jquery code on how can done. thanks in advance what mean dat ais not sent?if do: $.ajax({ type: "post", url: "test.asmx/postdata", data: { data...

Android: Help with two linear layout that overlaps each other! -

i have 2 linear layouts inside third parent layout. first linear layout orientation horizontal , second 1 vertical. i tried achieve following code. however, second linear layout not appear. <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="#ffffff"> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="horizontal" android:gravity="center_horizontal" > <imagebutton android:id="@+id/imagebutton01" android:layout_width="80px" android:layout_height="80px" android:background="@drawable/projects_badge" android:layout_margin="10px...

Making jQuery UI's Autocomplete widget *actually* autocomplete -

i need auto-complete in app i'm working on and, since i'm using jquery ui, i'm trying make autocomplete widget meet needs. step 1 make search term match @ beginning of suggested terms. i've got working, can see in code below. step 2 have first suggestion actually autocomplete . which requires bit of explanation. when hear "autocomplete", envision typing "f" , having contents of text field change "foo", "oo" selected, replaced if type character , left in field if tab out of it. i'd call autocomplete widget suggesting, rather autocompleting. looking @ how autocomplete works internally, think autocompleteopen event correct place (it's called every time list of suggestions updated), i'm @ loss how access suggestion list there. any thoughts? $("#field").autocomplete({ delay: 0, source: function filter_realms(request, response) { var term = request.term.tolowercase(); var...

Rails 3: How much time does a method takes to run -

i want receive information concerning how time method takes run. how can in rails without using newrelic ? you can use ruby-prof .

ruby on rails - devise custom routes -

when user goes /account/edit click submit button redirects /signup path ? appreciated. routes devise_for :users, :skip => [:registrations, :sessions] 'signup' => 'devise/registrations#new', :as => :new_user_registration post 'signup' => 'devise/registrations#create', :as => :user_registration 'users/cancel' => 'devise/registrations#cancel', :as => :cancel_user_registration 'account/edit' => 'devise/registrations#edit', :as => :edit_user_registration put 'account' => 'devise/registrations#update' delete 'users' => 'devise/registrations#destroy' 'signin' => 'devise/sessions#new', :as => :new_user_session post 'signin' => 'devise/sessions#create', :as => :user_session 'signout' => 'devise/sessions#destroy', :as => :destroy_user_session end registrations...

iphone - Cannot get UIActivityIndicatorView to show while loading data -

i have uiactivityindicatorview on tableviewcontroller. when start animating in init see activity indicator, when move start command anywhere else not work/show. have idea doing wrong, cannot seem find on here. want show while loading data. tableviewcontroller.h #import <uikit/uikit.h> @interface categorytableviewcontroller : uitableviewcontroller { nsarray *cats; uiactivityindicatorview *activityindicator; } @end tableviewcontroller.m #import "categorytableviewcontroller.h" #import "nieuwsdatamanager.h" #import "categorytablecell.h" #import "niewscategory.h" #import "nieuwstableviewcontroller.h" @implementation categorytableviewcontroller - (id)initwithstyle:(uitableviewstyle)style { self = [super initwithstyle:style]; if (self) { cats = [[nsarray alloc ] initwitharray:[nieuwsdatamanager sharedinstance].newscategories]; self.title = @"nieuws" ; activityindicator =...

mod rewrite - mod_rewrite aliasing a subdirectory -

i'm struggling mod_rewrite always. have number of client portals running through wordpress multisite, accessed through subdirectory: portal . so example: http://www.mydomain.com/portal/clienta/ i'd able there typing http://www.mydomain.com/clienta/ , redirect me http://www.mydomain.com/portal/clienta/ here's have far, , it's not producing rewrite can tell: rewritecond %{request_uri} /portal/ rewritecond %{request_filename} -f rewritecond %{request_filename} -d rewriterule . - [s=1] rewriterule /clienta(/?) /portal/clienta/ # begin wordpress <ifmodule mod_rewrite.c> rewriteengine on rewritebase / rewriterule ^index\.php$ - [l] rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule . /index.php [l] </ifmodule> # end wordpress the second part can't touch because wordpress needs it. pattern trying anticipate not putting in trailing slash, hence (/?) edit: should note don't want create more general rule - i...

sql server - Lucene.net and google snippet similar -

i need create search engine dynamically extracts full text search results snippet (like google). have read posts talking lucene.net. it's great product (i need c# solution) have summarizing features too, sql server full search. i have searched solution didn't find any. ideas? i've put many blob objecst sql server , must create search, google. lucene has .net port called lucene.net there highlighter class lucene.net can used highlight (create summary) of search results. see: how highlight phrase on results lucene.net lucene.net search result highlight search keywords

php - How to prevent file location from showing? -

i allowing users upload documents server. however, don't want them see files being stored. can allow them still file without seeing file location. you can use php query accomplish this, lets use following url: http://mysite.com/files.php?file=xyz.pdf in files.php can check variable file , have hard coded function retrieves file. can many ways 1 using headers force download or read file var , print it's contents page. pdf reading file , printing page same linking file. warning though: using headers not print page except file. recommend declairing headers still if read file , print end user not gobbly goop source of file i.e. jpg or pdf. oh no, forgot header warning, have been running header problem ever since adobe made iso pdf's open source, depending on application produced pdf , browser user uploading pdf from, header from: 'application/pdf', 'application/x-download','application/octet-stream','application/octet',...

db4o - Deleting Child Entities in JDO -

i know if following possible in jdo. i have 1-n relationship between parent , child class. classes like @persistencecapable public class parent { @persistent private string name; @elements(mappedby = "parent", dependent = "true") private list<children> children; } @persistencecapable public class child { @persistent private string name; @persistent private parent parent; } cascading deletes work fine. can delete parent , children removed data store. if query data store particular child , have query delete it, child removed table of child objects parent's list of children contain null entry. i guess dumb question there way jdo update parent's list on deletion of child or have myself? thanks replies. i recommend db4o without datanucleus layer. getting in way of better performing soluton. we've done testing , found if use db4o directly performs better , uses less resources. ...

iphone - NSMutableURLRequest loses session information -

i have iphone app i'm trying talk rails end. i'm using nsmutableurlrequest pull data , forth. calls work fine on requests when need post data, rails app can't seem find session. i've posted code below both , post request. this post request: //set url nsstring *url_string = [nsstring stringwithformat:@"https://testserver.example.com/players.xml"]; nsurl *url = [nsurl urlwithstring:url_string]; nsmutableurlrequest *request = [nsmutableurlrequest requestwithurl:url cachepolicy:nsurlrequestreloadignoringcachedata timeoutinterval:30]; //to create object in rails //we have use post request ////this format when using xml nsstring *requeststring = [[nsstring alloc] initwithformat:@"<player><team_game_id>%@</team_game_id><person_id>%@</person_id></player>", game, person]; nsdata *requestdata = [nsdata datawithbytes:[requeststring u...

c++ - problem with shadow volume using opengl -

i cannot figure out solution shadown projections using shadow volumes , stencil buffers. problem can viewed in: www.dt.fee.unicamp.br/~ricfow/shadowproblem.avi in other video: www.dt.fee.unicamp.br/~ricfow/shadowproblemaux.avi faces associated silhouettes have been draw, blue means front face , red face. what problem? problem solved. edges beloging silhouettes being extruded twice. thanks.

objective c - XCode compiler warning: 'class' may not respond to 'method' -

i'm trying rid of warning keeps popping up. this part of wordlisttableviewcontroller.m #import "wordlisttableviewcontroller.h" #import "xmlreader.h" @implementation wordlisttableviewcontroller - (void)viewdidload { [superviewdidload]; nsdictionary *status = [_maindictionary retrieveforpath:@"dealers"]; } @end the xmlreader.h file: #import <foundation/foundation.h> @interface xmlreader : nsobject <nsxmlparserdelegate]] > { nsmutablearray *dictionarystack; nsmutablestring *textinprogress; nserror **errorpointer; } + (nsmutabledictionary *)dictionaryforpath:(nsstring *)path error:(nserror **)errorpointer; + (nsmutabledictionary *)dictionaryforxmldata:(nsdata *)data error:(nserror **)errorpointer; + (nsmutabledictionary *)dictionaryforxmlstring:(nsstring *)string error:(nserror **)errorpointer; @end @interface nsmutabledictionary (xmlreadernavigation) - (id)retrieveforpath:(nsstring *)navpath; @end the w...

c# - When creating a WCF in vs.net, how can I run and view a web page with all the endpoints? -

when hit f5 doesn't fire web browser end points exposed. how behavoir service? my web.config looks like: <?xml version="1.0"?> <configuration> <system.web> <compilation debug="true" targetframework="4.0" /> </system.web> <system.servicemodel> <behaviors> <servicebehaviors> <behavior> <!-- avoid disclosing metadata information, set value below false , remove metadata endpoint above before deployment --> <servicemetadata httpgetenabled="true"/> <!-- receive exception details in faults debugging purposes, set value below true. set false before deployment avoid disclosing exception information --> <servicedebug includeexceptiondetailinfaults="false"/> </behavior> </servicebehaviors> </behaviors> <servicehostingenvironment multiplesitebindi...