Posts

spring - What is the best way to do BULK INSERT using Java? -

i'm trying make app can save lot of structured objects in database. using spring data jpa (with hibernate + mysql (myisam tables + foreign keys)) write code data services easy , pleasant using spring data repositories performance slow. for example, tried insert 100 records in 1 table , takes 8,5 sec. i've try same insert operations straight in mysql cmd (using hardcoded "insert strings" in procedure) , shows me time - 0,85 sec. such result me slow, problem of mysql reading forum have found post says spring data jpa can't bulk insert properly. how can make app more faster? want use bulk insert operations size 1000 or more. the situation complicated fact can't store object db in 1 bulk (despite size of bulk) to make clearer: the objectgame contains list of objectround objectgame contains list of objectgameplayer objectround contains list of objectroundcard objectgameplayer contains list of objectplayercard objectgameplayer contains list of o...

android - Load a video from gallery into VideoView -

what want same images. when user clicks on button (in case videoview itself) want let them open gallery , load video videoview. vv_video = (videoview) findviewbyid(r.id.vv_video); vv_video.setontouchlistener(new view.ontouchlistener() { @override public boolean ontouch(view v, motionevent event) { intent intent = new intent(); intent.settype("video/*"); intent.setaction(intent.action_get_content); startactivityforresult(intent.createchooser(intent, "complete action using"), load_video); return false; } }); @override public void onactivityresult(int requestcode, int resultcode, intent data) { if (resultcode != result_ok) return; switch (requestcode) { case load_video: toast.maketext(newbucketactivity.this, "test", toast.length_short).show(); //this appears! ...

Android, Google maps and changing "required" in uses-permission -

i have code in app uses google maps: <uses-permission android:name="com.example.app.permission.maps_receive" /> <uses-permission android:name="com.google.android.providers.gsf.permission.read_gservices" /> <uses-permission android:name="android.permission.access_coarse_location" /> <uses-permission android:name="android.permission.access_fine_location" /> <uses-feature android:glesversion="0x00020000" android:required="true" /> i have started wonder though, if set these required="false" app presumbly generated shorter "requires" list when users download app... there reason not set them not required? currently when loading maps private void setupmapgoogleifneeded() { if (mmapgoogle == null) { mfragmentmanager = getsupportfragmentmanager(); msupportmapfragment = (supportmapfragment) mfragmentmanager.findfragmentbyid(r.id.mapfr...

Android Google Map V2 - Find my location error -

i'm trying retrieve device's location faced several problems: my logcat: 07-21 22:23:34.072: e/androidruntime(11634): fatal exception: main 07-21 22:23:34.072: e/androidruntime(11634): java.lang.runtimeexception: unable start activity componentinfo{com.test.projecttest/com.test.projecttest.mainactivity}: java.lang.nullpointerexception 07-21 22:23:34.072: e/androidruntime(11634): @ android.app.activitythread.performlaunchactivity(activitythread.java:2081) 07-21 22:23:34.072: e/androidruntime(11634): @ android.app.activitythread.handlelaunchactivity(activitythread.java:2106) 07-21 22:23:34.072: e/androidruntime(11634): @ android.app.activitythread.access$700(activitythread.java:134) 07-21 22:23:34.072: e/androidruntime(11634): @ android.app.activitythread$h.handlemessage(activitythread.java:1217) 07-21 22:23:34.072: e/androidruntime(11634): @ android.os.handler.dispatchmessage(handler.java:99) 07-21 22:23:34.072: e/androidruntime(11634): @ android.os.loo...

Linux Git repository and TortoiseGIT -

i've browsed web find solution found many variants none of solves problem. i'm starting use git , want have main repository on linux server work locally on windows. have created repository in root of website using git init : cd /var/www git init then i've successfuly added files , committed them. have history displayed in logs: commit eac728dc06731788e6f39e5ed2a819aa7f0fae1e author: max <my_email@gmail.com> date: sun jul 21 15:06:56 2013 +0400 now want able clone repository windows. want use tortoisegit purpose. i've read need create .ssh keys on linux , copy them windows. i've generated them using ssh-keygen -t rsa -c "my_email@example.com" on linux , copied c:\documents , settings\user on windows. other article says have put them gitosis-admin/keydir - don't know is. first question is do need copy keys generated on linux windows? if so, folder should place them at? when open tortoisegit asks url git repository. i'm access...

Django object.id does not match with the objects used in reverse url look up -

Image
i have model "listing" represents companies, model "lead" represents different projects can assigned companies. associated via many many relationship since company can assigned many leads many leads can associated many other companies. models listed below. leads displayed in listing admin page inline elements. there snippet used display link directly lead edit page of object done through reverse url. problem object.id argument wrong not corresponding leads id other number. in image above lead id shown "53".but in reality 78. pointers may missing appreciated. #admin.py def url_to_edit_object(self,object): #info = (object._meta.app_label, object._meta.module_name) admin_url = reverse('admin:dirapp_lead_change', args=(object.id,)) return u'<a href="%s">edit</a>' %(admin_url) lead model: class lead(models.model): slug = models.slugfiel...

asp.net mvc - SignalR - Calling Hub class method (present in a separate MVC project) from Server side code -

i have read signalr tutorials. in order implement signalr in existing asp.net solution application did following: i have created separate mvc 4 project , created hub class along methods, can called other mvc project/client present in existing solution, means use service. but have 2 questions: how can call other mvc project. same way mentioned in tutorials, example adding necessary script files in head of .cshtml page , using js script following: var hub = $.connection.; //and hub.server.send("some args"); i want call hub code directly server side code. did before when using supersocket. same approach using signalr. how can ? if answer, kindly please give code sample(s). many thanks. there sample code calling client methods outside hub class (but within application) here . basically, use connectionmanager call hub's clients. var context = globalhost.connectionmanager.gethubcontext<myhub>(); context.clients.all.myclientmethod(myvalue); ...