Posts

Showing posts from April, 2014

google maps - how to zoom and add marker to android mapfragment -

i displaying map @ android application (google maps api v2). want manipulate map in order show specific location, zoom , marker. can give example of manipulation mapfragment to map instance in code this: map = ((supportmapfragment) getsupportfragmentmanager().findfragmentbyid(r.id.map)).getmap(); or: map = ((mapfragment) getfragmentmanager().findfragmentbyid(r.id.map)).getmap(); depending on whether used supportmapfragment or mapfragment in xml file. then add marker it: marker newmarker = map.addmarker(new markeroptions().position(latlng).title("marker title").icon(bitmapdescriptorfactory.fromresource(r.drawable.marker_for_map_purpul))); to zoom map: cameraposition cameraposition = new cameraposition.builder().target(latlng).zoom(14.0f).build(); cameraupdate cameraupdate = cameraupdatefactory.newcameraposition(cameraposition); map.movecamera(cameraupdate);

shell script to convert numbers to asterisk -

i have variable holds number, using shell script how can convert number asterisk characters, example 5 converted ***** , 2 converted ** on simple solution use perl: var=5 perl -e "print '*' x $var" other solution use seq : var=5 in `seq $var` ; echo -n '*' ; done

Does Rails have an "active?" method on ActiveRecord? -

i'm looking @ "fields_for" helper doc @ rails api website . following piece of code confuses me. <%= form_for @person |person_form| %> ... <%= person_form.fields_for :projects |project_fields| %> <% if project_fields.object.active? %> name: <%= project_fields.text_field :name %> <% end %> <% end %> ... <% end %> does have idea "acitve?" is? looks method on activerecord object, can't find doc/reference it. no (activemodel) doesn't, asking object generated fields_for.

c++ - WritePrinter not asking for PIN Code -

we have secure print. i go control panel >> printers , devices >> printer >> printer preference here assign 4 digit pin code .. i fire print word or excel ... go printer >> retrieve jobs >> select print job , enter pin code. only job gets printed. now our application has 2 source codes printing while firing print our application print instantaneously done .... i.e. doesn't store job in queue , wait pin ... prints immediately some source code bresult = openprinter(szdevice, &hprinter, null); // szdevice contains printer name startdocprtinfo.pdocname = msg; startdocprtinfo.poutputfile = null; startdocprtinfo.pdatatype = "raw"; bprnterr = (startdocprinter(hprinter,1,(lpbyte)&startdocprtinfo) == 0); writeprinter(hprinter, &buffer[2], i, &cnt); enddocprinter(hprinter); closeprinter(hprinter); ~~~~~ code printing given document not waiting user enter pin code question how make above code wait doing other appli

python - Stuck at Flask tutorial step 3 -

following flask tutorial, running win 7, python 2.7.3, virtualenv, , stuck in step 3: creating database http://flask.pocoo.org/docs/tutorial/dbinit/#tutorial-dbinit such schema can created piping schema.sql file sqlite3 command follows: sqlite3 /tmp/flaskr.db < schema.sql how run command, because cmd < venv > returns: "sqlite3" not recognized internal or external command, operable program or batch file. is step necessary? folder project, 2 files schema.sql , flaskr.py. schema.sql drop table if exists entries; create table entries ( id integer primary key autoincrement, title string not null, text string not null ); flaskr.py # imports import sqlite3 flask import flask, request, session, g, redirect, url_for, \ abort, render_template, flash contextlib import closing # configuration database = '/tmp/flaskr.db' debug = true secret_key = 'development key' username = 'admin' password = 'default' # crea

junit - Testing for upper bound violation in Java -

i'm trying use junit test java program, , i'm not sure how go testing upper-bound violations. specifically, have written simple program convert between kilometers , miles. for example, here method converting miles kilometers public static double miletokm(double mile){ //1.1170347260596139e308 / 0.621371192 = double.max_value try{ if (mile < 0 || mile > 1.1170347260596139e308){ throw new illegalargumentexception(); } else return mile / 0.621371192;} return 0; } so, guess question two-fold: first, why can't conjure exception when try miletokm(1.1170347260596139e308 + 1) in junit? assume it's rounding issue, if that's case how can exception thrown? second, method convert km mile, want throw exception if parameter greater double.max_value. how can pass such parameter? can junit test pass if pass parameter double.max_value * 10, message in console (this in eclipse mars 4.5.1, btw) say

java.net.URISyntaxException:Invalid character at index 69 when deploying war in weblogic -

i trying deploy war file in weblogic . getting following error message : java.net.urisyntaxexception: illegal character in path [1] @ index 69: https://xxxxxxxxxxx.test-secure-xxxxxxx-processing.com/xxxxxx/cnp_2_1 the character in question _ (underscore) . there way solve it? the url has been defined in beans xml file. there's illegal character @ index 69. see here

java - CronTrigger not firing at all for certain cases only? -

i using crontrigger website should trigger , send message. scenario : site has various mutual fund license holders. when license of mutual fund gonna expired message should trigger respective license holder 1 week before "your license expire in 7 days " . i trying long not working @ ... crontrigger not firing @ can me ? i'm getting following error in error console. (am using eclipse indigo ide, java , mysql ) java.lang.nullpointerexception @ com.eq.advisorkhoj.web.controller.homecontroller.schdulersmsoremail(homecontroller.java:1411) @ sun.reflect.generatedmethodaccessor133.invoke(unknown source) @ sun.reflect.delegatingmethodaccessorimpl.invoke(unknown source) @ java.lang.reflect.method.invoke(unknown source) @ org.springframework.web.method.support.invocablehandlermethod.invoke(invocablehandlermethod.java:213) @ org.springframework.web.method.support.invocablehandlermethod.invokeforrequest(invocablehandlermethod.java:126) @ org.springframework.web.servlet

asp.net - How to disable sorting in TreeView? -

i have treeview in aspx page shown below. <asp:treeview id="treeview1" runat="server" expanddepth="0" showcheckboxes="all" showlines="true"> </asp:treeview> when add nodes treeview sorts in alphabetical order. want, order have added nodes. take @ question. there answers here covers of basics of implementing sorting on treeview control. asp.net treeview sort

ios - Sorting NSArray, NSComparator block vs. NSSortDescriptor, with null values -

i've been using block based approach sort nsarray ... however, i'd noticed sort-related bug started investigate. background : i'm dealing nsarray of ekreminder objects, have creationdate property. want sort reminders descending creationdate (newest reminders, first). this previous code: // nsarray* fetchedreminders... contents pulled reminder calendars... nsarray* sortedarray = [fetchedreminders sortedarrayusingcomparator:^nscomparisonresult(id a, id b) { nsdate* first = [(ekreminder*)a creationdate]; nsdate* second = [(ekreminder*)b creationdate]; return [second compare:first]; }]; that code, believe, correct. however, ended reminders in database had null creation date. introduced bug - resulting sort incorrect. null values neither @ beginning or end, , seems having nulls in array messed comparison approach, many of reminders out of sequence. nssortdescriptor so, tried swapping out block-based approach in favour of sortedarrayusingdescr

Adding a button for Android in Java code -

is possible add button activity layout java code. if possible, how? current layout file: <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/ad_catalog_layout" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@drawable/background" android:orientation="vertical" > <com.google.ads.adview xmlns:googleads="http://schemas.android.com/apk/lib/com.google.ads" android:id="@+id/ad" android:layout_width="wrap_content" android:layout_height="wrap_content" googleads:adsize="iab_banner" googleads:adunitid="a14d7f7d2180609" /> <textview android:layout_width="match_parent" android:layout_height="wrap_content" android:text="@string/menu_mods" android:textcolor="#ffffff" android:textsize="25sp

Android Automatically Update Notification Using Timer -

i want activity refresh display notification based on refreshed values every 5 minutes. got refresh button , it's working fine. when try activate refresh button before notification appears in timer. app crashes. here codes //oncreate if(ordercounter>0) //ordercounter updated value { mytimertask mytask = new mytimertask(); timer mytimer = new timer(); mytimer.schedule(mytask, 1, 300000); } //timer class mytimertask extends timertask { public void run() { refresh.performclick(); // line cause of error pls generatenotification(getapplicationcontext(), "you have "+ ordercounter+ " pending orders!"); } } private void generatenotification(context context, string message) { int icon = r.drawable.ic_launcher; long when = system.currenttimemillis(); string appname = context.getresources().getstring(r.string.app_name); notification

Sphinx search entire field but not begin/end -

i trying match field contains words in phrase far have been able use ^ , $ it. instance ^word1 word2$ returns record named "word1 word2" not "word3 word1 word2" . however want in fact "word2 word1" so how use ^ , $ mean start , end of field forces words put in in particular order. search "word2 word1" gets more complex (3+ word terms, etc) is there way tell sphinx in entire field in order. in other words want "word1 word2" match "word1 word2" , "word2 word1" not "word3 word2 word1" well can use near/ or proximity operator require words ajoining(but in order), there isnt way require 'entire field'. closest use index_field_lengths, field len can use in custom ranking expression. if multiple fields in index tricky implement.

c# - Vector2 does not exist in the namespace 'SharpDX' -

im trying use sharpdx render graphics running trouble off. have imported sharpdx, d3dcompiler 3d11 , dxgi yet simple of drawing operations not work error list tells me type or namespace 'vector2' not exist in namespace 'sharpdx' i've had @ solution sharpdx on github , indeed have class called vector2 in namespace called sharpdx confused why cannot call it assuming using sharpdx 3.0+, need add reference sharpdx.mathematics assembly integrated core assembly separated.

swift - Convert decimal to hours:minutes:seconds -

i storing numbers in mysql db doubles can min, max , sums. i have decimal number 1.66777777778 equals 01:40:04 wanting able convert decimal in hour:minutes:seconds in swift can display value 01:40:04 don't know how. i have done searching results calculators without explanation. i have function convert decimal: func timetohour(hour: string, minute:string, second:string) -> double { var hoursource = 0.00 if hour == "" { hoursource = 0.00 } else { hoursource = double(hour)! } let minutesource = double(minute)! let secondsource = double(second)! let timedecimal: double = hoursource + (minutesource / 60) + (secondsource / 3600) return timedecimal } but need 1 go other way. thanks try: func hourtostring(hour:double) -> string { let hours = int(floor(hour)) let mins = int(floor(hour * 60) % 60) let secs = int(floor(hour * 3600) % 60) return string(format:"%d:%02d:%

vb.net - Printing at 11.5 inch in SSRS -

i have ssrs data report. interactive size , paper size, both set 8.5 x 12 inches. when print report, not print @ 11.5 inches. bottom margin set 0 please advise. thanks to knowledge ssrs let have 'body' of report go on margins , issue default size of portrait 8.5 x 11. 3 things: go report designer , click anywhere in blank space ensure 'report' option toolbar displays. click , should have orientation set here explicitly state width: 8.5in, height: 12in. set margins explicitly here well. may have done apologize if redundant there toolbar menu view called 'report' contains l point in upper left. show inches marked out you. select , see if there obvious going on or under set requirements. check printer options being printed. printer know paper not standard size? drivers not use 100% of page , use tiny bit of padding or else assume using 8.5 x 11. verify other ssrs can output want well.

how can i find the version of codeigniter an application was written in? -

i'm reviewing someone's code , can see they're using codeigniter. i'm trying figure out version they've used. i've been rooting around in directory structure find information haven't been successful yet. thanks. inside framework, it's defined in 'ci_version'. path system/core/codeigniter.php define('ci_version', '2.1.3');

javascript - How to remove the elements -

i need (under code can see need) here code: html <input type="number" id="elementnr"> <button onclick="thefunction()">remove it</button> <p id="theelements"/> javascript <script> var cars = ["bentley", "ferrari", "bmw", "mercedes", "lamborghini"]; document.getelementbyid("theelements").innerhtml = cars; function thefunction() { delete cars[3]; document.getelementbyid("theelements").innerhtml = cars; } </script> right code when click button removes 3rd element(mercedes) because gave function wanted know if there's way edit code when type number 4 in textbox , click button removes 4th element or if type 2 on textbox , click button removes 2nd element etc. very strange question... of course possible though. know how getelementbyid. can same input element , read value property, question remains. why want i

java - Enable HA/High Replication option in GAE app -

i'm getting error when trying transaction within application: transactions on multiple entity groups allowed in high replication applications with google plugin eclipse, easy enable ha option; when running gae maven archetype: mvn gae:run not sure how make ha enabled maven. how can enable it? there doc on here. https://developers.google.com/appengine/docs/java/tools/devserver#simulating_the_high_replication_consistencymodel that said, i'm not familiar kindleit gae plugin's configuration. enable in official plugin, add pom: <plugin> <groupid>com.google.appengine</groupid> <artifactid>appengine-maven-plugin</artifactid> <version>1.7.6</version> <configuration> <jvmflags> <jvmflag>-ddatastore.default_high_rep_job_policy_unapplied_job_pct=20</jvmflag> </jvmflags> </configuration> </plugin>

vbscript - Embedding vbs file to image -

how embed vbs file image , run vbs file when image clicked or open users? please provide me solution running arbitrary code in background when user opens image file severe vulnerability. no, there no regular way achieve want.

spring - modelMap.put() v/s modelMap.addAttribute() -

in spring, difference between modelmap.put("key",value); and modelmap.addattribute("key",value); addattributes implies check not null in attribute name -> see sources /** * add supplied attribute under supplied name. * @param attributename name of model attribute (never <code>null</code>) * @param attributevalue model attribute value (can <code>null</code>) */ public modelmap addattribute(string attributename, object attributevalue) { assert.notnull(attributename, "model attribute name must not null"); put(attributename, attributevalue); return this; }

xsd error in the following -

here xml <?xml version="1.0" encoding="utf-8"?> <modules xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:nonamespaceschemalocation="xsdqu3.xsd"> <module code="cse1246"> <name shortname="adsa">applied data structures , algorithms</name> <level>1</level> <resourceperson> <name>anwar</name> <surname>chutoo</surname> </resourceperson> </module> <module code="cse2041"> <name shortname="web 2">web technologies ii</name> <level>2</level> <resourceperson> <fullname>shehzad jaunbuccus</fullname> </resourceperson> </module> </modules> i'm having error @ name. resource person can either contain ful

javascript - How do I get multiple album picture urls with one call to Facebook Graph API -

i can pass string "album.id/photos" , list looks below have each photo id in album, doesn't return url each picture (just id). have run single call each picture want fetch url for, or there way have urls returned call below? { "data": [{ "created_time": "2011-01-21t20:19:49+0000", "id": "10150091489547705" }, { "created_time": "2010-02-03t03:31:56+0000", "id": "293935837704" }, { "created_time": "2009-01-02t02:46:28+0000", "id": "56480657704" }], "paging": { "cursors": { "before": "mtaxntawote0odk1ndc3mduzd", "after": "nty0oda2ntc3mdqzd" } } } here call looks in javascript (var j = 0; j < albumids.length; j++) { var request = albumids[j] + "/photos"; fb.api(request,

php - Handling guzzle 6 response body in laravel -

Image
i'm making laravel 5.2 project communicating local api. , i'm having issues handling guzzle response body. my controller: public function getclients(){ $guzzle = new client(); try{ $response = $guzzle->request('get', 'http://localhost:3000/client')->getbody(); return view('home.clients', ['clients' => $response]); }catch(clientexception $e){ //handling exception } } my blade view: <h2>client list</h2> {{ $clients }}//just inspect @forelse ($clients $client) <h3>{{ $client->name }}</h3> <h3>{{ $client->email }}</h3> <h3>{{ $client->country }}</h3> @empty <h3>no clients here</h3> @endforelse no errors on loop or controller, showing stream object in browser in loop doesn't display anything. i've read guzzle 6 response body documentation, it's not clear newbie in me. thoughts?

function - C - Return value to main -

haven't found answering question, here goes: i want return integer function main further use, it's add() function creates list entries in text file. integer want return called error, declared 0 @ beginning of function , changes 1 when condition met (in case, if character other a-z, a-z, - , ' ' found). if condition met, want return error (as 1 ) main function, otherwise return 0 . in main have if statement checks if error 1 print error message , return 1. possible? i've tried few things doesn't work, if initialize error variable 0 in main, shouldn't add function change 1 in case of error condition? don't want use global variables , want implement add function main last resort. sorry if complete nonsense, beginner. int add(char line[]) { struct node *newnode = (struct node *) malloc(sizeof(struct node)); struct node *walker = newnode; strcpy(newnode->name, line); int check = 0; int error = 0; whi

rest - An EmberJS DataStore adapter which supports HATEOAS -

i'm creating app i'd quite restful follows hateoas rest requirement. on front-end, i'm looking @ using ember because seems pretty in line how build front-end apps. unfortunately though, built-in rest datasource adapter doesn't seem understand how navigate apis follow hateoas - have specify data in terms of ids, rather via urls. google isn't helping me - does know of data adapter does support hateoas? if not, i'll try building one, didn't want waste time! ember data strives follow json api spec, came out of formats rest adapter follows. there two formats , , while id-based format requires client have urls hard-coded resources, url-based format works url templates include links in representations directly.

Apache Camel and Web Service -

i'm new camel , trying simple thing. inside camel want expose web service have request , response public response mymethod(request r) { //some logic here } inside method request validation: , if invalid reply code (failure) in response. if valid, reply code (success). in case of success need camel route kick in, take request, transform , send service. what not understand - how reply client response , @ same time kick off camel route. tried find example on google ... not able to. can camel want ? i not quit sure understand question reply , continue flow can use camel wiretap functionality. can find example , explanation here. http://camel.apache.org/wire-tap.html

Git: Show all remote branches that a faulty branch has been merged into -

i have faulty git branch (let's name branch-e) has been merged master. while i've had resolved, need know, there way list other branches in branch has been merged into? i know can suspected branches 1 one: git checkout branch-a git branch --merged branch-a -r which shows branches merged branch-a. need know if there's way list remote branches affected erroneous branch-e. kind of other way around. take note i'm looking list of branches contain another branch , not particular commit. thank you. found answer after using better wording on google search: git branch --contains <branch name> -r

Docker watchtower with private registry -

i want run docker watchtower automatically upgrade docker containers whenever push new version private registry. however, watchtower doesn't find containers in private registry. does know how run watchtower private docker registry? watchtower supports docker hub private registry, not off-site registries quay or gitlab. an alternative might use webhook , include http request endpoint whatever ci/cd platform you're using. that way, instead of checking updates, can ping endpoint whenever change made, , auto-update. it's push rather pull, can achieve similar effect. an example script running web server might be: #!/bin/bash docker pull [your-registry][repo]:latest docker stop [repo-name] docker rm [repo-name] docker run -d --name [repo-name] -p 80:4000 --restart [your-registry][repo]:latest it's not slickest deployment method. you're better use dedicated ci/cd provider in production can better orchestrate build, testing , deployment pipeline.

Compare Date & Time in JQuery -

i want message date comparing in jquery. for example: have text box value 04/01/2013 13:15:32 filled userend. , current date time in jquery variable 04/01/2013 18:30:12 if text box value less current datetime show message: function foo(){ usrdate = jquery("#txtdate").val(); //getting user input date time currentdate = new date(); //system current date currentmonth = currentdate.getmonth() + 01; currentday = currentdate.getdate(); currentyear = currentdate.getfullyear(); currenthours = currentdate.gethours(); currentminutes = currentdate.getminutes(); currentseconds = currentdate.getseconds(); currentcpdatetime = currentmonth + "/" + currentday + "/" + currentyear + " " + currenthours + ":" + currentminutes + ":" + currentseconds; if (usrdate > currentcpdatetime ) { alert("you can not choose date greater current"); } else {

How to execute batch file in shell script? -

i have ".sh" test script. after completion of execution of commands need run ". bat" file (". bat" file simulate java console browser, comes on test site , makes simple click). in batch console type "cmd" , filename of ".bat". cmd c: \ cygwin \ home \ tester \ 25> start.bat start.bat c: \ cygwin \ home \ tester \ 25> java-classpath "c: \ cygwin \ home \ tester \ 25 \; c: \ cygwin \ home \ tester \ 25 \ \ lib \ *" com.clickchecker.feedredirectmanager "java" ▒ ▒  ▒ ▒ ▒ ▒ ▒ ▒ ▒ ▒ 7 ▒ ▒ ▒ ▒ ▒ ▒ ▒ ▒ ▒ è­¥ ▒ ▒ ▒ ▒ ▒ ▒ ▒ ▒ ▒, ▒ ᯮ ▒ ▒ 塞 ▒ ▒ ▒ ண ࠬ ▒ ▒ ▒ ▒ ▒ ▒ ▒ ▒ ▒ ▒ ▒ ▒ ä © ▒ ▒ ▒. i can see ". bat" starts, not work corectly.

c# - How is F#'s static bound constraints implemented? -

in f#, can perform black-magic voodoo 1 , perform static typed constraints ensure function called on types have member constraints. example: module collection let inline init s = let collection = new ^t() let add e = (^t : (member add : 'a -> unit) collection, e) seq.iter add s collection this function can called type has add<'a> has signature 'a -> unit . usage: let a:list<_> = collection.init {1..10} let b:synchronizedcollection<_> = collection.init {1..10} |> seq.iter (fun x -> printf "%a " x) b |> seq.iter (fun x -> printf "%a " x) output: 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 i'm interested in taking advantage of kind of functionality in c# application, have no idea kind of pitfalls or trouble can expect trying this. in interest of avoiding x-y problem, have wcf generated client hacked manually edited mess. not using not option reasons . many type

matlab - How to determine a graph is totally connected? -

sorry simple question, there way determine graph totally connected? read papers indicate total connectedness of graph prerequisite of graph analysis. search through graph analysis toolboxes of matlab such function determines connectedness seems @ least none provided in these toolboxes. please give me suggestion on this? many thanks! just make thread of answers complete . above steps: assume have graph's matrix g make diagonal matrix d same size g , put degree of nth node in nth diagonal element make laplacian matrix : l = d - g compute l's eigenvalues(eig function in matlab you) the number of engenvalues equal 0 number of components in graph if number of components 1 graph connected , otherwise has number of components wanted this method works both directed , undirected graphs hope find helpful

mongodb - PHP Mongo Session Handler and Sharding -

i using https://github.com/symfony/symfony/blob/master/src/symfony/component/httpfoundation/session/storage/handler/mongodbsessionhandler.php as session handler php app. our app expecting high volume traffic, experimenting sharding mongo store session. i have set shard according the document, , things fine before shard collection (i can see session document being created in session collection). as enabled sharding on session using sharding key sess_id , no session document gets created (i.e. count never change), , see these lines in mongos log whenever visit php page: resetting shard version of mydb.session on my.hsard.ip.address:port, version zero i have tried shard other collection , works fine, tells me sharding setup correct. anybody have clue of might wrong? i'm using mongo 2.2.3. found cause. it because write function in mongodbsessionhandler.php comes symfony version using not work sharding. the mongodbsessionhandler.php using implements

node.js - Clean URLs (possibly with slug) -

i using mongodb store data. , default _id long , not-clean. routes like: example.com/job/sdg3463retgeragsehxcwe35435ert5 works fine. but there way auto increment numbers , save custom id (with field name like, serial_number)? i implemented way: created collection store last saved serial number. while saving new data, increment it. works fine, there better way? also, how save urls slug instead of ids? need separate collection store slug , relevant id? what if use raw mongodb _id? going hurt seo drastically? or other issues? this works fine, wondering how pros it. if willing have alphanumeric ids shortid module works pretty well. https://github.com/dylang/shortid if want actual slugs , using mongoose try mongoose-uniqueslus module. https://github.com/punkave/mongoose-uniqueslugs.git

java - how to update sql table from entity class? -

i changed of entity classes. added more columns , changed of column names. want learn how can update sql tables according these entities or how can re-create these tables entity classes.thanks help. add line in hibernate mapping: <property key="hibernate.hbm2ddl.auto">create</property> but app recreate table each time start app. also can read chapter

multithreading - Can I implement blocking queue with two objects serving as locks in Java? -

i trying understand java's synchronized keyword, wait(), , notify() implementing blocking queue class. 1 of blocking queue implementation described this article. wonder if possible use 2 objects serving lock implement blocking queue? below code correct? public class blockingqueue { private list<object> queue = new linkedlist<object>(); private int limit; private object slots = new object(); private object objs = new object(); public blockingqueue(int limit) { this.limit = limit; } private synchronized void enqueue(object o) throws interruptedexception { if (queue.size() == limit) slots.wait(); objs.notify(); queue.add(o); } private synchronized object dequeue() throws interruptedexception { if (queue.size() == 0) objs.wait(); slots.notify(); return queue.remove(0); } } first of all, cannot wait or notify on object didn't synchronized on. here use this.wait() , this.notifyall. second,

mysql - How do I arrange the data by different WHERE conditions into different columns? -

i have table have 3 columns (sid,subject,marks): ╔══════╦═════════╦═══════╗ ║ sid ║ subject ║ marks ║ ╠══════╬═════════╬═══════╣ ║ 1a01 ║ eng ║ 66 ║ ║ 1a02 ║ eng ║ 75 ║ ║ 1a01 ║ math ║ 60 ║ ║ 1a03 ║ eng ║ 73 ║ ║ 1a02 ║ math ║ 35 ║ ║ 1a03 ║ math ║ 80 ║ ║ 1a01 ║ chi ║ 65 ║ ║ 1a02 ║ chi ║ 74 ║ ║ 1a03 ║ chi ║ 78 ║ ╚══════╩═════════╩═══════╝ and want group data sid in each row like: ╔══════╦═════╦═════╦══════╗ ║ sid ║ chi ║ eng ║ math ║ ╠══════╬═════╬═════╬══════╣ ║ 1a01 ║ 65 ║ 66 ║ 60 ║ ║ 1a02 ║ 74 ║ 75 ║ 35 ║ ║ 1a03 ║ 78 ║ 73 ║ 80 ║ ╚══════╩═════╩═════╩══════╝ i new in mysql, tried use subquery , union failed. can please give me hints? if 3 subjects, can use case test subject every sid , aggregate result using max() . select sid, max(case when subject = 'chi' marks else null end) `chi`, max(case when subject = 'eng' marks else null end) `eng`, max(ca

wcf - An existing connection was forcibly closed by the remote host. A connection that was expected to be kept alive was closed by the server -

specifications: 1. web application: asp.net mvc 2.0, 2. dot net framework 4.0, 3. windows server 2008 r2, 4. iis 7.5 points: generating word document dynamically using openxml , downloading gives above error. word document size around 1.0 mb wcf used xml data used generating document , several other data calculations it inconsistently throws error "an existing connection forcibly closed remote host. underlying connection closed: connection expected kept alive closed server." one of pattern of throwing error first time downloads without error , second time fails , again downloads correctly. one of major point notice not give error once on localhost. error occurs when application hosted on windows server 2008 setting keep alive property option wont work in case of wcf service. please correct me if wrong. through elmah have been able above error. please me know can cause of such error.please let me know if more information required. thanks in advance

OpenCV Ip Camera Image Deterioration -

i have connected ip camera using opencv. if show image using imshow, it's fine... if try cpu processing image (i equalize image , run face detector...), image starts deteriorate (i keep getting ac-tex damaged in console)... starts blur , blur , blur... dont know why happening. can confirm not happen when getting images isight camera (i running on imac...) besides that, having weird time opencv. face detection doesn't seem work when run app in release mode. on windows 8 , using vs 2010. can shed light @ these problems? i suggest break problem small parts. questions have you: the image capture , presentation working without processing? a local camera face detector algorithm working? you said release mode, means working on debug version?

c - How to convert binary int array to hex char array? -

say have 32 bit long array of 32 binary digits , want output in hex form. how that? have right long , don't know how compare 4 binary digits corresponding hex number this have right break 32 bit number 4 bit binary , try find matching number in binarydigits char hexchars[16] ={'0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f'}; char * binarydigits[16] = {"0000","0001","0010","0011","0100","0101","0110","0111","1000","1001","1010","1011","1100","1101","1110","1111"}; int binarynum[32]= {'0','0','1','0','0','0','0','1','0','0','0','0','1','0','0','1',&#

android - Crop square image to circle - Programmatically -

i searching past 1 day , not successful . i image api , , download bitmap file using following code . private bitmap downloadimage(string url) { bitmap bitmap = null; inputstream in = null; try { in = openhttpconnection(url); bitmap = bitmapfactory.decodestream(in); in.close(); } catch (ioexception e1) { e1.printstacktrace(); } return bitmap; } private inputstream openhttpconnection(string urlstring) throws ioexception { inputstream in = null; int response = -1; url url = new url(urlstring); urlconnection conn = url.openconnection(); if (!(conn instanceof httpurlconnection)) throw new ioexception("not http connection"); try { httpurlconnection httpconn = (httpurlconnection) conn; httpconn.setallowuserinteraction(false); htt

javascript - change json formated data by looping... the result is tripled -

i need change json formated data , want remove quotes in second column y on datalevel json array. first in code behind make function change datatable json format code public string datatabletojsonwithstringbuilder(datatable table) { var jsonstring = new stringbuilder(); if (table.rows.count > 0) { jsonstring.append("["); (int = 0; < table.rows.count; i++) { jsonstring.append("{"); (int j = 0; j < table.columns.count; j++) { if (j < table.columns.count - 1) { jsonstring.append("\"" + table.columns[j].columnname.tostring() + "\":" + "\"" + table.rows[i][j].tostring() + "\","); } else if (j == table.columns.count - 1) { jsonstring.append("\"" + table.columns[j].columnname.tostring() + "\":" + "\"" + table.rows[i][j].tostring() + "\""); } } if (i == table.

Android app fullscreen with no Title bar and no Action bar -

i trying create first android app webview. last issue trying resolve have webview in fullscreen no title bar , no action bar. my manifest: <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.domain.butlerv2"> <uses-permission android:name="android.permission.internet" /> <uses-permission android:name="android.permission.internet"/> <uses-permission android:name="android.permission.access_network_state"/> <uses-permission android:name="android.permission.access_wifi_state"/> <application android:allowbackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:supportsrtl="true" android:theme="@style/apptheme.noactionbar"> <activity android:name=".mainactivity"

c++ - I am having trouble with a simple argument dependent lookup / template type inferencing issue -

i have snippet of code , not understand why std::cout line not compiling... argument lookup / template argument inferencing seems correct... #include <iostream> template<typename t> struct { struct m1 { t x; }; }; template<typename t> std::ostream &operator<<(std::ostream &os, typename a<t>::m1 const &o) { os << o.x; return os; } int main() { a<int>::m1 a; std::cout << a; // line fails return 0; } btw i'm trying without declaring operator<<() inline function. your problem t in non deduced context. c++ simple pattern match, not invert possibly arbitrary type maps. imagine there specialization of a<void> set using m1=a<int>::m1 . both int , void valid t << . problem intractible in general, c++ refuses try: can pattern match on direct template arguments of argument types. to want: template<typename t> struct { struct

ElasticSearch completion suggester formatting with Java client -

i new suggester java api elasticsearch, using version 2.1.1, resources on net curl instead of java example, got index called "facebook" , 1 dataset prepared. can searched search api completionsuggestionbuilder suggestionsbuilder = new completionsuggestionbuilder("completeme"); suggestionsbuilder.text("qui"); suggestionsbuilder.field("content"); suggestrequestbuilder suggestrequestbuilder = client.preparesuggest("facebook").addsuggestion(suggestionsbuilder); then try on suggester api of elasticsearch, got these errors dont know missing out. please advice me examples. in advance. {author=lance tan kah woon, postdate=2016-01-31t13:16:49.767z, title=posting, content=today's weather quite ok, tags=[hashtag]} ------------------------------------------------------- 16947 [elasticsearch[ego living planet][suggest][t#1]] debug org.elasticsearch.action.suggest - [ego living planet] [facebook]

multithreading - Odd threading behavior in python -

i have problem need pass index of array function define inline. function gets passed parameter function call callback. the thing is, when code gets called, value of index wrong. solved creating ugly workaround interested in understanding happening here. created minimal example demonstrate problem: from __future__ import print_function import threading def works_as_expected(): in range(10): run_in_thread(lambda: print('the number is: {}'.format(i))) def not_as_expected(): in range(10): run_later_in_thread(lambda: print('the number is: {}'.format(i))) def run_in_thread(f): threading.thread(target=f).start() threads_to_run_later = [] def run_later_in_thread(f): threads_to_run_later.append(threading.thread(target=f)) print('this works expected:\n') works_as_expected() print('\nthis not work expected:\n') not_as_expected() t in threads_to_run_later: t.start() here output: this works expected: number is: 0 n

Greedy Algorithm java in map -

i'm working on emulator of atm in java. overall pattern in project command. have 4 commands - getinfo, deposit,withdraw , exit. i'm facing problems implementation of greedy algorithm in withdrawal method. should return map first integer "denomination" , second integer "amount" left in atm after withdrew. public map<integer, integer> withdrawamount(int expectedamount) so takes expected amount argument , has subtract atm least possible amount of bills. public class currencymanipulator { // denominations map each denomination , it's quantity stored private string currencycode; private map<integer, integer> denominations = new hashmap<>(); public string getcurrencycode() { return currencycode; } public currencymanipulator(string currencycode) { this.currencycode = currencycode; } public void addamount(int denomination, int count) {