Posts

Showing posts from March, 2011

java - org.eclipse.core.expressions.definitions doesn't work with equals -

java - org.eclipse.core.expressions.definitions doesn't work with equals - i'm starting out with eclipse e4 swt , have problem core expressions. i'm trying set core look optionally display popup menu items treeview. when define look instanceof myobject, works fine; menu item displays if instanceof myobject, doesn't show when instance of other object. i tried show menu item equals value , can't work. the menu item won't show @ all, when value correct. have integer range form 0 4 want show menu items particular integer value. i've tried comparing value integer , string no menu items show, yet when alter instanceof integer or string, display. can tell me how equals supposed work? equals work objects of type string, boolean, integer or float. illustration ant editor: class="lang-xml prettyprint-override"> <extension point="org.eclipse.core.expressions.definitions"> <definition

Problems in running class java files in ubuntu -

Problems in running class java files in ubuntu - i have coded java file (party.java) in ubuntu through gedit - java code of file follows: import java.awt.*; import java.awt.event.*; class party { public void buildinvite() { frame f = new frame(); label l = new label("party @ tim's"); button b = new button("you bet"); button c = new button("shoot me"); panel p = new panel(); p.add(l); } // more code here... } and compiled code terminal. after doing stuff when tried run party.class through terminal commands: kirat@virus:~$ cd ~/desktop kirat@virus:~/desktop$ java party its showing me error message: exception in thread "main" java.lang.nosuchmethoderror: main i don't know whether there wrong code. please help me issue exception in thread "main" java.lang.nosuchmethoderror: main in core java can execute programme has main method class don't have main method defined

Monitor a mule process from another mule flow -

Monitor a mule process from another mule flow - i have process reads file , uploads database. flow goes below. file connector processing within for-each loop (update database) the problem above approach @ time when exception occurs, processing stops @ record , rest of records not processed. work around, have changed flow below: file connector for each - within for-each flow-ref placed phone call separate flow processing. the thing noticed that, @ point of calling new flow, separate threads used processing, due exception not cause records fail. facing difficulty, after processing completes, need initiate study finish processing details (no of records processed, rejected, etc). since records processed asynchronously in different threads, not able figure out when processing completed. there way monitor whether processing finish mule flow, can generate study when complete? at point of calling new flow, separate threads used processing a flow-ref doesn'

python - Scrolling Progress Bar in Tkinter -

python - Scrolling Progress Bar in Tkinter - i have been trying set progress bar in python tkinter gui shows process running. process long , have no way measure progress, need utilize indeterminate progress bar. however, dislike style of ttk indeterminate progress bar bounces , forth. want 1 scrolls across bar on , on again, kind of image is possible tkinter? have tried ttk's determinate progressbar? can create progress continuously scroll across bar. for example: #!/usr/bin/env python3 import tkinter import tkinter.ttk ttk root = tkinter.tk() frame = ttk.frame() pb = ttk.progressbar(frame, length=300, mode='determinate') frame.pack() pb.pack() pb.start(25) root.mainloop() python tkinter progress-bar ttk

ios - What are must-have libraries for RubyMotion? -

ios - What are must-have libraries for RubyMotion? - i'm relatively new rubymotion development, have experience ios in objective-c. when started using rubymotion found quite lot libraries that. there helpful libraries networking, info storage , on, confuses me these layout (ui) libraries. there bunch of them , popular are: - sweettea - sugarcube (not ui) - motionkit - teacup - rmq (not ui) i'd of them useful , 1 should reject. i'm starting brand new project scratch flexible take , want start useful , commonly supported tools allow me develop layouts ios. can suggest must-have tools , libraries rubymotion? things people use: bubblewrap motion-cocoapods afmotion (if need networking ) motion-hockeyapp (or testflight) awesome_print_motion from there, depends. promotion popular, people want closer metal. gem rmq popular, people utilize (like do) or parts of it. many people utilize promotion , rmq together. a lot of people utilize sugarcube. poll

php - MySQL insert & Update query gives error while inserting large data -

php - MySQL insert & Update query gives error while inserting large data - table structure: id int(11) bcontent longtext when run insert query through php if info going store in bcontent little (2-3 lines paragraph) query runs when size of info increases (10-11 lines paragraph) query gives error. there problem longtext info type? tried longblob no change. php code: include("conn.php"); $bcontent = $_post['bcontent']; $query = mysql_query("insert blocks (bcontent) values ('$bcontent')"); if($query) { //success message } else { //error message } when size of bcontent big php throws //error message. i increment size of post_max_size 200m in php.ini no change. error: you have error in sql syntax; check manual corresponds mysql server version right syntax use actually gives me output coded in else condition is there error query or in table structure? please help me. your content contains quote characters,

php - can't get permission to post on facebook read_stream -

php - can't get permission to post on facebook read_stream - i need permission post facebook status via application and can't access read_stream $loginurl = $facebook->getloginurl(array( "scope" => "read_stream,publish_stream")); header('location: '.$loginurl); do have submit review ? sorry english language the way not send review, it's if selected permissions on admin (of facebook app) users. example, if want create app post new status when create topic on forum, you'll access own "manage_pages,publish_stream" permissions, , administrator of app, review not require. but, when want access website users permissions, need send review. takes ~2 business days. php facebook

debugging - Flash Player Debugger ActiveX for IE is not working -

debugging - Flash Player Debugger ActiveX for IE is not working - although have never worked flex before, have changes in flex application. when install ordinary flash player http://get.adobe.com/flashplayer/ can open application in ie , works correctly. however, when install flash player debugger activex ie http://www.adobe.com/support/flashplayer/downloads.html , open page in ie next error message: alternate html content should placed here. content requires adobe flash player. flash i need utilize debugger version in order able debug application in intellij. perchance wrong? it turned out can utilize debugger version of activex flash player plugin 32-bit ie version. debugging flex

javascript - why java code not converting text to utf8 characters? -

javascript - why java code not converting text to utf8 characters? - my jsp page has encoding follows : <%@ page contenttype="text/html; charset=utf-8" pageencoding="utf-8" %> <% response.setheader("cache-control", "no-cache"); response.setheader("pragma", "no-cache"); response.setdateheader("expires", 0); response.setcharacterencoding("utf-8"); response.setcontenttype("text/html;charset=utf-8"); %> javascript code printing greek characters in firebug next code : function save() { console.log(document.editdistributionlistform.elements['name'].value); //this line prints greek characters document.editdistributionlistform.elements['subaction'].value='submit'; document.editdistributionlistform.submit(); } when 'name' value above sent struts action, string not printing greek characters instead prints ???????????????? greek character

Recognize wide Unicode point on Windows narrow Python build -

Recognize wide Unicode point on Windows narrow Python build - i have narrow python 2.7.6 build on windows. have string containing both "narrow" (< 0x10000) , "wide" (> 0xffff) unicode code points. >>> wide1 = u'\u0002b740' >>> wide2 = u'\ud86d\udf40' >>> wide1 == wide2 true >>> narrow = u'\ud86d' >>> s = wide1 + narrow but when iterate on string, doesn't recognize wide code points: >>> c in s: >>> c u'\ud86d' u'\udf40' u'\ud86d' and becomes impossible find out whether char narrow code point or part of wide code point. you cannot. high unicode codepoints internally represented utf-16 surrogates. the u+d86d , u+df40 codepoints such surrogates, should never see in normal unicode text usage anyway. quoting wikipedia article on utf-16: the unicode standard permanently reserves these code point values utf-16 encoding of

scan string with unknown number of elements to an array of int in C -

scan string with unknown number of elements to an array of int in C - i'm working in programme in c , have char string of numbers this: 5 13 12 7 3 0 i want scan , set each of these integers in array of int. how do that? way utilize sscanf this? i tried next code no success: fgets(datatemp, n*3, stdin); k = 0; garb = 'c'; while(garb != '\0'){ garb = strtok(datatemp, " "); array[k] = garb; k++; } note: have utilize in function same many info in 'datatemp' string have unknown number of integers (and integers). thanks help. // adapted strtok(3) example. #include<stdio.h> #include<stdlib.h> #include<string.h> int main(int argc, char *argv[]) { char *str1, *str2, *token, *subtoken; char *saveptr1,*saveptr2; int j; char datatemp[ 120 ]; char delim = ' '; fgets(datatemp, 119, stdin); /* * strtok has called pointer input * first time pointer

Facebook graph api /user does not return gender, other public profile bits -

Facebook graph api /user does not return gender, other public profile bits - trying gender of users particular (public) post. can list of app-specific-user-ids of liked post, when query profiles, first , lastly name: /v2.0/10203862301234567 {u'first_name': u'john', u'id': u'10203862301234567', u'last_name': u'doe', u'link': u'https://www.facebook.com/app_scoped_user_id/10203862301234567/', u'name': u'john doe'} even if specify fields, still not gender back: /v2.0/10203862301234567?fields=gender {u'id': u'10203862301234567'} am doing wrong? it's not lack of gender, can navigate (logged in personal account) public post , click through see total public profile, includes age/gender/location/etc. many thanks i'm having same problem. i can not gender directly. and can not username , url of profile. this api 2.0 appears incomplete. basic things lost

angularjs - How to connect a post rest request to the add controller action using prefixes in cakephp -

angularjs - How to connect a post rest request to the add controller action using prefixes in cakephp - i code client/server application. server side powered cakephp 2.4.7. client side run angularjs , cordova on mobile devices i utilize several cakephp route prefixes 'admin' , 'mobile'. (and utilize $resource , $httpinterceptor angularjs factories setup rest requests.) i want phone call /website/mobile/posts/add.json json info posting. so phone call /website/mobile/posts.json post ajax query: the problem here: called controller action 'index', not 'add'; on top of postscontroller, added this: echo $this->request->params['action'] . "\n"; echo ($this->request->ispost())? "post" . "\n" : "not post"; die; and response always: mobile_index post so ajax request seems right cakephp don't map add together action, index one. configuration seems too; here fragm

javascript - open collapsible div programatically -

javascript - open collapsible div programatically - i'm using jquery mobile , have collapsible div want expand after ajax request. <div id="collapsiblediv"/> function displaydata() { $.mobile.loading('show'); $.ajax({ ... success: function (result) { $("#" + code).html(result); $.mobile.loading('hide'); $("#collapsiblediv").trigger('collapse'); }, error: ... }); }; according api, expand div $( "#collapsiblediv" ).collapsible( "expand" ); javascript jquery html

sql server - Incremental count based on criteria -

sql server - Incremental count based on criteria - is there anyway can archive following? need count based on subject itself. student term subject count ------------------------------------------------------ 0001 aug2013 abc1234 0 0001 jan2014 abc1234 1 0001 jan2014 def1234 0 0001 may2014 abc1234 2 0001 may2014 ghi1234 0 try this select student, term, subject, row_number() on (partition student, subject order term)-1 count tablename sql-server sql-server-2008

javascript - Read array in JSON object -

javascript - Read array in JSON object - i trying read next json: { "items":[ { "snippet":{ "title":"pharrell williams - happy (12am)", "categoryid":"10" }, "topicdetails":{ "topicids":[ "/m/04mn81", "/m/0zdjzxm" ] } } ] } i've read topicids json. i've tried next read topicids doesn't work. please tell me what's wrong here: $.each(jsonresponse.items,function(key, value){ $.each(value.topicdetails,function(k,v){ for(var i=0, len = k.length; i< len; i++){ alert(v[i]); } }); }); } it says there no property `length'. read this: $.each(data.items, function(key, value) { $.each(value.topicdetails.topicids, function(k, v) { cons

arrays - PHP: Can't use function return value in context - error -

arrays - PHP: Can't use function return value in context - error - i'm not sure i'm doing wrong, , did check other questions, , kind of inferred returning (something called "empty") supports variables, although didn't alter anything. i getting unusual error in code when run it, , can't create head or tails of it. fatal error: can't utilize function homecoming value in write context in /home/shortcu1/public_html/projects/friendcodes/newuser.php on line 103 this main function that's beingness called. (in file called newuser.php) function isbumping($forumid, $username, $premium){ if($premium == 'true'){ $file = file_get_contents('plist.txt'); // file i'm testing on echo 'running code premium<br>'; } else { $file = file_get_contents('list.txt'); } $forumid = $forumid.':'.$username; $posts = explode(' ', $file); $posts ($info,

tomcat7 - JENA TDBException: Root blocks must be at position zero -

tomcat7 - JENA TDBException: Root blocks must be at position zero - i'm new jena , triplestore, when deployed application in tomcat 7, i'm getting next exception. appreciate help give thanks you. exception jun 20, 2014 1:23:23 pm org.apache.catalina.core.standardwrappervalve invoke severe: servlet.service() servlet [servletadaptor] in context path [/triplestore] threw exception [a multiexception has 2 exceptions. are: 1. com.hp.hpl.jena.tdb.tdbexception: root blocks must @ position 0 2. java.lang.illegalstateexception: unable perform operation: create on au.com.rdf.triplestore.web.triplestoreservlet ] root cause com.hp.hpl.jena.tdb.tdbexception: root blocks must @ position 0 @ com.hp.hpl.jena.tdb.index.bplustree.bptreenodemgr.createemptybpt(bptreenodemgr.java:55) @ com.hp.hpl.jena.tdb.index.bplustree.bplustree.createifabsent(bplustree.java:215) @ com.hp.hpl.jena.tdb.index.bplustree.bplustree.create(bplustree.java:141) @ com.hp.hpl.jena.tdb.

javascript - change menu class active -

javascript - change menu class active - i want alter menu class active when click submenu. instead code set active default active menu. $('#menu1').find('li').click(function(){ //removing previous selected menu state $('#menu1').find('li').removeclass('active'); //is element sec level menu? if($(this).closest('ul').hasclass('second-level')){ $(this).parents('li').addclass('active'); //this parent element }else{ $(this).addclass('active'); } }); so illustration <ul id="menu1" class="nav navbar-nav"> <li class="active" > <a href="{{url::to('/')}}">{{ lang::get('messages.home') }}</a></li> <li class='dropdown '> <a href="#" class="dropdown-toggle" data-toggle="dropdown">

Why current tab changes on screen orientation change Android -

Why current tab changes on screen orientation change Android - i know why when screen orientation changed current tab changes default 1 in tabhost? i understand activity destroyed , created again, why state of tabhost isn't saved? per example, text of edittext saved , restored, why different current tab? have myself? thanks you responsible managing own tabs ( fragment transactions). follows if want particular tab selected have save state info prior configuration change. this may help (especially if follow link in answer): how can prevent current tab view beingness lost when rotating screen? by default, edittext saves own instance. see yalla t's reply here: how retain edittext info on orientation change? android

asp.net - Query string paramaters for a sitemap -

asp.net - Query string paramaters for a sitemap - i'm using vwd 2010, asp.net, c#. have sitemap works, need able link external sites , send parameters. found code looks should work, i'm missing kind of understanding or seem assuming know don't. (the other fellow seems have understood perfectly.) revised: adding show how menu , sitedatasource declared. <asp:sitemapdatasource runat="server" id="sitemapdatasource" showstartingnode="false" /> <asp:menu id="navigationmenu" runat="server" cssclass="menu" datasourceid="sitemapdatasource" enableviewstate="false" includestyleblock="false" orientation="horizontal" backcolor="#f7f6f3" dynamichorizontaloffset="2" font-names="verdana" font-size="0.8em" forecolor="#7c6f57" staticsubmenuindent=&qu

javascript - Animate position of div on scroll position -

javascript - Animate position of div on scroll position - what's best way animate position of div on scroll position? essentially, when reach point on page... fixed element animate up. i have included below have... it's little slow , seems slide up... slowly... half way... complete. thoughts? var shareheight = $('.related-share-container').height(); $('.related-share-container').css('bottom',-shareheight); $(window).scroll(function() { if ($(window).scrolltop() + $(window).height() > $(document).height() - 150) { $('.related-share-container').stop().animate({ bottom: 0 }, 500); } else { $('.related-share-container').stop().animate({ bottom: -shareheight }, 500); } }); update reward this dev site working on: http://goo.gl/kcfde6 , can see, if scroll bottom , stop, slides well, but, if maintain scrolling... it's interacting animation , can jumpy/slow transition. ideas? it happ

jquery - javascript: clean way of converting currencies from an array -

jquery - javascript: clean way of converting currencies from an array - folks! have written below code, converts 1 currencies , problem defining each & every currencies 1 1 in switch block, if have 100 currencies convert have write 100 switch cases there can create below code dynamic , short? var currencies = {}; $(document).ready(function(){ yahoo_getdata(); }); function yahoo_getdata() { var = new date(); var b = "http://someapiurl.com/webservice/v1/symbols/allcurrencies/quote?format=json&random=" + a.gettime() + "&callback=?"; $.getjson(b, function (e) { if (e) { var i, l, r, c; r = e.list.resources; (i = 0, l = r.length; < l; += 1) { c = r[i].resource.fields; //console.log(c.name, c.price); switch (c.name) { case "usd/eur": currencies.eur = c.price;

jquery - Making a progress bar in a circle -

jquery - Making a progress bar in a circle - i need create 'health' progress bar project, greenish represents filled in info , reddish empty data. got nice circle when reddish part 50%, value changes else border-radius messed up.. here have @ moment: html: <div id="progresswrap"> <span class="progressred"></span> </div> css: #progresswrap { width: 50px; height: 50px; display: block; background-color: forestgreen; -webkit-border-radius: 100%; -moz-border-radius: 100%; -ms-border-radius: 100%; border-radius: 100%; } .progressred { width: 50%; height: 50px; float: right; background-color: red; border-bottom-right-radius: 25px; border-top-right-radius: 25px; } http://jsfiddle.net/q48qf/ the width value of progressred class going dynamic jquery, perhaps alter border-radius create fit progresswrap again? wouldn't know how calculate border-radius needed in case.

Using php/javascript to make 3 dependent drop down menus that are populated from a MySQL database -

Using php/javascript to make 3 dependent drop down menus that are populated from a MySQL database - using php/javascript create 3 dependent drop downwards menus populated mysql database hi! new coding/web development. know popular topic , have spent hours reading forums , looking @ sample code, however: a) examples have found include info hard-coded , not pull info database, need do. b) examples utilize extentions mysql_query , mysql_fetch_assoc deprecated. think need utilize pdo unfamiliar that. here background database: there 1 table in database--"costs_table." fields trying populate drop downs "subsystem," ,"unit_cost_element" , "unit_cost_component." there 1:m relationship between these fields- subsystem has many elements, , element has many components. here sql statements want code doing each drop down: select distinct subsytem costs_table; select distinct unit_cost_element costs_table subsystem = $selectedsubsyst

Android duplicate thumbnail issue -

Android duplicate thumbnail issue - i creating custom image , video gallery whatsapp have allow user select multiple image/video,so far populating , showing thumbnails on gridview.but result is,on devices images got shown duplicated , on not.same happens video gallery also. i quering id of images mediastore.images and thumbnails using mediastore.images.thumbnails.getthumbnail from obtained ids below code final string[] columns = { mediastore.images.media.data, mediastore.images.media._id }; final string orderby = mediastore.images.media.date_added; imagecursor = activity.managedquery(mediastore.images.media.external_content_uri, columns, null,null, orderby+" desc"); int image_column_index = imagecursor.getcolumnindex(mediastore.images.media._id); int count = imagecursor.getcount(); thumbnails = new bitmap[count]; arrpath = new string[count]; log.d("c

android - How to make cross platform mobile apps? -

android - How to make cross platform mobile apps? - i know android apps development using java. , know ios- objective c used. but can see in different places requirement cross platform applications mobile devices. how possible? there's 2 mutual ways it 1)html , javascript. advantage run on web browser. disadvantage horrible performance, limited access special os features, uis limited web interfaces, browser specific bugs, , having write javascript (really, i'd rather have door slammed on fingers). 2)c or c++ business logic uis , glue code written platform. advantage run anywhere embedded devices phones pcs supercomputers, , lightning fast. disadvantage require better, higher paid programmers , may take bit more time write. 3)there's few efforts @ other languages xamarin c#. in between 2 above in performance, , otherwise have advantages similar 2, added disadvantage or not beingness supported , more break badly on new releases. android ios

workflow - XPDL / BPMN 2.0 - What are the objectives? -

workflow - XPDL / BPMN 2.0 - What are the objectives? - i'm little bit confused bpmn 2.0 , xpdl formats. they're complementary or have different objectives? bpmn < 2.0 graphic notation, , xpdl graphic notation / interaction of elements. but today bpmn 2.0 fits requirements of xpdl ? what's needing of bpmn engine back upwards xpdl ? thanks. as far know, bpmn 2.0 , xpdl not complementary. bpmn 2.0 provides both definition of graphical language , underlying xml standard. if bpx engine supports bpmn 2.0, not need back upwards xdpl, might so, e.g. in case interface xpdl compatible , not bpmn 2.0 compatible tool exists. i know sure there vendors , projects in area focusing on bpmn 2.0 , largely ignoring xpdl, e.g. bpmn 2.0 seems more successful in facilitating consent regarding interchange of diagrams: http://www.omgwiki.org/bpmn-miwg/doku.php workflow bpmn

datagridviewrow - How do i remove a row that is not equal to "0"? I tried this but it removes only 2 or 3 rows -

datagridviewrow - How do i remove a row that is not equal to "0"? I tried this but it removes only 2 or 3 rows - // lup goes through every row foreach (datagridviewrow row in datagridview1.rows) { if (datagridview1.rows[0].cells["payment"].value.tostring()!="0") { datagridview1.rows.remove(row); } not sure if removing rows while cycle through them, may skipping rows. if delete row , increment index, may skip next row. seek cycling backwards through table link suggests? similar question datagridviewrow

jquery - Javascript Execute message when mouse is on left side of page -

jquery - Javascript Execute message when mouse is on left side of page - does know how create when the mouse close or @ left side of page send message in javascript. when take mouse , move close left side utilize alert("example");. thanks, appreciate help. working fiddle fiddle html <div class="menu hide"></div> script call custom function when mouse leaving ,and in function ,if mouse hovered left side of window @ to the lowest degree 20px task want. var menu = $('.menu'); var menutimeout; $(window).on('mousemove', mousemovehandler); function mousemovehandler(e) { if (e.pagex < 20 || menu.is(':hover')) { // show menu if mouse within 20 pixels left or hovering on cleartimeout(menutimeout); menutimeout = null; alert("left side") } } javascript jquery html css

Can I convert boolean into another data type in Java -

Can I convert boolean into another data type in Java - i have next code: public class myfirstjavaprogram { public static void main(string []args) { boolean b = true; int x = b; system.out.println(x); } } as title say, can convert boolean type info type (in above example, char ), using java? no cannot. if looking one-line solution set int , can utilize ternary operation, such: int x = b ? 1 : 0; java type-conversion

php - Replace symbol with preg_replace -

php - Replace symbol with preg_replace - can utilize str_replace replace symbol? lets want <!-- hello there --> to [hello] i might easy some, still learning str_replace , preg_replace you can pass 2 arrays str_replace function. example: $find = array('<!-- ', ' there -->'); $replacewith = array('[', ']'); $string = '<!-- hello there -->'; $hello = str_replace($find, $replacewith, $string); check doc. php regex replace preg-replace

php - Ranking with ORDER BY DESC, but updates the column -

php - Ranking with ORDER BY DESC, but updates the column - hey have ladder ranking data: ignore wins, loses, lvl. the problem is, on team table have column ranking, ranking i'm using on table on image variable starts in 0 , increments 1 when finishes while cyclo. how update ranking column real ranking ordered points? you can update / join : update rankings r bring together (select r.id, @rn := @rn + 1 ranking rankings r cross bring together (select @rn := 0) vars order points desc ) rp on r.id = rp.id set r.ranking = rp.ranking; the subquery uses variables calculating ranking. php mysql sql

How to check if a GPS module is connected to a specific serial port on linux? -

How to check if a GPS module is connected to a specific serial port on linux? - what want do i need test presence , status of gps module on specific serial port /dev/ttys2 but can't find command so. additionnal informations i'm running on fedora 15 distro. i can launch gps daemon gpsd -g -n /dev/ttys2 and check daemon informations cgps everything fine values returned (my module live , connected). however, command doesn't allow external programme check if it's working should. any suggestions? ! write programme (inside external program) connects specified serial port , baud rate. asuming gps chip configured send in nmea format via serial port, receive nmea sentences 1 time second. each such nmea line starts $gp (for gps chips). if receive chip working. to receive more detailed configuration settings, have read manual of gps chip manufacturer. linux gps

c# - Proper use of Singleton in DAL and BO layer? -

c# - Proper use of Singleton in DAL and BO layer? - i'm tasked implementing business object / info access layer project , have expect thousands of users concurrently. i've used singletons manage dal never game much thought how behave many multiple users @ same time, i'd inquire proper utilize it. i have: public class userdal { private static userdal _userdal = null; //private constructor private userdal() { } public static userdal getinstance() { if(_userdal == null) { _userdal = new userdal(); } homecoming _userdal; } //example of method public user getusers() { idatareader datareader = connectionfactory.getconnection().executesomequery("queryhere"); } } for connection mill don't think it's problem, although did read it's best leave connection pooling ado.net itself: public sealed class connectionfactory { private static string _connectionstring = co

Sort hypen separated value in mysql varcharfield -

Sort hypen separated value in mysql varcharfield - how sort hyphen separated number in mysql varchar field. have list of number in field 700-657-1 700-657-10 700-657-2 700-657-3 700-657-4 if always have three-part (fixed count or can determine maximum count of parts) values, have 2 choices: consider rethink schema store info in separate columns (the exact parts should have meaning) parse string string functions, sort parsed values an illustration how sec option: select val, cast(replace(substring(substring_index(val, '-', 1), length(substring_index(val, '-', 0)) + 1), '-', '') unsigned ) first, cast(replace(substring(substring_index(val, '-', 2), length(substring_index(val, '-', 1)) + 1), '-', '') unsigned ) second, cast(replace(substring(substring_index(val, '-', 3), length(substring_index(val, '-', 2)) + 1), '-', '') unsigned ) 3rd test order first

ios - Potential leak of an object stored into CGImageRef -

ios - Potential leak of an object stored into CGImageRef - running code under xcode analyze i’ve stumbled next block - (uiimage *)imagewithfilter:(cifilter *)filter { cicontext *ctx = [cicontext contextwithoptions:nil]; cgimageref imageref = [ctx createcgimage:filter.outputimage fromrect:cgrectmake(0, 0, self.size.width, self.size.height)]; homecoming [uiimage imagewithcgimage:imageref]; } xcode complains potential memory leak: what going on? , how go fixing it? the next looks fix, still not sure if best way of handling on retained reference? - (uiimage *)imagewithfilter:(cifilter *)filter { cicontext *ctx = [cicontext contextwithoptions:nil]; cgimageref imageref = [ctx createcgimage:filter.outputimage fromrect:cgrectmake(0, 0, self.size.width, self.size.height)]; uiimage *image = [uiimage imagewithcgimage:imageref]; cgimagerelease(imageref); homecoming image; } ios objective-c xcode memory-leaks automatic-ref-counting

autocomplete - Is there a limit in Android on number of email address from contacts that I can fetch? -

autocomplete - Is there a limit in Android on number of email address from contacts that I can fetch? - i making android app when user starts typing email address, gets autocomplete suggestions phone contact book. if set limit on code fetch 100 address, works fine. if don't set limit, app freezes. haven't tried set higher limit , see , point gives up. how can optimize code? private arraylist<string> getnameemaildetails() { arraylist<string> emlrecs = new arraylist<string>(); **int count = 0;** // additional hashset<string> emlrecshs = new hashset<string>(); context context = getbasecontext(); contentresolver cr = context.getcontentresolver(); string[] projection = new string[] { contactscontract.rawcontacts._id, contactscontract.contacts.display_name, contactscontract.contacts.photo_id, contactscontract.commondatakinds.email.data, contactscontract.commonda

c++ - Moving Rectangle in SFML, how to make it smoother? -

c++ - Moving Rectangle in SFML, how to make it smoother? - this code: #include <sfml/graphics.hpp> #include <iostream> #include <windows.h> int main() { sf::renderwindow window(sf::videomode(800, 600), "sfml game"); window.setframeratelimit(200); //variable keeps game loop running bool play = true; //event object holding events sf::event event; //states button/events bool left = false; bool right = false; bool space = false; //variables int rectxposition = 375; //rectangles x position int rectyposition = 400; //rectangles y position //images sf::texture image1; if (image1.loadfromfile("images/greeksoldier.png") == -1) { std::cout << "failed!!!" << "\n"; homecoming 1; } //render shapes sf::rectangleshape rect; rect.setsize(sf::vector2f(77, 150)); //width , height rect.setposition(375, 400); /

django allauth facebook redirects to signup when retrieved email matches an existing user's email? -

django allauth facebook redirects to signup when retrieved email matches an existing user's email? - i able login via google , facebook using django (1.6.4) , allauth (0.16.1) , python (2.7) expected redirect settings.login_redirect_url in case when there isn't existing user emailid retrieved provider. however, when there exists user same emailid 1 retrieved provider (fb or goolge), redirects /accounts/social/signup/#= signup page asking: you utilize facebook/google business relationship login example.com. final step, please finish next form: email auto-filled. i have tested socialaccount_auto_signup = true or false , no effect. tried changing auth_type facebook, don't see options other "rerequest" i have next settings.py: account_authentication_method = "email" # defaults username_email account_username_required = false # defaults true account_email_required = true # defaults false socialaccount_query_em

c# - Adjust application controls to fit window size -

c# - Adjust application controls to fit window size - i need adjust height of controls: trvmenu , stackpanel (grid.column="1") , stackpanel(grid.column="3") , , height+width of: tabcontrol (width what's left). need them fit size of window of application when it's running, total screen, example. here's xaml: <window x:class="diagramdesigner.window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" ... <treeview name="trvmenu" horizontalalignment="left" height="312" ... </treeview> ... <stackpanel grid.column="1"> ... </stackpanel> </border> ... <tabcontrol x:name="tabcontrol" gri

ios - Dynamic number of Sections & Row in TableView -

ios - Dynamic number of Sections & Row in TableView - i beginner in objective-c , have lot of problem managing tables ! in case, have table variable number of sections, , each section, have variable number of rows. in method "gettimeslots" json represents list of appointments. here little piece of json: data{ "sunday, august 10, 2014" = { timeslots = ( { id = 1013; idpatient = "<null>" status = 0; timeend = 5:15 p.m.; timestart = 5:00 p.m; } { id = 1045; idpatient = "<null>" status = 0; timeend = 5:30 p.m.; timestart = 5:15 p.m.; } ); }; "sunday, july 13, 2014" = { ti

.net - How can I unzip Office Open XML file in C# and modify its data and re-zip again? -

.net - How can I unzip Office Open XML file in C# and modify its data and re-zip again? - from console application written in c#, how can : extract office open xml file, obtain info part of modify the info , re-zip again my motivation save excel file formats , utilize populate cells via console application. is possible achieve, need specific library provides excel files manipulation (unzipping it, modifying etc.) for zip-unzip part think can find many examples here. edit excel file, i'd suggest have @ open xml sdk. it, can edit office files programmatically. hope helps c# .net excel xlsx

angularjs - writing jasmine tests for Angular controller -

angularjs - writing jasmine tests for Angular controller - upon load of controller in angular perform bunch of initialization. initialization local while others via http calls. while writing testcases, in order check whether variables initialized should initialing controller in every test-case below: describe('on-load',function(){ it('should initialize scope.player xyz if some-dependency abc',function(){ createcontroller(); expect( .... ); } it('should initialize scope.player mno if some-dependency def',function(){ createcontroller(); expect( .... ); } it('should initialize scope.canvas.size 900',function(){ createcontroller(); expect( .... ); } } is right way of thinking writing jasmine tests angular controllers ? the controller created in each it block , think it's fine. angularjs jasmine

javascript - Use JS to show images dependant on element class -

javascript - Use JS to show images dependant on element class - i want show set of logos when searches product in specific category. logo image element hidden (display none) , have class category id. category determines logo gets shown. html 1 logo is: <li id="show-logo" style="display: none;"> <!-- playtex logo --> <img src="/images/logos/playtex.jpg" class="cat_1"> </li> so function should follows: showpartnerlogos(element, cat_id); function showpartnerlogos(element, cat_id) { // show images class cat_id element } i havent done code because js dismal, function beingness used show modal when searches product: $('#modal .spinner').spin('flower', 'black'); // loop through selected categories $("#form_buy input[name='buy_product']:checked").each(function() { $('#modal').find('.cat_' + $(this).val() ).show(); }); settimeout(func

c# - Attribute Route with constraint works locally but fails when deployed -

c# - Attribute Route with constraint works locally but fails when deployed - i have simple attribute route 3 different path segments: [httpget] [get("v{version:int}/{category}/{service}")] public async task<httpresponsemessage> routemessage( string category, string service, int version = 1) { } while routing works when developing locally, fails (404) when deploy iis server. the url fails: http://example.com/v1/search/products?client=test i'm it's not iis issue because can still access service using non-attribute routing (note though v1 isn't int, parameter has default value): http://example.com/api/route/?version=v1&category=search&service=products&client=test i've installed route debugging and, expected, route not match attribute route though should. the app-relative path listed ~/v1/search/products , should match url format v{version}/{category}/{service} ("version" correctly listed int route const

java - httpClient.execute does not show any response. -

java - httpClient.execute does not show any response. - public class mainactivity extends actionbaractivity { public bitmap bitmap; public static string exsistingfilename; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); log.d("tag", "first log message"); inputstream is=getresources().openrawresource(r.drawable.ic_launcher); bitmap = bitmapfactory.decodestream(is); //this gets image imageview myimageview = (imageview)findviewbyid(r.id.myimageview); myimageview.setimagebitmap(bitmap); seek { senddata(null); } grab (exception e) { e.printstacktrace(); } } public void senddata(string[] args) throws exception { seek { httpclient httpclient = new defaulthttpclient(); httpcontext localcontext = new basichttpcontext(); httppost httppost = new httppost("http://

jquery - Ajax call to PHP script returning status 0 after double refresh -

jquery - Ajax call to PHP script returning status 0 after double refresh - i had simple form used jquery ajax phone call php script , perform work. code worked 2+ years , sudden stopped working - , has weird behavior i've having problem debugging. here's html code: <div class="form-group"> <label for="commenter-name" class="col-sm-3">name</label> <div class="col-sm-9"> <input type="text" class="form-control" name="commenter-name" id="commenter-name" placeholder="enter name" value="" > </div> </div> <div class="form-group"> <label for="commenter-comment" class="col-sm-3">comment</label> <div class="col-sm-9"> <textarea class="form-control" rows="3" name="commenter-comment" id="commenter-com