Posts

java - Unable to store Database results into a Map -

i have made query shown above fetched me folowing results mysql> select distinct category_id , t1 ca +-------------+--------------------+ | category_id | t1 | +-------------+--------------------+ | 1 | popcorn | | 2 | popcorn | | 3 | popcorn | | 4 | popcorn | | 5 | popcorn | | 6 | popcorn | | 7 | soft drinks | | 8 | soft drinks | | 9 | soft drinks | | 10 | soft drinks | for each t1 coulmn , trying store category_id so looks popcorn=[ 1, 2, 3, 4, 5, 6, ] softdrinks=[ 7, 8, 9, 10, ] i have followed below approach accomplish map<string,linkedlist<integer>> categoryitemslist = new hashmap<string,linkedlist<integer>>(); preparedstatement stmt2 = connecti...

c++ - Reverse vertex winding order using matrices -

i'm implementing reflections (using render-to-texture method), , far works, problem objects in reflected version rendered inside out. i'd avoid changing internal opengl vertex winding order make sure don't interfere other rendering operations much. instead, i'd transform reflection matrix reversing. (which should reflection?) this reflection matrix (which transforms view matrix of camera): glm::mat4 matreflection( 1.f -2.f *n.x *n.x,-2.f *n.x *n.y,-2.f *n.x *n.z,-2.f *n.x *d, -2.f *n.x *n.y,1.f -2.f *n.y *n.y,-2.f *n.y *n.z,-2.f *n.y *d, -2.f *n.x *n.z,-2.f *n.y *n.z,1.f -2.f *n.z *n.z,-2.f *n.z *d, 0.f,0.f,0.f,1.f ); n = normal of plane of reflection; d = distance of plane is possible reverse vertex order through matrix transformation? if so, how exactly? if apply matrix scale y-axis -1 after other transformations (including projection), end upside-down image (which can use including uv.y = 1-uv.y somewhere in pipeline).

android - easiest way to make GCM registration working on real devices less than 4 -

my application gcm(using google play service) registration works fine on real device samsung running on android 4, does't working on galaxy gt-5360 running on android 2.3.6 after half-day of searching how make gcm registration working on real devices, don't helpful results. but search not go down drain, these solutions found not resolve problem. 1.first solution: link: gcm service_not_available on android 2.2 i experienced same problem. gcm works fine on tablet running android 4.04, received service_not_available on smartphone running android 2.3. i found following workaround not using (so far know) deprecated classes. add action "com.google.android.c2dm.intent.registration" gcmbroadcastreceiver in manifest. enable receive registration_id @ gcmbroadcastreceiver. <receiver android:name="your_package_name.gcmbroadcastreceiver" android:permission="com.google.android.c2dm.permission.send" > <intent-filter> ...

wpf - Same click event for both Button and Grid -

i read routed events today , tried provide same click event handler both normal button , custom grid button. stackpanel handling routed button click event, , invoke same handler firing click event grid's mousedown event. code without error not working expected. button click brings messagebox clicking grid mouse nothing. <window x:class="routedeventpr.mainwindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" title="mainwindow" height="550" width="525"> <stackpanel background="transparent" button.click="button_click_1"> <grid width="200" height="100" background="aqua" mousedown="grid_mousedown_1"> <ellipse strokethickness="4" width="200" height="100" fill="beige"/> <textbloc...

matlab guide - How get Current point -

good morning, have aplicattion with: set(gcf,'windowbuttonmotionfcn',{@mousecapturelc}); where x , y coordinates mousecapturelc function. function mousecapturelc(src, eventdata) pos = get(gca, 'currentpoint'); % axes image - (axes1) x = pos(1, 1); y = pos(1, 2); % working this values send labels text in gui: hfig1 = findobj('tag','lbl_x'); handles = guidata(hfig1); hfig2 = findobj('tag','lbl_y'); handles = guidata(hfig2); set(handles.lbl_x, 'string', sprintf('x: %1.0f ', x)); set(handles.lbl_y, 'string', sprintf('y: %1.0f ', y)); i need do: i need use x values in other axes, ie (axes2), in real time. want plot columns image in axes2 moving mouse. the problem: in side mousecapturelc(), when handle of axes2 motion function leave working. h = gcf; axes2 = findobj(h,'tag','axes2'); axes(axes2) it works clicking. not working more movement mouse. 1) tried values...

c++ - In Qt 4.8.5, the differences between setPaused(false) and resume() after setPaused(true) in QTimeLine -

in source of qtimeline.cpp, setpaused(false) , resume() same followd: d->timerid = starttimer(d->updateinterval); d->starttime = d->currenttime; d->timer.start(); d->setstate(running); in docs, setpaused(false) resumes timeline , continues left, resume() resumes timeline current time. can explain different result "same" code? read solved topic http://qt-project.org/forums/viewthread/28076 "qtimeline setpaused doesn’t pause time line correctly". still cannot find out reason. the intention the intended difference between resume () , setpaused (false) following: resume unconditionally change state of qtimeline running , no matter previous state of was, whereas; setpaused(false) not unless state paused . the source code the implementation of setpaused have check see state indeed paused before running code have in question, why "the same code" yields different results. the below entire body of res...

how to set twig global default variable -

is there way set global default variable instead of setting each 1 ? {{ app.model.foo | default('not set') }} {{ app.model.bar | default('not set') }} the built-in default filter cannot wish achieve. here's complete code: function _twig_default_filter($value, $default = '') { if (twig_test_empty($value)) { return $default; } return $value; } but twig easy extend ! can create own twig extension, registers new filter, code of this: function my_default_filter($value, $default = '') { if (twig_test_empty($value)) { return $default ?: $this->default; } return $value; } where class has $default property can set code, want.