Posts

Showing posts from January, 2013

Facebook integration working in emulator but not working in android device? -

i have integrated facebook api in android application facebook login , post comments working in emulator same things not working on actual device. have created android hash key command prompt , configure key facebook developer native android app block, giving me error on device invalid android_key parameter. key amdg_kt_yelljlsj.. not match allowed key.configure app key hashes @ http:/facebook/developer. thanks. turn off sand box mode , activate live mode of application created on developer site.

php - Is this possible to do in RethinkDB -

i've used mongodb in past , want use similar schema. i've tried create using php driver doesn't work expected. guesses either rethinkdb not support or php driver not capable this. r\table('user')->insert([ 'username' => 'something', 'skills' => [ 'php' => 10, 'html' => 15 ] ])->run($conn) result in rethinkdb administrator js client: { "username": "something" , "id": "899a2693-dd94-4670-a496-05626a88d190" , "skills": { } } what suggest , how should this? it seems work php 5.4.13, rethinkdb 1.5.1 , lastest version of php-rql. r\table('user')->insert([ 'username' => 'something', 'skills' => [ 'php' => 10, 'html' => 15 ] ])->run($conn); it gives following r

SQL Server - Missing records in join -

i'm trying accomplish following using below query: take records dial table , group based on various criteria contained within table join table history table on unique key ( dial.uid , history.uid ) return information unobtainable dial table all working fine, apart not returning rows dial table have uid of 0 (this updated in both tables once record has been processed, if hasn't been processed, remains @ 0). count of records have uid of 0 added total avail. , total eligible columns, based on dial.id can help? regards select (case when history.id = 824 or project.name 'example1%' or project.name 'example2' or project.name '%example3%' 'team one' when history.id = 814 or project.name '%example4%' 'team two' else 'other' end) [team], project.name [project], count(dial.id) [total avail.], count (case when dial.flag = &

php - I need to add information to an already existing user in an XML file -

session_start(); $xml = simplexml_load_file('gebruikers.xml'); $gebruiker = $xml->xpath('root[login="'.$_session['login'].'"]'); $coordinates = $gebruiker[0]->addchild('coordinates'); $coordinates->addchild("x",$_get["x"]); $coordinates->addchild("y",$_get["y"]); file_put_contents('gebruikers.xml', $xml->asxml()); xml-file <root> <gebruiker> <login>tom</login> <wachtwoord>123</wachtwoord> </gebruiker> </root> getting these errors : notice: undefined offset: 0 in c:\xampp\htdocs\tom\project php\projectphp_html\coordinaten.php on line 6 fatal error: call member function addchild() on non-object in c:\xampp\htdocs\tom\project php\projectphp_html\coordinaten.php on line 6 i'm stuck .. please me out. the xpath $gebruiker wrong, instead: $gebruiker = $xml->xpath('gebruik

asp.net mvc - How to (not) specify scope in class libraries with Ninject3 -

i've asp.net mvc application using ninject3 (nuget install). solution contains: an mvc project ( composition root ); a domain model project; a data layer project; a scheduler project (running scheduled jobs within windows service , holding alternative composition root ); some other projects. i'm following approach have many small modules spread across projects defining bindings. 2 composition roots use same bindings. i cannot figure out how configure scope modules within class libraries. example, given these bindings: bind<idomainservice1>() .to<service1impl>() .insingletonscope(); //this should singleton bind<idomainservice2>() .to<service2impl>(); //no scope specified i want single instance of service1impl , whereas scope service2impl should depend on composition root used. mvc project should have inrequestscope() service2impl (and other bindings unspecified scope). scheduler project, not run within http context, should us

c# - Creating Webservice which has child parent concept -

i want create web service below. result list 1 people, want common things it's parent , have many child i.e. detail in it's child level. <person> <id>1</id> <name>manoj</name> <age>20</age> <salary> <month>1</month> <money>10000</money> </salary> <salary> <month>2</month> <money>12000</money> </salary> <salary> <month>3</month> <money>13000</money> </salary> </person> but web service return <person> <id>1</id> <name>manoj</name> <age>20</age> <month>1</month> <money>10000</money> </person> <person> <id>1</id> <name>manoj</name> <age>20</age> <month>2</mo

multithreading - load textures into a thread blocks the mainUI in android -

i try load bitmaps , display them textures (opengles2.0). make runnable thread, , once loaded bitmap sent textures. thread runnable, main ui thread freezes while during loading of pictures. don't understand , pretty lost it… clues ? sounds you're calling mythread.run() instead of mythread.start() run() executes in calling thread, start() makes new thread , calls run inside of that. if that's not case, can't without relevant code.

r - rolling computations in xts by month part2 -

i want calculate var @ end of month historical method. time series start @ beginning of 2000 until now. calculation should start lets in 2005 have enough data. there similar post rolling computations in xts month , have tried modify code case. var @ end of each month should use past data. here code (here starts in 2012 because otherwise take long): library(quantmod) getsymbols("^gspc",return.class = "zoo",from = "2012-01-01",to = sys.date()) sp500 <- ad(gspc) ldr_sp500 <- return.calculate(sp500, method = "log") ldr_sp500 <- na.omit(ldr_sp500) idx <- index(ldr_sp500)[endpoints(ldr_sp500, 'months')] out <- lapply(idx, function(i) { as.xts(rollapplyr(as.zoo(ldr_sp500), 30, var)) }) sapply(out, nrow) first of there big error in code. should width be? possible give output zoo object? iam beginner kind of functions... when dont want use historical method rather gaussian method use: apply.monthly(as.xts(ldr_sp500

Where is the documentation for Play sbt-plugin (Build.scala)? -

i using play version 2.1.1, , trying modify build.scala. by default, imports package called play.project._ i have been trying find out api of package customize our build.scala file. the thing have link: http://www.playframework.com/documentation/2.1.1/build i tried find here: http://www.playframework.com/documentation/api/2.1.1/scala/index.html#package could point me location of api? the build.scala uses playproject described in play sbt documentation . playproject sbt.project , should have closer @ corresponding sbt api . playproject defined here (line 147): lazy val playproject = playruntimeproject("play", "play") .settings( librarydependencies := runtime, sourcegenerators in compile <+= sourcemanaged in compile map playversion, mappings in(compile, packagesrc) <++= scalatemplatesourcemappings, parallelexecution in test := false, sourcegenerators in compile <+= (dependencyclasspath in templatescompilerpr

javascript - How does LinkedIn script read the api_key on the script tag? -

the linkedin getting started page shows following way include javascript file. <script type="text/javascript" src="http://platform.linkedin.com/in.js"> api_key: your_api_key_goes_here </script> my question - how can this? cool if this: <script type="text/javascript" src="helloworld.js"> inputparam: hello world! </script> and in helloworld.js function getparam(name) { /* fill in logic here, somehow should return "hello world!" */ } alert(getparam('inputparam'));

ruby on rails - git push and git push heroku master in one step -

is there way execute git push , git push heroku master in 1 line on command prompt? it cumbersome , time-consuming go git push , wait, wait, git push heroku master here's 2 ways: in shell (you don't have wait, it'll execute these both 1 after other): git push origin master && git push heroku master if install hub gem , can push origin , heroku (and more), so: hub push origin,heroku master

java - How is jProfiler handling JIT? -

i use jprofiler extensively , great tool wondering how jprofiler handling effects of jit compilation. am able observe example method inlining ? if method inlined, not visible in snapshot @ or jprofiler still able compute execution time? similarly, a method has no side effects , can optimized away not shown in jprofiler. correct? i profile applications after quite long warmup time expect code jit-ed/optimized possible. therefore, methods suspect should optimized away , yet visible in profile big mystery me. i use jprofiler extensively , great tool wondering how jprofiler handling effects of jit compilation. just-in-time compilation rather old technology replace hotspot adaptive optimizer. jit blindly compiles every method java bytecode native code, , may (or may not) able optimize well. however, adaptive optimizer looks @ how code runs right now , optimizes code being executed often. because optimizer aware of how code being used, optimizer can , better me

JavaScript var=key not working? -

anybody have idea happening i've got code console.log('ccp: '+chatcurrentplace+' - key: '+key); if(key>chatcurrentplace){chatcurrentplace=key;} console.log('ccp: '+chatcurrentplace+' - key: '+key); and console logs ccp: 0 - key: 4 ccp: 4 - key: 4 ccp: 4 - key: 7 ccp: 7 - key: 7 ccp: 7 - key: 8 ccp: 8 - key: 8 ccp: 8 - key: 9 ccp: 9 - key: 9 ccp: 9 - key: 11 ccp: 9 - key: 11 why last 1 not working? should ccp: 11 - key: 11 one or both of variables strings, being compared strings , no numbers. "9" > "11" same reason "b" > "aa" (strings compared character character until first index differ). convert values numbers in test (e.g. unary + operator ) : if( +key > +chatcurrentplace ){ chatcurrentplace = key; } or the parseint function : if( parseint(key, 10) > parseint(chatcurrentplace, 10) ){ chatcurrentplace = key; } you may wish convert values before rea

SQLite Joining tables on Android -

i want join 2 tables in same database. join makes work. example: table1: date | name |surname table2: date | brand and want table: table3: date |name |surname |brand 01/01/13 jhon null 02/01/13 null null bmw where rows ordered date not joined, means parameters null.but that's not problem. is possible? how? thank you. use union all records respective source tables: create table table3 select date, name, surname, null brand table1 union select date, null, null, brand table2 order date

javascript - Avoid double function calling on overlaying images? -

i have 1 smaller image laying on top of bigger one, , both connected on click jquery function. my problem when click smaller one, browser first executes function connected smaller one, , executes function connected bigger one. html: <div id="outer" style="position: relative; width:200px; height:200px; background:#00f;"> <div id="inner" style="position: absolute; top:100px; left:100px; width:50px; height:50px; background:#0f0;"> </div> </div> jquery: $('#outer').click(function(){ alert('outer'); }) $('#inner').click(function(){ alert('inner'); }) or see jfiddle here: http://jsfiddle.net/xmg2t/ . how prevent browser, when click smaller image, executing second function connected bigger image? you can use event.stoppropagation() stop event bubbling child element it's parent. event.stoppropagation() - prevents event bubbling dom tree, preve

javascript - Can't get "If paused" to work in videojs -

i'm trying show overlay on video when video paused. docs took: var ispaused = myplayer.paused(); var isplaying = !myplayer.paused(); and implemented follows: var ispaused = myplayer.paused(); if (ispaused == true) { $("#social_share").fadein(1500); } var isplaying = !myplayer.paused(); if (isplaying == true) { $("#social_share").fadeout(1500); } unfortunately did not work, , can't find why. thoughts highly apricaited! (ps: shows on initial start logical since player paused @ time. idea's on how prevented more welcome.) thanks! you're looking events. specifically, pause , play events. try: myplayer.on("pause", function () { $("#social_share").fadein(1500); }); myplayer.on("play", function () { $("#social_share").fadeout(1500); }); reference: https://github.com/videojs/video.js/blob/master/docs/api.md#events

java - Saving Preferences from within a JAR -

Image
i writing game, , have come point need user able save preferences things such jframe size, key bindings etc. users running game through jar downloaded website. i've decided go preferences api under "java.util.prefs.preferences". still quite new when comes reading things documentation, , explain bit me. so far, have this: preferences prefs = preferences.usernodeforpackage(com.custardgames.horde2d.game.class); prefs.put(name, value); now then, how saving preference file on users computer? right now, if run program again , try just: preferences prefs = preferences.usernodeforpackage(com.custardgames.horde2d.game.class); system.out.println(prefs.get(name, null)); it returns null default value if there nothing saved. know missing vital part of saving file, , opening correct way, haven't gotten out of googling it. thanks in advance! edit: fyi, reading images, using this: bufferedimage currentimage=imageio.read(this.getclass().getclassloader().getresour

javascript - jQuery resize() event not firing on input resize. Alternate solution? -

this question has answer here: resize event textarea? 8 answers as title says, jquery event resize() not firing when width of input box changes. according jquery api documentation , resize event sent (window) handler. question is, other solution have listen resize event. i'm using transition attribute in css, rather using jquery animate alter inputs width. it's cleaner , smoother in css, keep so. if has other solutions, please list them below. my first attempt this $('input').resize(function() { $(this).val('resize? nope!'); }); here fiddle resize event: http://jsfiddle.net/yw9ct/ the resize() method in jquery elements can manually resized user. resizing element using javacript/jquery, not firing event... you can either create own event, or use textarea . update after looking @ jsfiddle, issue clear. resizing input

python - Euclidean algorithm (GCD) with multiple numbers? -

so i'm writing program in python gcd of amount of numbers. def gcd(numbers): if numbers[-1] == 0: return numbers[0] # i'm stuck here, wrong in range(len(numbers)-1): print gcd([numbers[i+1], numbers[i] % numbers[i+1]]) print gcd(30, 40, 36) the function takes list of numbers. should print 2. however, don't understand how use the algorithm recursively can handle multiple numbers. can explain? updated, still not working: def gcd(numbers): if numbers[-1] == 0: return numbers[0] gcd = 0 in range(len(numbers)): gcd = gcd([numbers[i+1], numbers[i] % numbers[i+1]]) gcdtemp = gcd([gcd, numbers[i+2]]) gcd = gcdtemp return gcd ok, solved it def gcd(a, b): if b == 0: return else: return gcd(b, % b) and use reduce, like reduce(gcd, (30, 40, 36)) since gcd associative, gcd(a,b,c,d) same gcd(gcd(gcd(a,b),c),d) . in case, python's reduce funct

Node.js source code build giving segmentation fault on ARM -

tl;dr: tried install node.js on armv7-based cubox running ubuntu 12.10 (quantal). when compiling node.js source (see "second attempt" below), node produces segmentation fault. can here? first attempt first of all, tried install node.js via package manager, following instructions ubuntu given here: installing node.js via package manager: ubuntu, mint adding repository mentioned there using sudo add-apt-repository ppa:chris-lea/node.js seems work fine: you add following ppa system: evented i/o v8 javascript. node's goal provide easy way build scalable network programs more info: https://launchpad.net/~chris-lea/+archive/node.js press [enter] continue or ctrl-c cancel adding gpg: keyring `/tmp/tmpp0owib/secring.gpg' created gpg: keyring `/tmp/tmpp0owib/pubring.gpg' created gpg: requesting key c7917b12 hkp server keyserver.ubuntu.com gpg: /tmp/tmpp0owib/trustdb.gpg: trustdb created gpg: key c7917b12: public key "launchpad chrislea" imported

c - Handle Ethernet interrupt in DOS -

is there such thing ethernet interrupt in c under dos incoming data? have written application waits incoming data in "while(true)" loop , works perfectly. want know if there interrupt service can handle incoming data outside of while(true) loop. having had wander through rbil seem doing interrupt level ethernet out of question. ethernet in tcp/ip arena. end therefore suggest fighting hard stay on serial interfaces, or else start studying tcp/ip network ms-dos , dos tcp/ip networking packet drivers .

python - is it possible to set numbers as a string in a listctrl -

okay ran complications setting numbers in listctrl they're numbers in sql database , they're inserted strings... converted numbers automatically from wx import * import item class itemmain ( wx.frame ): def __init__( self, parent ): wx.frame.__init__ ( self, parent, id = wx.id_any, title = u"items", pos = wx.defaultposition, size = wx.size( 517,486 ), style = wx.default_frame_style|wx.tab_traversal ) self.setsizehintssz( wx.size( -1,-1 ), wx.defaultsize ) bsizer3 = wx.boxsizer( wx.vertical ) # create item self.ite = i.item() self.list = wx.listctrl( self, wx.id_any, wx.defaultposition, wx.defaultsize,wx.lc_report ) self.list.insertcolumn(0,"item id") self.list.insertcolumn(1,"item name") self.list.insertcolumn(2,"item price") self.list.insertcolumn(3,"stock") self.list.bind(evt_list_item_selected,self.getselecteditems)

object - Handling uninitialized Strings in Java -

here's part of small program i'm doing homework assignment: public exam maxgrade() { node p = firstnode; int max = 0; string name; while (p!=null) { if (p.info.getgrade()>max) { max = p.info.getgrade(); name = p.info.getname(); } p = p.next; } if (name==null) return null; else return searchbyname(name); } so when go ahead , compile, compiler outputs message: student.java:127: error: variable name might not have been initialized if (name==null) the problem solved substituting fourth line with: string name = null; now, can see logic in this. i'd grasp workings behind problem. mean, seems reasonable compiler checks whether variable initialized if sees you're doing in code, don't think i'm doing needs variable initialized. according sources this when declare string (or other object) variable "name", points null. why considered anomaly

c# - How to set ActionExecutingContext status code -

Image
i using localization actionfilterattribute , working fine, except need redirect / /en status code of 301 instead of 302 . how can fix this? code public class localize : actionfilterattribute { public override void onactionexecuting(actionexecutingcontext filtercontext) { // .. irrelevent logic here .. // set redirect code 301 filtercontext.httpcontext.response.status = "301 moved permanently"; filtercontext.httpcontext.response.statuscode = 301; // redirect filtercontext.result = new redirectresult("/" + cookielanguage); base.onactionexecuting(filtercontext); } } proof redirectresult has constructor overload takes url , bool indicate if redirect should permanent: filtercontext.result = new redirectresult("/" + cookielanguage, true); from can see, should available in mvc 4.

ruby - how to associate a new user's email internet domain with a network on my website? (rails 3) -

for example, if user signs using email johndoe@xyz.com, want user part of "xyz" network on website. people allowed join respective networks. there numerous networks on website , separate each other. how user table looks in schema.db create_table "activities", :force => true |t| t.integer "trackable_id" t.string "trackable_type" t.integer "owner_id" t.string "owner_type" t.string "key" t.text "parameters" t.integer "recipient_id" t.string "recipient_type" t.datetime "created_at", :null => false t.datetime "updated_at", :null => false end add_index "activities", ["owner_id", "owner_type"], :name => "index_activities_on_owner_id_and_owner_type" add_index "activities", ["recipient_id", "recipient_type"], :name =>

android - Current Location with google map api V2 -

regards, i want ask there method or class google map api key version 2 can fetch current location(in address) through latitude , longitude derived. in google map api version 1 there class geocoder,which can use change latitude , longitude address.but think can't use geocoder class in api v2 because uses fragment class. have solution ? thank you. geocoder not part of maps api v1 , can use api v2.

javascript - uninitialized constant Object::Element in Opal RB -

trying hand @ opal/jquery. app.rb file looks this: require 'opal' require 'opal-jquery' class htmlobject def initialize end def write_to_body end end class htmlparagraph < htmlobject attr_accessor :inner_html def initialize(text) @inner_html= text end def write_to_body @body = element.find("#body") @body.append(element("<p>#{@inner_html}")) end end p = htmlparagraph.new("hello world") p.write_to_body i compile using example site app.js. run in web browser index.html: <!doctype html> <html> <head> <script src="jquery-1.10.1.min.js" type="text/javascript"></script> <script src="opal.js" type="text/javascript"></script> <script src="opal-jquery.min.js" type="text/javascript"></script> <script src="opal-parser.js" type="text/javascript"

c++ - Why is basic_string::swap not noexcept? -

i found out 2 swap functions basic_string (member function , function in namespace std) not declared noexcept - neither in standard library of gcc-4.8 nor in recent c++ draft n3690. on other hand, move constructor move assignment operator declared noexcept . shows should possible provide noexcept swap functions. question: what's reason not having swap functions declared noexcept ? update: problem want use template function within own swap functions, uses static_assert check swap noexcept , e.g.: struct foo { bar_t bar; baz_t baz; void swap(foo& rhs) noexcept { swap_noexcept(bar, rhs.bar); swap_noexcept(baz, rhs.baz); } }; however, works if swap functions declared noexcept , , that's not case basic_string . paragraph 21.4.6.8 of c++11 standard specifies: 21.4.6.8 basic_string::swap [string::swap] void swap(basic_string& s); 1 postcondition : *this contains same sequence of characters in s, s contain

iphone - Float a UIView around the screen in the background -

this question has answer here: moving object randomly around screen 1 answer so i'm trying long running animation uiviews. i'm trying accomplish take square subview , have float randomly around screen in background (like leaf floating on pond). hoping regular animations far i've had problems animation stops setting option begin @ current position. know of simple way this? i saw moving object randomly around screen isn't going cause stack overflow due recursion? also, i'm asking how without added library/framework. thanks! i wrote code you: - (cgfloat) distancebetweentwopoints: (cgpoint) point1 : (cgpoint) point2 { cgfloat dx = point2.x - point1.x; cgfloat dy = point2.y - point1.y; return sqrt(dx*dx + dy*dy ); } #define kmovingspeed 25 //pixel per second - (void) floatview : (id) view_{ uiview *view = (uiview *)vi

java - Spring Data JPA - loading parent after explicit child deletion returns collection of children with deleted child -

i have parent->child bidirectional relationship follows... class parent{ @onetomany(mappedby="parent", fetch = fetchtype.eager) collection<child> children; } class child{ @manytoone @joincolumn(name="parent_id") private parent parent; } when delete child explicitly, , after load parent (with children) deleted child in children collection of parent... jpa provider hibernate... child child= childrepo.findone(child_id); childrepo.delete(child); childrepo.flush(); // next, returns collection without deleted child collection<child> children= childrepo.findall(); parent parent = parentrepo.findbyid(parent_id); /// next, returns collection including deleted child collection<child> parentchildren = parent.getchildren(); i don't understand problem? every find* method executes select (at list, selects logged in console) , returns different results... your manytoone eager (by default). onetomany eager (y

java - JDBC connection does not run with .jar file, but with eclipse project -

i'm looking @ mystery here. created java program in eclipse , established jdbc connection. code following: import java.sql.*; public class login { public static void main(string[] args) { try { // class.forname("com.microsoft.sqlserver.jdbc.sqlserverdriver"); connection connection = drivermanager .getconnection("jdbc:sqlserver://localhost;databasename=testdb; integratedsecurity=true;"); //adding port 1433 doesn't make difference system.out.println("connection successful"); statement st = connection.createstatement(); resultset rs = st.executequery("select * testtable"); while (rs.next()) { line = rs.getstring(2); } } catch (exception e) { e.printstacktrace(); } } } when i'm running within eclipse, everything's fine. datab

Maven 'Missing artifact -

my local rpository has cxf-bundle-2.7.5.jar(download search.maven.org myself) , pom eclipse still error 'missing artifact org.apache.cxf:cxf-bundle:bundle:2.7.5' , when update project repository make file cxf-bundle-2.7.5.bundle.lastupdated everytime. how fix problem , why. <dependency> <groupid>org.apache.cxf</groupid> <artifactid>cxf-bundle</artifactid> <version>2.7.5</version> <type>bundle</type> </dependency> thanks!!! the simple answer bundle not bundle in meaning of type. if take @ search.maven.org see there jar, source, javadoc available need change dependency definition following: <dependency> <groupid>org.apache.cxf</groupid> <artifactid>cxf-bundle</artifactid> <version>2.7.5</version> </dependency>

Rails: Display user's liked post & own their posts on the same page -

i'm new rails & i've been stuck on problem hours. trying display posts user has liked , user's actual posts. with current code, i'm getting error "undefined method `title' #" , it's being extracted line: "<%= link_to post.title, post %>". coud shed light how can work? (more code below) def show @user = user.find_by_username(params[:id]) if @user @posts = @user.posts.all + @user.likes.all render actions: :show @likes = @user.likes.all else render file: 'public/404', status: 404, formats: [:html] end end here's routes file: resources :likes, only: [:create, :destroy] resources :posts devise_scope :user 'register', to: 'devise/registrations#new' 'edit', to: 'devise/registrations#edit' 'login', to: 'devise/sessions#new' 'logout', to: 'devise/sessions#destroy' end here's 'show' view: <% if @posts %>

user interface - Dynamically Generating Content Supporting The JQuery Mobile Theme -

i'm trying generate header heading text, jquery mobile theme isn't supported in dynamically content that's added. same result occurs when else added button, input textbox, etc: etc: there anyway fix this? here's fiddle - http://jsfiddle.net/fabc7/ here's code : <!doctype html> <html> <head> <title>website title</title> <meta name='description' content="describe website here..."> <meta http-equiv='content-type' charset='utf-8' content='text/html;charset=iso-8859-1'> <meta name='keywords' content='words, describing, your, website'> <link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.1/jquery.mobile-1.3.1.min.css"> <script src="http://code.jquery.com/jquery-1.9.1.min.js"></script> <script src="http://code.jquery.com/mobile/1.3.1/jquery.mobile-1.3.1.min.js"></script> <style

hibernate - Spring JPA loads all associated properties despite marking them as FetchType.LAZY in entity class -

i using jpa + hibernate. following entity class: @entity @table(name = "test_details") public class testdetailsentity implements serializable { private static final long serialversionuid = 0007l; @id @generatedvalue(strategy = generationtype.identity) @column(insertable = true, nullable = false, unique = true, updatable = true) private integer id; @column(name = "login_name", nullable = false, length = 100) private string loginname; @column(name = "login_pwd", nullable = false, length = 100) private string loginpwd; @manytoone(fetch = fetchtype.lazy) @joincolumn(name = "supplier_code", referencedcolumnname = "supplier_code") @foreignkey(name = "fk_test_details_supplier_code") private supplierentity supplierentity; @manytoone(fetch = fetchtype.lazy) @joincolumn(name = "component_id1", referencedcolumnname="component_id1", insertable = f

ruby - How can I simplify or clean up this anagram method? -

i have method here takes array of strings , groups ones anagrams of each other together, each group forming sub-array of main anagram_groups array. the output fine feel code overly-complicated. how logic and/or syntax simplified, short of refactoring things more methods? def combine_anagrams(words) anagram_groups = [] # each word in array argument words.each |word| # tracking variable word word_added = false anagram_groups.each |group| # check if word exists (prevents duplicates) if group.include? word word_added = true # add word group if anagram of first string in group elsif word.downcase.chars.sort == group[0].downcase.chars.sort group << word word_added = true end end # if word not anagram of anything, create new group (subarray) unless word_added anagram_groups << [word] word_added = true end end return anagram_groups end this array of words t

cordova - Will the app developed in Android will still be able to be automatically converted to IOS? -

i developing phonegap app in need background operations when app closed. edited - background operation :: perform pull operation @ regular interval external server, update database , later show in notification . for searched , found there ways 1> https://github.com/chrlipp/smsreceiver-phonegap 2> creating android service phonegap? (have phonegap app run when closed) but involve using android services. so question if use approach final app still ready convertible ios or other platform.

android - why editText make program stopped if didn't input anything -

i new. have 2 edittext , 1 textview, 1 button. want sum 2 input. success if input edittext. if didn't input, aplication stopped. package panda.c; import android.app.activity; import android.os.bundle; import android.view.view; import android.view.view.onclicklistener; import android.widget.button; import android.widget.edittext; public class calculate extends activity implements onclicklistener { /** called when activity first created. */ edittext input1,input2; button sum; textview total; public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.calcu); input1 = (edittext) findviewbyid(r.id.input1); input2 = (edittext) findviewbyid(r.id.input2); total = (edittext) findviewbyid(r.id.total); sum = (button) findviewbyid(r.id.sum); sum.setonclicklistener(this); } public void onclick(view v) { int inputt1 = integer.parseint(input1.gettext().tostring()); int inputt2 = integer.parseint(input2.gettext().tostring()); sw

mod proxy html - mod_proxy_html and AJAX Response -

i using mod_proxy_html , ajax response wrapped inside html <html> <body> <p>ajax response</p> </body> </html> this done mod_proxy_html , want avoid happening. in general mod_proxy_html supposed act on responses content-type set text/html or application/xhtml+xml: maybe can change ajax response's content type?

sql query to find missing records -

i using transaction table called student_details contain batch_no, pf_no, emp_name,dob, dor , doj along other details. there master table called batch_master contains batch_no, from_date, to_date , due_date. want details of staff due date within enter_date1 , enter_date2 fall due within period , such of staff due_date earlier enter_date1 still not come (i.e there no record same person doj after due_date.) please in designing query in ms-access you should @ sql clause. think beneficial trying achieve. used in these types of conditional statements if true (or false depending on situation) return this. for example: select * <location> due_date > enter_date1 , due_date < enter_date2. however confused on statement: "such of staff due_date earlier enter_date1 still not come (i.e there no record same person doj after due_date" to me sounds want return every less enter_date2, want ensure there unique records return... or assume.

java - how to add fixed floating overlay image to google Map in Android -

i'm trying add image overlay stays @ center of map when move , location of map. tried used marker stayed @ specific location , same groundoverlay. want image stay in centre of map view. have few ideas on how i'm trying best solution. 1 of idea use relative layout , overlay image on top of mapview think may cause problems. let me what's best way it. framelayout containing both supportmapfragment (or mapview ) , imageview . simplest solutions best.

How to build my menu for android devices -

i'm working on game menu android , i'm stuck apply layout devices screen size. do have size layout in dp or weight ? i'am aware of doing many layout in layout-large, layout-small... , drawable-hdpi, drawable-ldpi ... i'm still stuck. how it? you can find skeleton of want : http://imageshack.us/photo/my-images/14/menuskeleton.jpg/ thank ! on page of google developers, has description of how develop different screen sizes. http://developer.android.com/guide/practices/screens_support.html and page answer question size of layout, between dp or weight. http://developer.android.com/training/multiscreen/screendensities.html see this also. http://developer.android.com/training/multiscreen/index.html

javascript - Unable to parse json response in Sencha application -

Image
i want learn how develop mobile application. started using sencha framework. i downloaded sample application here . when run localhost application, don't see list view. i don't modified code. copy folder , run in browser localhost... i expected from: http://jbk404.site50.net/sencha/datahandling/ what received (a warning in chrome): large picture and head structure of index.html file: <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>sample test</title> <link href="resources/css/sencha-touch.css" rel="stylesheet" type="text/css" /> <script src="sencha-touch-all-debug.js" type="text/javascript"></script> <script src="app/app.js"></script> </head> where mistake ? i think problem example using older version of sencha touch. if change json file this structure work

jersey - How to approach the dispatching of open sockets to threads in Java? -

we need create listeningdispatcher accepts connections on port p n clients (for local, identified port, address later). approach put .accept() call, retrieve socket, start new thread , let handle message socket. if have n clients in our distributed system (broadcast based, logical token ring), keep n threads, n sockets. my mate arguing keep many threads open , it's better start new thread on every new connection instead of keeping thread running, closing socket , stop thread after message recieved. way, use less threads have create new socket every message. i think degrade communication because takes time open new socket. consider system must scalable , has heavy communication part, because every event broadcasted every client. note: can't use threadpools my approach put .accept() call, retrieve socket, start new thread , let handle message socket. don't start new thread. use thread pool , reuse threads. this way, use less thread have cre

php - Calculating Treversal Tree items level -

i have database has category names. columns id | categoryname | parentid . i'm using row_array() codeigniter model, , want add level key row array. have helper function recursively calculates category levels. wrote helper function in following code segment: function treegenerate($arrs, $parent_id=0, $level=0) { foreach($arrs $arr){ if($arr["categoryparent"]!=0){ $level+=1; } $arr["level"] = $level; treegenerate($arrs,$arr["categoryparent"],$level); } return $arrs; } but gives error: "allowed memory size of 33554432 bytes exhausted (tried allocate 523800 bytes)". how can fix problem? just thoughts without knowing code: is possible add level keys starting trunk? might save repetition. can move foreach outside of treegenerate? like: function treegenerate($arr,$level=0) { if($arr["categoryparent"]!=0){ $level +=1; } else

c++ - Changing reference for one object and it changes for all in the collection -

i have created class person member of class account , there class bank contains vector of accounts . i have created 1 person ownes 3 accounts wanted changeonwner() of 1 account accidentally accounts new owner. code running , rather intuitive. i not understand why reference in 3 accounts has changed. how fix that? #include <iostream> #include <vector> using namespace std; class person{ public: char* name; int age; person(char* name, int age){ this->name = name; this->age = age; } ~person(){ } void show(){ cout<<name<<" "<<age<<" yo"; } }; class account{ public: person& owner; double money; account(person* owner, double money): owner(*owner) , // this->owner = *owner; money(money) { //uninitialized reference member } void show(){ cout<<"\n-------------\n"; owner.show();

unable to install joomla 3.1 with php 6 -

i tried unable solve error , issue joomla not sure why have made things complicated without explaining much. using appserv php 6.0.0 , joomla's new version 3.1. have extracted whole zip in www root directory every time when check web url takes me http: // localhost/installation/index.php and error shows fatal error: interface 'jsonserializable' not found in c:\appserv\www\eshaheen\libraries\joomla\registry\registry.php on line 22 i searched on google did not find answer opened registry.php file , added explicitely import import('compat.jsonserializable') doing above error gone blank... kindly guide me how install joomla... regards you using outdated software. php6 development closed , never released. actual version of php 5.4. use other web server solution stack package of lamp . example: xampp