Posts

Showing posts from June, 2013

endianness - Little-endian support in Netty 4 -

the new & noteworthy docs netty 4 state support little-endian -ness has changed significantly, going on show use of bytebuf.order() . whilst that's useful localised use within channel handlers, whole downstream pipeline use little-endian buffers. the upstream handler lengthfieldbasedframedecoder takes constructor argument byte order, downstream handler lengthfieldprepender not. appears support configuration-driven replacement of buffer factories has gone netty 4, how should arrive @ complete little-endian downstream pipeline? i did this, though feels awfully hacky: https://gist.github.com/thomaslee/7871444 if wire in pipeline after lengthfieldprepender run, rewrite (big endian) length field using little endian byte ordering. probably more efficient write length in little endian after measuring length of in & dropping lengthfieldprepender entirely rather adding step pipeline code has been lazily copied & can attest working. :) i love know if ...

how to call a function of javascript in jsp without any event -

how can call javascript function without event. have session variable namely x. need call javascript function demo() if session variable not null. <% if((string)session.getattribute("x")!=null) { %> <script type="text/javascript"> demo(); </script> <% } %> let me know right way of calling demo function. if understand correctly, use onload event. at http://www.javascriptkit.com/javatutors/event3.shtml window.onload vs <body onload=""/>

node.js - Mongoose removes too many from ID -

i may misunderstanding something, on client have request sent server. like: $.post("/resources/remove", {"id": 52024e25b26d39f931000003}) on server have resource.remove({_id: request.body.id}) the "id" correct , using resource.find same arguments returns record want remove. however, when run removes all resource records. return value of exec(function (err, returnvalue) number of resource records there, removing of them. using remove.(request.body.id) same thing. do need else make sure record corresponding _id removed? if entry invalid why removing all records? try using resource.findoneandremove reference i've never used use , works me postmodel.findone({_id: id}, function (err, result) { if (err) { throw err; } if (result) { postmodel.remove({_id: id}, function (err, result) { if (err) { throw err; } res.json(200, result); }...

android - YouTubePlayerSupportFragment fullscreen button forces orientation change and does not enter fullscreen -

i creating youtubeplayersupportfragment . playing in portrait mode works fine. click fullscreen button of player forces orientation change , recreates activity in (the video stops playing , fragment recreated). this how create fragment: fragment = (youtubeplayersupportfragment) getsupportfragmentmanager().findfragmentbyid(r.id.youtube_fragment); fragment.initialize(config.youtube_api_key, this); the similar thing on stackoverflow find question: youtubeplayersupportfragment starts duplicate activity this guy has same problem no answer far. i had same issue , apparently it's defined behaviour. can disable (for example in oninitializationsucces): @override public void oninitializationsuccess(provider provider, youtubeplayer player, boolean success) { player.setfullscreencontrolflags(0); more info here .

html - How can I align an image with css -

i have code: jsfiddle <div id="picture1"> <a href="http://www.google.com" target="_blank"><img src="http://farm4.staticflickr.com/ 3780/9455263123_9150ae4a6e_o.png" /></a> </div> <div id="picture2"> <a href="http://www.google.com" target="_blank"><img src="http://farm6.staticflickr.com/ 5483/9458043690_5bce524ccf_o.png" /></a> </div> and css #picture1 { top:-10px; left: 190px; right: auto; float:right; } #picture2 { top:-10px; left: 50px; right: auto; float:left; } img { position:relative; top:-10px; -webkit-transition: 0.5s; -moz-transition: 0.5s; -ms-transition: 0.5s; -o-transition: 0.5s; transition: 0.5s; } i want images stay side side, overlapping. web site example how can this? want insert images , place them designed in background. ...

Meteor: Disallow user from selecting id's when inserting documents -

when using mini-mongo insert documents collection user pass _id field , _id set on document long string or objectid (and doesnt collide existing id). doesnt seem sensible me. want _id of documents generated server, always, dont end db both strings (potentially of different length) , objectids exist _ids. is there simple way achieve this? right best can think of checking id in deny rule (where _id either set meteor or value user provided) , if it's not type/length want change it, requires checks avoid duplicate ids. not difficult seems overly complex basic this. reviewing response, here's answer: deny inserts. create method , collectioninsert(document) , checks if _id field specified. meteor.methods({ collectioninsert: function(document) { if (document && document._id) { delete document._id; } // returns _id generated return collection.insert(document); } }); in today's versions of meteor (0.8 , higher) server , client ...

javascript redirecting mobile devices if referrer is not my domain -

for reasons long explain here, want use javascript redirect visitors index page mobile subdomain if devices using useragent. the issue have mobile site has "view full site" link sends index page. creates loop condition. here trying accomplish. if referring url not own domain and user agent matches, redirect mobile subdomain. i close missing something. if (document.referrer != "mydomain.com" && (navigator.useragent.match(/iphone/i)) || (navigator.useragent.match(/ipod/i)) || (navigator.useragent.match(/ipad/i)) || (navigator.useragent.match(/googlebot-mobile/i))); { location.replace("https://m.mydomain.com"); } your condition bit funny , have semicolon shouldnt. the referrer condition ignored since or'ed other conditions. put or's in brackets , should work. if (document.referrer != "mydomain.com" && ((navigat...

java - How to use Spring Data Repositories as Vaadin JPAContainer -

is possible use org.springframework.data.jpa.repository.jparepository repositories jpacontainer vaadin? we setting new vaadin 7 project scratch spring 3.2. the spring integration done spring vaadin integration addon . as far can entityprovider jparepository or somewhere else can use jpacontainer this: entitymanager entitymanager = getentitymanager(campaign.class)); mutablelocalentityprovider<campaign.class)> provider; provider = new cachingmutablelocalentityprovider<campaign.class)>(campaign.class), entitymanager); provider.settransactionshandledbyprovider(false); jpacontainer<campaign> container = new jpacontainer<campaign>(campaign.class); container.setentityprovider(entityproviderutil.get().getentityprovider(campaign.class)); or jsut simple entitymanager entitymanager = getentitymanager(campaign.class)); jpacontainer<campaign> container = jpacontainerfactory.make(campaign.class, entitymanager) well, should read following...

sap - Unable to access xsjs file from browser -

i new sap hana , trying expose .xsjs file data through webbrowser following url: hostname:80<instance#>/workspace/session/a00/data/services/retrievedata.xsjs however, getting following error when try access it: this link seems broken not find resource you're trying access. might misspelled or unavailable these files have created in project explorer: myschema.hdbschema schema_name="myschema" trendsdata.hdbtable table.schemaname = "myschema"; table.tabletype = columnstore; table.description = "newdataset order trendsdata"; table.columns = [ {name= "c"; sqltype = nvarchar; nullable = true; length=10; }, {name= "d"; sqltype = varchar; nullable = true; length=5; }, {name= "du"; sqltype = nvarchar; nullable = true; length=20; }, {name= "sa"; sqltype = decimal; nullable = true; length=...

apache2 - Trouble configuring apache server to proxy an SSL connection -

i'm running application on tomcat7 apache portable runtime, bought ssl certificate , configured correctly - when try connect through ip:port combination, connects fine warns me certificate issued domain name, not ip. the vps i'm on doesn't have selinux (and there's issue installing), afaik required have ssl configured in apache, want route requests tomcat, on end. i configured apache proxy connections, first port 80 works perfectly: namevirtualhost www.mysite.com:80 <virtualhost www.mysite.com:80> proxypreservehost on proxyrequests off servername http://www.mysite.com serveralias http://www.mysite.com proxypass / http://localhost:8180/mysite/ proxypassreverse / http://localhost:8180/mysite/ proxypassreversecookiepath /mysite/ / </virtualhost> and ssl port doesn't want work reason: namevirtualhost www.mysite.com:443 <virtualhost www.mysite.com:443> sslproxyengine on proxypreservehost on proxyrequests off ...

javascript - jQueryvmap with Bootstrap Popover Content -

i trying implement bootstrap popover in jqueryvmap region click event. jsfiddle default hello message :- http://jsfiddle.net/perlfanatic/kd6fm/6/ jsfiddle "message" variable :- http://jsfiddle.net/perlfanatic/kd6fm/7/ i trying implement this http://jsfiddle.net/perlfanatic/kd6fm/7/ i.e, message jqvmap on popover. reference : https://github.com/manifestinteractive/jqvmap#dynamic-updating can please me out. not javascript friendly user, don't use much, please kind on javascript noobbrain. <script type="text/javascript"> var message; jquery('#vmap').vectormap({ map: 'world_en', backgroundcolor: null, color: '#ffffff', hoveropacity: 0.7, selectedcolor: '#666666', enablezoom: true, showtooltip: false, values: sample_data, scalecolors: ['#c8eeff', '#006491'], normalizefunction: 'polynomial',onregioncli...

Getting complete educations from LinkedIn API -

i full educations data using linkedin api end-date , id fields can see. [education] => array ( [0] => simplexmlelement object ( [id] => 115254687 [end-date] => simplexmlelement object ( [year] => 2010 ) ) ) i asked r_fullprofile permissions. need additional permission? thanks. when use r_fullprofile member permission, access full profile fields of authenticated user. can retrieve basic profile fields of 1st degree connections of authenticated user explained in our connections api doc. there no member permissions allow access full profile fields of connections. restriction added protect data privacy of users.this issue not code, getting our linkedin apis allow. read following link understand more https...

javascript - touch events event delegation with jquery's .on() -

so have javascript code listens touch events on elements in document. document.addeventlistener("touchstart", touchhandler, true); document.addeventlistener("touchmove", touchhandler, true); document.addeventlistener("touchend", touchhandler, true); document.addeventlistener("touchcancel", touchhandler, true); that works fine except want listen events on items of class of datacard ( .datacard ) , of children not anchors <a> . so how thought fix through creating jquery selector, using jquery earlier in page, , calling .addeventlistener() on that. didn't work. this tried: $('.datacard, .datacard *:not(a)').addeventlistener("touchstart", touchhandler, true); $('.datacard, .datacard *:not(a)').addeventlistener("touchmove", touchhandler, true); $('.datacard, .datacard *:not(a)').addeventlistener("touchend", touchhandler, true); $('.datacard, .datacard *:not(a)').add...

symfony - FOSUserBundle validate email in controller -

i'm trying validate fields fosuserbundle in controller. i'm passing values ​​from request without using form (i'm using jquery plugin x-editable). far have tried way saves me email if invalid or empty: $userid = $request->get('pk'); $value = $request->get('value'); $em = $this->getdoctrine()->getmanager(); $user = $em->getrepository('acmeuserbundle:user')->find($userid); if (!$user) { throw $this->createnotfoundexception('unable find products entity.'); } $user->setemail($value); $validator = $this->container->get('validator'); $errors = $validator->validate($user, array('profile')); if (count($errors) > 0) { return new response(print_r($errors, true), 400); } $this->container->get('fos_user.user_manager')->updateuser($user); return new response('', 200); where doing wrong? ...

javascript - HTML 5 maze game - What to do after collision detection if the touch event continues? -

i working on maze game using html5 canvas , javascript (i prefer using jquery library coding). - the game mobile devices , totaly new using touch events on canvas, adding maze image - black , whit gif labyrinth. i going use trouch in order navigate through maze. here have done: add event listener touch: window.addeventlistener("touchmove", handlemove, false); added function handle move: function handlemove(e){ e.preventdefault(); // check touch position on canvas var checkx = event.targettouches[0].pagex - canvas.offsetleft; var checky = event.targettouches[0].pagey - canvas.offsettop; var collision = checkcollision(checkx,checky); if (collision == 0){ x = checkx; y = checky; draw(imgwidth,imgheight,ctx); } else { // here problem - should do? //because if touch event continues, collision // function hit white color again //and ball navigating through maze // pass border. } }; checking collision - here pr...

animation - Jquery shaker to all sides -

is there jquery function, shake object sides? i'm using css: @-webkit-keyframes spaceboots { 0% { -webkit-transform: translate(2px, 1px) rotate(3deg); } 10% { -webkit-transform: translate(-1px, -2px) rotate(-3deg); } 20% { -webkit-transform: translate(-3px, 0px) rotate(4deg); } 30% { -webkit-transform: translate(0px, 2px) rotate(3deg); } 40% { -webkit-transform: translate(1px, -1px) rotate(4deg); } 50% { -webkit-transform: translate(-1px, 2px) rotate(-4deg); } 60% { -webkit-transform: translate(-3px, 1px) rotate(3deg); } 70% { -webkit-transform: translate(2px, 1px) rotate(-4deg); } 80% { -webkit-transform: translate(-1px, -1px) rotate(4deg); } 90% { -webkit-transform: translate(2px, 2px) rotate(3deg); } 100% { -webkit-transform: translate(1px, -2px) rotate(-4deg); } } but working chrome. is there jquery function, shake object sides no, there isn't. jquery not have function specific.

trouble making drive insertion detection c# -

i trying add drive detection program having bit of difficulty. when try use code specified on code project . using windows project , having trouble getting working. namespace project { public partial class mainwindow : window { other code private const int wm_devicechange = 0x219; protected override void wndproc(ref message m) { switch (m.msg) { case wm_devicechange: // wparam value identifies occurring. // n = (int)m.wparam; break; } base.wndproc(m); } } } for wndproc need have using system.windows.forms; have using system.windows.controls; gives me following error is ambiguous reference between 'system.windows.controls.menuitem' , 'system.windows.forms.menuitem' for base.wndproc(m); error:'system.windows.window' not contain definition 'w...

internet explorer - Parent document is in Standards mode but Inner Iframe document (without doctype) runs in wierd mode in IE -

i have webpage runs in standards mode. webpage hosts iframes linking visitors home pages on have no control. have observed visitors home pages run in quirks run standalone , once loaded in inner iframe, styles breaks up. it appears inner document running in ie5 quirks! is there workaround issue? short answer: no, there's no work-around, document type inherited parent page in ie > 8. your options are: a) open page in new tab b) put page quirks mode (if do, pages requiring non-quirksmode won't work, includes iframe & parent page pages) c) ask site owner please update html standards-compliant you can put main page ie8 mode: <meta http-equiv="x-ua-compatible" content="ie=emulateie8" /> that break pages requiring ie9+ features.

c# - Receiving UnauthorizedAccessException When Trying to Move File -

i'm writing regression tests , need manually move file 1 location another. each time unauthorizedaccessexception happens, i'm assuming has permissions of folder file has moved from? i've checked file attributes , not set read-only. other questions , answers, i've tried setting attribute within program normal. i've thought maybe using setaccesscontrol help, i'm having trouble figuring out how set filesecurity parameter. of course, way off on issue well. in terms of permissions, administrator on local machine , on network, , if try moving files , locations in question powershell, no issues, don't have elevate or force, visual studio running on different permissions, , if so, how can change that? here code: internal static bool process5010claims(string batch) { string batchregex = createbatchregex(batch); string batchonfilesystem = adddecimaltobatch(batch); bool isfound = false; string pth = @"\\hedgefr...

sql - Update or Insert value if a field is NULL -

i know simple question wanted sure. have null value in field, , want change null value. change null value use insert or update? for example: insert datatable (column 1) values (1) 'column 1' = null or update datatable set 'column 1' = 1 'column 1' = null thank you. you use update updates , insert inserts(new records). update incorrect since cannot compare null values = or <> . therefore have use is : update datatable set [column 1] = 1 [column 1] null

ios - Is there a way to get the last push notification when my app starts up? -

in scenario user did not swipe push notification before disappeared, there way retrieve last 1 sent device app? can go notification center , see last few push notifications app there, there way can retrieve last 1 when app opens? there no way retrieve past push notifications. typically, isn't needed. once launched, app can communicate server see what's new. if app launched notification, app receive push notification passed in option key uiapplicationlaunchoptionsremotenotificationkey app delegate method application:didfinishlaunchingwithoptions . if app running , in foreground when push notification arrives, app delegate application:didreceiveremotenotification called with ios 7 , later, if notification type content-available , have background app refresh capability turned on (and user has not disabled background app refresh), app in background application:didreceiveremotenotification

ms access - Form based on a one-to-many relationship - just show parent records with child actions -

i have 2 tables, 1 parent records, , 1 child records. the child records displayed in subform attached bottom of form containing parent records. i want main form's recordset consist of parent records child records exist. however, when try this, multiple parent records (i.e. if flick through records, have pass 4 parent records if there 4 associated child records, etc.). i think need use group when try create query (so might able base form on it) tells me need group on fields in query, errors when so. please help! thanks i don't know how populating main (parent) form, if find record source form, property sheet, click build button (...) invoke query builder , can add in (show) child table. assuming there exists relationship between 2 tables, create inner join. if there isn't relationship (a join) drag , drop primary key in parent table foreign key in child table. you don't need include fields child table, have include fields need parent table in qu...

javascript - Why is YUI.add required when specifying YUI modules and if it is required how can non-YUI modules work? -

we use yui3 loader manage loading our javascript , css files. part of bootstrap js code on each page, have following: yui({ ... groups: { ... mygroup: { modules: { "my-module": { ... path: "mymodule.js", requires: [ "yui-base" ] }, } ... } } }).use("my-module", function (y) { y.mymodule.dostuff(); }); mymodule.js has following: yui.add('my-module', function (y) { y.mymodule = function () { ... _validator: y.lang.isstring }; }, '3.4.0', { requires: [ "yui-base" ] }); yui claims here loader can used non-yui3 "modules" given have dependencies specified in configuration. give following example module configuration yui2 group: yui2: { combine: true, base: 'http://yui.yahooapis.com/2.8.0r4/build/', c...

css - Importing Google Font into HTML Service -

are able import google font google apps script's html service? i trying do: <link href='http://fonts.googleapis.com/css?family=roboto' rel='stylesheet' type='text/css'> and use .nav-stacked li { color: rgb(136, 136, 136); display: list-item; font: 18px 'roboto', sans-serif; font-weight: 100; height: 20px; line-height: 20px; padding-right: 10px; text-indent: 24px; width: 194px; } but keeps reverting sans-serif font. thanks help, you need style properly .nav-stacked li { font: 18px 'roboto',sans-serif; }

html5 - Jquery Mobile slider not working JQM 1.3.2 and Jquery 1.10.2 -

i working jquery mobile first time design mobile web application. application has 1 page has header , navigation bar placed @ fixed position . onclicking tabs on navigation bar page loads on same page below nav bar within div left blank . seems on calling new pages on same page via ajax makes jquery mobile effect not work. none of data-theme, data-role , range , other data-attribute work. trying implement slider page "journal" shows text box value in it <div style="float:left" data-role="fieldcontain"> <label for="slider-fill">input slider:</label> <input type="range" name="slider-fill" id="slider-fill" min="0" max="100" data-highlight="true" /> </div> i using jquery mobile 1.3.2 , jquery 1.10.2 ! here html code page. see many repetition code coz not connected complete database once connect database wud little less messy. <body> <link...

java - Parse an Expression to its components and sub components -

i need parse expression such as: neg(and(x,y)) i need come out abstract stack machine code such example above: load x; load y; exec and; exec neg; but machine code not issue, how can parse / break input string of expression sub expressions? i have tried find first bracket , concat last bracket gives isuess if have inner expression? code have tried: (please not still in development phase) private boolean evaluateexpression(string expression) { int brackets = 0; int beginindex = -1; int endindex = -1; (int = 0; < expression.length(); i++) { if (expression.charat(i) == '(') { brackets++; if (brackets == 0) { endindex = i; system.out.println("the first expression ends @ " + i); } } if (expression.charat(i) == ')') { brackets--; if (brackets == 0) { endindex = i; system.out.printl...

dimensions - reshape in MATLAB -

if come following line of code in matlab : reshape(dataset{i},1, 200*200); here, dataset{j} seems element in cell array . right? since using reshape , can that element array ? when use reshape , define dimensions (i.e; m,n). in code above, m=1 , n=200*200 ? but, why wasn't n written 400 instance? there reason writing in syntax see? thanks. dataset cell array can't assume dataset{j} array. reshape work on strings , cell arrays well: reshape({1,2,3,4},2,2) ans = [1] [3] [2] [4] >> reshape('abcd',2,2) ans = ac bd there's not obvious reason write 200*200 unless 200 important understanding being computed.

appsdk2 - Using Rally WsapiDataStore at a certain date -

i want create chart of how many tasks in given schedule state during length of sprint. possible call wsapidatastore on each day? what looking lookback snapshot store , using lookback api - allows specify date or point in time want query by. a typical use looks this: ext.create('rally.data.lookback.snapshotstore', { pagesize : 10000, fetch : ['fetch'], filters : [{ property : '__at', value : 'current' },{ property : '_itemhierarchy', value : 'hierarchicalrequirement' }] }).load({ callback : function(records) { ext.array.each(records, function(record) { // each record }); } });

c# - Returning a multiple table LINQ query as one object -

so current application need query database using repository returns single object. problem information split 2 different tables. object im trying rule object. rule class consists of following database entities: class rule { stratruledef ruledefinition { get; set; } list<stratcode> rulecodelist { get; set; } in repository im using following query relevant info: public void getrule(int rulekey) { rule rulequery = ruledefinition in arecontext.stratruledefs rulecodes in arecontext.stratcodes ruledefinition.stratrulekey == rulekey && rulecodes.stratrulekey == rulekey select new { ruledefinition, rulecodes }; so have 2 problems. 1) how return rulequery 'rule' object, if change 'var' rule following error: error 10 cannot implicitly convert type 'system.linq.iqueryable' 'testrul...

php - Attempting to display message with no results -

what i"m trying understand how display message user when there no results returned database query. of right have query working correctly. in case there count of messages variable 0 i'd display message saying there no personal messages in outbox. includes not showing table. what have thought doing moving lines set object properties above code below , setting 2 separate build methods. 1 when there's results , 1 when there isn't. in chance there isn't results i'd have build view blank says random message. for template library using phil sturgeon's template library. https://github.com/jeffreydavidson/codeigniter-template i'm seeking better possibilities this. available assist? $messages = $this->messages->get_many_by('sender_id', $this->session->userdata('user_id')); //vardump($messages); die(); if (count($messages > 0)) { $tmpl = array('table_open' => '<table class="table table-borde...

What Android API? -

i need know api of android use app supported majority of users. tried on web , searching here cannot find info not dated. i don't want worry if want add needs higher api can't because picked low api. so api using @ moment , when people move newer ones? i have experience in javascript games , java programs want make app have left long enough. have downloaded eclipse , android sdk need decide on api. any tips great, thanks! you can use http://developer.android.com/about/dashboards/index.html make informed decision fits requirements.

iphone - How to use Entitlements keys to access private iOS features -

from know documentation entitlements plist - these files define properties provide application access iphone os features (such push notifications) , secure data (such user’s keychain). publicly, entitlement key use get-task-allow, enables ptrace() function used app, enabling debugging. there lot of entitlements used privately, e.g. task_for_pid-allow, allow controlling other processes (via task_for_pid() function) run-unsigned-code, allow running code app without signature. com.apple.springboard.launchapplications, com.apple.springboard.wipedevice, etc. my question has use of these keys access private ios features? how this? if put these keys in entitlements.plist not able code sign , put app on device. even if can sign executable correct entitlements still can't that. apple restricts usage of these entitlements provisioning profile. entitlements can sign app with, have subset of entitlements present in provisioning profile.

javascript - How to remove appended element usng jquery? -

i creating form. on submit of form each input field there errorbox appended when input field not filled. want remove or display off errorbox onfocus of input field.while in code remain @ position. tried , went through of similar posts not able find solution. thank you! html code like <div class="rowform"> <label for="name">name<span>*</span>:</label> <input type="text" class="mid" name="name" id="name" onfocus="fcs();"/><span id="name_error"></span> </div> script //on submit of form how appending errorbox if($("#listcontact #name").val()==""){ $("#name_error").append("<div class='formerror'>please enter name</div>"); } //the on focus function like function fcs() { $(".formerror").remove();} something like: $(".rowform")...

java - Null Value for nameArr in ArrayList -

i'm getting null value namearr in following source code , i'm not sure why. when attempt use following: system.out.println("testing123"); system.out.println(namearr); i’m getting: 08-07 19:51:53.540: i/system.out(1048): testing123 08-07 19:51:53.540: i/system.out(1048): [] it appears it’s null @ point – suggestions? i'm not sure why happening. source: public class updateactivity extends activity implements onclicklistener { public static arraylist<string> namearr = new arraylist<string>(); public static arraylist<string> valuearr = new arraylist<string>(); public static arraylist<string> namearr = new arraylist<string>(); public static arraylist<string> apnarr = new arraylist<string>(); public static arraylist<string> mmscarr = new arraylist<string>(); public static arraylist<string> mmsportarr = new arraylist<string>(); public static arraylist...

java - When to use initializers? -

this question has answer here: use of initializers vs constructors in java 8 answers i came across following bit of java syntax: static { ... } apparently known "static initializer" (see static block in java ) , "executed when class loaded". when should static initializer used? advantages , disadvantages compared initializing variables in usual way? as mentioned in comments , linked posts, useful when static initialization requires logic beyond assigning values static fields, e.g.: public class mediocreexample { static list<string> strings = new arraylist<string>(); static { strings.add("first"); strings.add("second"); } } there alternatives not use initialization block: public class mediocreexample { static list<string> strings = createinitiallis...

Solr DIH indexing is fast but search is very slow -

i have database table containing ~30 gb of data. indexing dih. indexing data takes 1 hr 15 minutes search slow takes around 1 minute doesn't seem right. please help, if has faced same issue. i proving content of files. data-config.xml <dataconfig> <datasource type="jdbcdatasource" driver="com.mysql.jdbc.driver" url="jdbc:mysql://battrdbtest20/test_results" batchsize="-1" user="results" password="resultsloader"/> <document> <entity name="syndrome" pk="test_file_result_id" query="select * syndrome"> <field column="test_file_result_id" name="test_file_result_id"/> <field column="syndrome" name="syndrome"/> </entity> </document> </dataconfig> schema.xml (changed fields suit...

c# - Reading and setting property multiple threads -

my project has 3 classes, , 2 threads. when access property on class thread created from, right value. class i'm reading starts second thread. new thread want read property second class. when set value in class1 value 1, value in class3 0. class test { public void main() { class2 cl = new class2; thread th = new thread(new threadstart(a.start)); th.start() cl.test=1; } } class class2 { private int test; public int test { { return test;} set {test = value;} } public void start() { class3 cls = new class3(); thread th = new thread(new threadstart(cls.begin)); th.start(); } } class class3 { public void begin() { class2 cl = new class2(); messagebox.show(cl.test.tostring()); } } you've got 2 separate instances of class2 . instance created in class3 has no idea values in instance created in class1 . if know want single in...

Python list of tuples deduplication -

i trying deduplicate set of different lists of tuples 1 after other. lists like: a = [ (('x','y','z',2,3,4), ('a','b','c',5,10,11)), (('a','b','c',5,10,11), ('x','y','z',2,3,4)), (('t','f','j',0,1,0), ('h','g','k',2,8,7)), ... ] b = [ (('x','y','z',0,0,0), ('a','b','c',3,3,2)), (('a','b','c',3,3,2), ('x','y','z',0,0,0)), (('j','k','l',5,4,3), ('v','t','d',5,10,12)), ... ] i running (e.g.for list a): from collections import ordereddict values = [[x,y] x, y in ordereddict.fromkeys(frozenset(x) x in a)] and get: = [ (('x','y','z',2,3,4), (...