Posts

Showing posts from April, 2015

android - Delphi XE5 TLocationServices on Samsung Galaxy 2 not using GPS -

i have simple app should return current gps location, code below, based on tutorial provided embarcadero. when executed, gps icon of samsung not display , location returned 100m off true location. i've experimented various valued 'accuracy' , tried setting 'accuracy' both before , after setting object active - no change in behaviour. other apps i've obtained, including 'maps' comes galaxy, show gps icon when in use , return correct positioning. with gps icon not display, i'm assuming app not using gps - how instruct so? (fine location permissioned) procedure theaderfooterform.formcreate(sender: tobject); begin locationsensor1.active := true; locationsensor1.optimize := true; locationsensor1.accuracy := 100000; locationsensor1.distance := 0; end; procedure theaderfooterform.locationsensor1locationchanged(sender: tobject; const oldlocation, newlocation: tlocationcoord2d); var urlstring: string; urlloadfile: tstr

javascript - Html5 video trigger "ended" event when no internet connection -

i using tag on android webview. code: <div class="video-wrapper"> <video id="video" class="video-full-screen" preload="none" webkit-playsinline poster={poster url here}> <source id="mp4" src="{video source here}" type="video/mp4"> <p>your user agent not support html5 video element.</p> </video> </div> i register following video events: var video = $('video'); video.bind("canplay", function(){ console.log("canplay"); }); video.bind("playing", function(){ console.log("playing"); }); video.bind("waiting", function(){ console.log("waiting"); }); video.bind("ended", function(){ console.log("ended"); }); video.bind("canplay", function(){ console.log("canplay"); }); when disconnect internet before pressing video's

java - android beanutil.copyproperties not working in dalvik -

i´ve been trying add apache bean utils android project in order use beanutil.copyproperties . adding through gradle easy , project compile straight forward. i´ve realised once make call beanutils.copyproperties in runtime, seems dalvik not have same java.beans jdk crash immediately. are there way solve these issues java.bean classes? there alternatives beanutils.copyproperties ? thanks

configure seam 2.2 entitymanager to work on websphere 7 -

i create jboss seam 2.2 application using seam-gen tool (ear file) application works fine on jboss 4.3, i managed run application on websphere 7 after modifying jars per documents available on seam reference docs, the problem: tried many ways configure persistence connect database, didn't work. correct way have application connect db (oracle) created working data-srouce inside websphere 7 i'm not sure correct configuration inside (components.xml) , (persistence.xml) thanks in advance 1- persistence.xml <?xml version="1.0" encoding="utf-8"?> <!-- persistence deployment descriptor prod profile --> <persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd" version="1.0"> &

javascript - Getting specific content from page to be inserted to bootstrap 3 modal via ajax -

i trying pull specific content page bootstrap 3 modal via ajax can pull in whole page. here jquery code: function winemap() { var wh = $(window).height(); var hh = $('#masthead').height(); $('.wine-menu #mainstage').css({ height: wh-hh-80 }); $('#wine-map').vectormap({ map: 'world_en', backgroundcolor: '#000', color: '#ffffff', hoveropacity: 0.7, selectedcolor: '#666666', enablezoom: true, scalecolors: ['#ffffff', '#eeeeee'], normalizefunction: 'polynomial', onregionclick: function(element, code, region){ if (code == 'us') { var url = 'http://cb.dannycheeseman.me/wine-menu/'+code; } $('#themodal').modal({ show : true, remote: url }); } }); } $(document).ready(functio

javascript - How to include socket.io script in my HTML page? -

i trying use socket.io @ node.js having trouble setting up. i installed socket.io node module node by: npm install socket.io my node working , getting message info - socket.io started @ node start. socket @ node listens same port http server on node. problem setting client system. all tutorials have referred on internet work under assumption client file , node file (i.e. html file , node.js file) in same directory , include socket.io script in html by: <script src="/socket.io/socket.io.js"></script> but system setting have separate directories node , client namely nodejs , web (i using nginx websocket). socket.io node module inside node_modules directory under nodejs directory. how include socket.io script in client html? should copy socket.io node module files in web folder well?

spring - joining two tables with non-Primary key attributes using hibernate annotations -

i have table attributes a1(pk), a2, a3 i have table b attributes b1(pk), b2 , b3 now, need join table , b on basis of a3 = b3. can tell me how in hibernate annotations using join. problem how specify column of table mapped on column of table b in mapping file both column not primary keys. like this: b { @manytoone @joincolumn(name = "b3", referencedcolumnname = "a3") privte a; } you have specify in relationship columns joined. for vise versa: a { @onetomany @joincolumn(name = "a3", referencedcolumnname = "b3") privte list<b> blist; }

c# - How to change the preselection of suggested variable names in the Resharper intellisense -

when write variable indexfilerepository , hit ctrl+space resharper intellisense suggests me following options: filerepository, indexfilerepository, repository, filerepository, indexfilerepository, operator, repository and preselects last 1 - repository . how can make resharper preselect indexfilerepository automatically instead of repository e.g. in intellij idea? i'd avoid pressing up/down arrows time. note: continue typing ind or camel case ifr doesn't either: for indexfilerepository ind suggests: index, indexfile, indexfilerepository and indexfilerepository ifr suggests: iffilerepository, ifindexfilerepository, ifrepository, ifrfilerepository, ifrindexfilerepository, ifrrepository

java - Android R Cannot Be Resolved to Variable - Changing Package Name -

i've seen lot of threads discussing when r cannot resolved variable. tried solutions can found here: "r cannot resolved variable"? . none of them worked. think have found problem, don't know fix. my src package name seniordesign.mobileapp , package in gen contains r.java com.example.android.bluetoothchat this seems problem, how rename package in gen or otherwise point com.example.android.bluetoothchat in code? i using latest version of eclipse , both r.java , buildconfig.java can found in gen folder. in manifest.xml rename package @ manifest tag <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="old.package.name" android:versioncode="1" android:versionname="1.0" > to <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="new.package.name" android:versioncode="1" android:versionnam

c# - lightswitch cannot connect to created database visual studio 2013 -

everytime create new project (only on new project not happening project create on campus computer) add table , screen debug on desktop application show red x mark , "unable load data. please check network connection" , on visual studio: an exception of type 'system.data.entityexception' occurred in system.data.entity.dll not handled in user code additional information: underlying provider failed on connectionstring. on application1\application1\application1.server\generatedartifacts\applicationdataobjectcontext.cs public applicationdata(string connectionstring) : base(connectionstring, "applicationdata") { oncontextcreated(); } inside connectionstring is "metadata=res://application.server/applicationdata.csdl|res://application.server/applicationdata.ssdl|res://application.server/applicationdata.msl;provider=system.data.sqlclient;provider connection string=\"data source=(localdb)\\v11.0;atta

How to sort in Firebase with Multiple priority? -

i have data in firebase: mainnode pictures -jjr1pypnhbocjsif_0j user: user1 view: 20 -jjr1padfxtus_wctj2a user: user2 view: 500 users -user1 name: 'austin' -user2 name: 'bucha' and have 2 cases. get pictures of userx show pictures view i can desired result case#1 if run , setpriority userid new firebase("https://xxx.firebaseio.com/pictures") .startat('user1') .endat('user1') .once('value', show); however, lost when want all pictures sorted view limit 10 . since setpriority can used once, how can result case#2? please shed me light here better approach , in advance. for pictures of user x, store list (an index) of user's photos in separate location: /my_photos/$user_id/$photo_id/<true> /photos/$photo_id/<data> (with priority vi

sql - return id on mysql create if not exists query -

i have table: create table `table_listnames` ( `id` int(11) not null auto_increment, `name` varchar(255) not null, `address` varchar(255) not null, `tele` varchar(255) not null, primary key (`id`) ) engine=innodb; and query: insert table_listnames (name, address, tele) select * (select 'rupert', 'somewhere', '022') tmp not exists ( select name table_listnames name = 'rupert' ) limit 1; i query print out id of record inserted or or selected. ideas? thanks! you can last inserted autoincrement value last_inserted_id, see http://dev.mysql.com/doc/refman/5.5/en/information-functions.html#function_last-insert-id . it's idea check number of affected rows first. can execute query no matching row.

android - Tags in app & legal content -

i beginner in android , want ask u few questions: 1: there tag make app easier find in google market when searched ( meta tags in html) ? 2: i've created math application in native language. couldn't find on market other apps looks similar or in same language, found many others in english or other languages. is legal put app on google market ? i've searched on google developers didn't find this. if u can give me link google great. also, can put name on bottom of app? and last question have, way earn money free apps without using adds? thank in advance! for first question, can research on subject of google play seo: 10 tips on seo apps position in google play google i/o 2013 - getting discovered on google play but there's no "secret formula" of kind. also, remember "dumping" keywords in app page's description not permitted. as second question, don't see reason app not legal if coded yourself, isn't

internet explorer - IE (11) improper handling of CSS multi-columns? -

i'm building 2-column layout using css multi-columns, , want give hint break columns. so say: columns: 2 on container, , break-before: column on child want break. ie (11 in case) decides split content 3 columns , overflows right of box :-( chrome (using prefixed alternatives -webkit-columns:2 , -webkit-column-break-before: always ) behaves nicely. fiddle at: http://jsfiddle.net/jdecq/6/ am doing wrong here ? is misbehavior of ie ? any workaround suggestions ? as myself interested in question studied spec , examples of multi-column layouts. first have spec horribly "imprecise"! seems break definition has precedence on column-count value (though not find explicitly in spec or anywhere else). this happens if, according multi-column pseudo-algorithm , respective element, sets break point, part of last column (as in example fiddle). the example given @gcyrillus (see comments on question) works, because height setting forces algorithm firs

ios - Paging UICollectionView by cells, not screen -

i have uicollectionview horizontal scrolling , there 2 cells side-by-side per entire screen. need scrolling stop @ begining of cell. paging enabled, collection view scrolls whole page, 2 cells @ once, , stops. i need enable scrolling single cell, or scrolling multiple cells stopping @ edge of cell. i tried subclass uicollectionviewflowlayout , implement method targetcontentoffsetforproposedcontentoffset , far able break collection view , stopped scrolling. there easier way achieve , how, or need implement methods of uicollectionviewflowlayout subclass? thanks. ok, found solution here: targetcontentoffsetforproposedcontentoffset:withscrollingvelocity without subclassing uicollectionviewflowlayout i should have searched targetcontentoffsetforproposedcontentoffset in begining.

How can I know when an instance variable raise a event in java? -

i have created class create userinterface of program, program has instance of userinterface . the useriterface class has listeners, problem need know program main class when instance variable used create user interface raises events example tree valuechanged. this userinterface class: import java.awt.eventqueue; import javax.swing.jfilechooser; import javax.swing.jframe; import javax.swing.jmenubar; import javax.swing.jmenuitem; import javax.swing.jtoolbar; import java.awt.borderlayout; import javax.swing.jbutton; import javax.swing.jtree; import javax.swing.jsplitpane; import javax.swing.jpanel; import javax.swing.event.treeselectionevent; import javax.swing.event.treeselectionlistener; import javax.swing.filechooser.filenameextensionfilter; import javax.swing.tree.defaulttreemodel; import javax.swing.tree.defaultmutabletreenode; import javax.swing.tree.treeselectionmodel; import org.eclipse.swt.widge

Can I use Android Studio when teammates uses Eclipse ADT? -

just quick question did not find answer on. working on app created eclipse adt bundle . started exploring android studio , , it. possible still collaborate mates using eclipse shared github repo? i noticed android studio converts project own file structure, guess not go eclipse, , repo. is there solutions this? can keep developing in android studio, push github, while rest of team use eclipse? i think can it, you'll have explicitly define sourceset matches eclipse structure. if use other build variants, can't have sourcesets because wouldn't able check files in source control. however, there several useful things can build variants build file. think can check in build.gradle , other gradle stuff , won't mess coworkers.

To check if a number is Armstrong number using java -

this program: public class armstrongnumber { public static void main(string args[]) { int n = 0, temp = 0, r = 0, s = 0; scanner in = new scanner(system.in); system.out.println("enter number "); if (in.hasnextint()) { n = in.nextint(); // if there number } else { n = 0; } temp = n; while (n != 0) { r = n % 10; s = s + (r * r * r); n = n / 10; } if (temp == s) { system.out.println(n + " armstrong number"); } else { system.out.println(n + " not armstrong number"); } } } output: exception in thread "main" java.lang.noclassdeffounderror i tried using datainputstream still getting same error. you need set class_path variable , point ever class file is then should work i have tried locally, refer my answer check how set class path ,

php - Laravel - extending a ResourceController -

i have 2 different forms should use 1 controller. created controller resource controller using following method in routes.php: route::resource('account', 'accountcontroller'); in first form use {{ form::model($user, array('route' => array('account.update', $user->id), 'method' => 'put', 'class' => 'form-outside', 'files' => true)) }} as resource controller knows update function works well. however want create second form, relates account , updates other sections of user's profile. want extend controller function "updatesettings." but how can that? created function in accountcontroller , use following in second form: {{ form::model($user, array('action' => array('accountcontroller@updatesettings', $user->id), 'method' => 'put', 'class' => 'form-outside')) }} but laravel fires exception route [accountcont

swing - Java JButton sizing issue -

people. started working on simple games advance in knowledge of swing. needed use jbuttons 1 of projects, did. here's problem ... when opened window, instead of seeing normal screen loaded images, whole screen last button added frame. tried using setsize() function button still super large , filled screen. code: import javax.swing.jpanel; import javax.swing.borderfactory; import java.awt.color; import java.awt.dimension; import java.awt.graphics; import javax.swing.swingutilities; import javax.swing.jframe; import java.awt.image; import java.io.*; import java.net.url; import javax.imageio.*; import java.awt.image.*; import java.awt.font; import java.awt.*; import java.awt.event.*; import javax.swing.*; public class engine { public static int chips = 5000; public static string c = chips+""; public static void main(string[] args) { swingutilities.invokelater(new runnable() { public void run() { gui();

java - How to retrieve audited register with relationship @ManyToOne using Hibernate Envers -

Image
i´m doubt using hibernate envers , class. i have class loja . @entity @audited @genericgenerator(name = "sequence_generic", strategy = "com.paradigma.ecred.dao.hibernate.generator.manualgenerator") // sequence generic criado para atividade 510 @selectbeforeupdate @dynamicupdate public class loja extends persistent { @trim @notblank(message = "o preenchimento campo \"cnpj\" é obrigatório.") @cnpj(message = "o \"cnpj da loja\" é inválido") private string cnpj; @trim @notblank(message = "o preenchimento campo \"razão social\" é obrigatório.") @size(max = 255, message = "a razão social deve conter no máximo {max} caracteres.") private string razaosocial; @manytoone(cascade=cascadetype.all) @joincolumn(name="idlojamaster", referencedcolumnname = "id", columndefinition="integer") private loja lojamaster; @many

sql - Subquery used as expression doesn't work -

i have theses 3 tables created in postgres: create table info_clients(id_client int(pk),name varchar(20), last_name varchar(20)); create table customer_request(id_request int(pk),client int(fk),product int(fk)); create table info_products(id_producto int(pk),description varchar(20),price int); and have next query: show id's of clientes bought 10 expensive items (using subquery): select id_client info_clients id_cliente=( select client customer_request product=( select id_product info_products order price desc limit 10 ) ); but keep getting message_ subquery used expression returned more 1 register, don't know doing wrong. what @kordirko commented . plus, joins faster , better in every respect (nested) in expressions. select i.id_client ( select id_product info_products ord

ios - How to hide UIPickerView when placed in nib file -

i choose picker view here . working great. when app runs shows up. however, want shown when textfield tapped , before want hidden. country picker subclass of uipickerview , placed inside nib file. please help. you should follow next steps:      1. create iboutlet properties in owner class (do not forget add uitextfielddelegate in header file): @property (weak, nonatomic) iboutlet countrypicker *mypickerview; @property (weak, nonatomic) iboutlet uitextfield *mytextfield;      2. connect iboutlets pickerview, textfield in xib. , in viewdidload method add: self.mytextfield.delegate = self; since should implement uitextfield delegate methods. uitextfield protocol reference - (void)textfielddidbeginediting:(uitextfield *)textfield { self.mypickerview.hidden = no; } this method notifies delegate specified text field became first responder. can use method update delegate’s state information. example, might use method show overlay views should v

java - R cannot be resolved to a variable on CastCompanionLibrary in Eclipse -

i want use castcomponaionlibrary i'm using eclipse , not android studio. created new project , copied castcompanionlibrary sources it. added references to: android-support-v4 android-support-v7-appcompat android-support-v7-mediarouter google-play-services_lib in new project these compilation errors: r cannot resolved variable minicontroller.java /castcompanionlibrary-android-master/src/com/google/sample/castcompanionlibrary/widgets line 87 java problem it indirectly referenced required .class files videocastcontrolleractivity.java ideas? you need import android-support-v7-gridlayout existing project , add to: preferences->android->add. also ...-mediarouter must linked ...-appcompat in order work properly. once cleaned .xml files (i mean no errors @ all) can clean , should trick. and don't need v4 long make use of v7 (everything included in newer version). reference: http://blog.burnayev.com/2009/11/android-developer-tip-regenerating.html

syntax error - unexpected t_variable php -

i have written simple php file on openshift. started simple operation (sql) , got following error: [sun apr 06 11:59:35 2014] [error] [client 127.2.31.1] php parse error: syntax error, unexpected t_variable in /var/lib/openshift/53413f4a500446a9c8000172/app-root/runtime/repo/test.php on line 15 here code: <html> <head> </head> <body> <?php echo 'start'; try{ $dbh=new pdo("mysql:host=$_env{'openshift_mysql_db_host'};dbname=$_env{'openshift_app_name'}",$_env{'openshift_mysql_db_username'},$_env{'openshift_mysql_db_password'}) or die('cannot connect db');//open mysql database connection $dbh->setattribute(pdo::attr_errmode,pdo::errmode_exception); $sth=$dbh->prepare('select * from fs where filename<>? and desc<>?'); $sth->execute(array('','')); $result=$sth->fetchall(pdo::fetch_assoc); print_

c++ - Am I actually storing the object in the cpu register here? -

this question has answer here: why std::cout convert volatile pointers bool? 4 answers here in program using volatile register object, storing object register here? why getting address of object 1 ? please share thought on this. #include <iostream> using namespace std; class a{ int i,j,k[999]; long double arr[9999999]; public: a(){ i=77; j=89; cout<<"\nctor\n"; } void disp()volatile { cout<<"\ni = "<<i<<" j = "<<j<<"\n"; // delete this; } ~a(){ cout<<"\ndtor\n"; } }; int main(){ register volatile *ao = new a; cout<<"address of = "<<ao; //out puts "1" me; (my processor core i3 330m). ao->disp();

dart - AngularDart Element onResize event not linked to window -

i'm working on responsive, full-width layout , need element processing when size changes. has not linked window, size can change without window size being modified e.g. changing number of columns. i'm working angulardart directives , components , nice have directive say, "resizable" implements such event element. i've come across attributechanged() method in dart element class don't know how tap without creating custom elements.

ios - How to pass the in-place edited content back to the previous tableview controller (update the model) -

i have 2 table views, 1 called maintableviewcontroller (mtvc), other called detailtableviewcontroller (dtvc). it's typical click accessory button on main tableview cell bring detail tableview kinda thing. in prepareforsegue method, data passed main tableview detail tableview nsmutablearray called item. and how got displayed: cell.detailtextlabel.text = self.item[indexpath.row]; the cool thing managed in-place editing on detail table view cell (overwrote nstableviewcell, added uitextfield subview each cell). everything works, last thing spent whole day cannot figure out how update nsmutablearray item after in-place editing taken place, ultimate goal in-place editing, , main tableview data shall reflect change. i tried use delegation , protocol not work (the in-place edited content didn't got passed back, part of reason don't know how capture edited content, it's not it's text field name, can't updatedcontent = self.mytextfield.text grab change) i&

input - JSF - typing with regional language -

i created web application using jsf framework. application needs text areas convert content regional language. how possible done using google input?. or there other scenario typing regional language? use unicode.js small , easy use javascript library enable native input support in textfields. uses google transliteration api combined javascript enable unicode support in text input fields , textareas or user can type in.

java me - How to stop one audio file when another is started (J2ME) -

i'm building j2me game , wonder [question]. for example, in menu there background music when start playing game, change different song. , need know how play sfx while playing background music also. please give me hints, suggestions etc. any appreciated :) sorry not-so-good english :)

wordpress - How do I remove woocommerce products after time? -

Image
im building webshop using woocommerce ( icondesignliving ) , customer wants products automatically removed after time. or after date, possible this, if yes, how? you can use plugin called post expirator . when add or edit product there post expirator box on right hand side, allow choose if product can hidden after date. choose date hidden on , happen product (draft, delete, set private, or change category):

sprite kit - How do you stop a particle effect? (SKEmitterNode) -

i have code in collide statement if collide object particle happens how stop it? goes on forever whereas want happen couple of times per contactetc skemitternode *emitter = [nskeyedunarchiver unarchiveobjectwithfile:[[nsbundle mainbundle] pathforresource:@"ff" oftype:@"sks"]]; emitter.zposition = 0; emitter.particlepositionrange = cgvectormake(0, self.size.height); emitter.position = cgpointmake(self.size.width, self.size.height/2); [self addchild:emitter]; when use particle-editor can set maximum number of particles create. it's field below "particle texture".the official description is: "the maximum number of particles emitter creates on emitter’s lifetime. after number reached, no more particles created emitter. enter 0 remove particle limits." also see: particle emitter editor guide of course, should remove emitter-node parent after created maximum number of particles. can done creating action-sequence waits few

bash - Problems in mapping indices using awk -

hi have data files file1 1 hero 2 chainsaw , gang 3 ......... 4 ......... where first field id , second field product name file 2 the hero 12 hero 2 chainsaw , gang 2 ....................... from these 2 files want have third file file 3 the hero 12 1 hero 2 1 chainsaw , gang 2 2 ....................... as can see adding indices reading file 1 i used method awk -f '\t' 'nr == fnr{a[$2]=$1; next}; {print $0, a[$1]}' file1 file2 > file 3 where creating associated array using file 1 , doing lookup using product names file 2 however files huge, have 20 million product names , process taking lot of time. suggestions, how can speed up? you can use awk: awk 'fnr==nr{p=$1; $1=""; sub(/^ +/, ""); a[$0]=p;next} {q=$nf; $nf=""; sub(/ +$/, "")} ($0 in a) {print $0, q, a[$0]}' f1 f2 hero 12 1 hero 2 1 chainsaw , gang 2 2

Django-pagination breaks my order_by -

in html-template load list of objects , i'm trying combine django-pagination (from docs) , order_by method. i tried put ordering-links loads href="/mylist/?order_by=somefield it works on first page. order seems break when i'm clicking "next page". what's problem here? "next page" link loads href="mylist/?page={{ results.next_page_number }} view: def mylist(request): order_by = request.get.get('order_by', 'somedefault') myobjects_list = mymodel.objects.filter(user=request.user).order_by(order_by) paginator = paginator(myobjects_list, 5) page = request.get.get('page') try: results = paginator.page(page) except pagenotaninteger: results = paginator.page(1) except emptypage: results = paginator.page(paginator.num_pages) context = {'results ': results } return render_to_response('myli

swing - Java - Two Codes Comparison with GridBagLayout - IllegalArgumentException -

i tested code gridbaglayout, wonder why there's error code isn't code. code got exception illegalargumentexception: cannot add layout: constraint must string (or null) : import java.awt.*; import javax.swing.*; import java.awt.event.*; public class layout extends jframe { gridbag g=new gridbag(); public layout() { add(g, borderlayout.center); } public static void main(string[]args) { layout lay=new layout(); lay.setsize(500, 500); lay.setdefaultcloseoperation(jframe.exit_on_close); lay.setlocationrelativeto(null); lay.setvisible(true); } class gridbag extends jpanel { private jlabel label=new jlabel("test"); public gridbag() { setlayout(new gridbaglayout()); gridbagconstraints gbc=new gridbagconstraints(); container container=getcontentpane(); addc(label, container, gbc, 0, 0, 1,