Posts

Showing posts from June, 2013

java - Why can't I install Eclipse? -

i trying install eclipse. > desktop-file-install eclipse.desktop > error on file "eclipse.desktop": key file not start group >name=eclipse >type=application >exec=/opt/eclipse/eclipse >terminal=false >icon=/opt/eclipse/icon.xpm >comment=integrated development environment >nodisplay=false >categories=development;ide; >name[en]=eclipse what wrong? ubuntu version 10.04 not know if plays role here. you need add [desktop entry] to top of file--it's group name command looking for. see here more information desktop entries.

mysql - Update Row in Table on Database for Each New User WebMatrix -

i have table (about_user) in database (startersite) supposed work each seperate row each seperate user. however, no matter user signed in, have access same row (in other words new rows aren't being created each new user). have triple checked make sure in database set correctly. using startersite template registration page (edited question): // if information valid, create new account if (validation.isvalid()) { // insert new user database var db = database.open("startersite"); // check if user exists var user = db.querysingle("select email userprofile lower(email) = lower(@0)", email); if (user == null) { // insert email profile table db.execute("insert userprofile (email) values (@0)", email); // create , associate new entry in membership database. // if successful, continue processing request try { bool requireemailconfirmat

android - How to set position of text in TextView/EditText -

for example, lets have for-loop , @ every iteration(let's textview t), t.settext(wordlist.get(i)). sets value of textview whatever last word in list is. want set words next each other. best way that? note: storing words in 1 big string not option you can use append method of textview. append string each iteration example: t.append(wordlist.get(i));

http - In Dart on server-side, how to set headers in HttpClient -

i trying use dart httpclient class (io library / server-side!) , can not think how equivalent of dart (client-side) call setrequestheader. specifically want set "content-type" "application/json" as per line (from client-side): request.setrequestheader("content-type", "application/json"); i'm using format: new httpclient().posturl(uri.parse(url)) .then((httpclientrequest request) => request.close()) .then((httpclientresponse response) => response.transform(new utf8decoder()).listen(_set_dbstats)); and when try insert: .then((httpclientrequest request) => request.head("content-type", "application/json")) i'm informed (in dart editor) head not method request... (although see in api?!) related being used post? thanks in advance! here snippet of working code evolved numerous tests , dealing issues outside scope of original question. guenter zoechbauer hero

html - CSS vertical height justification -

please auto vertical height div or li elements via css. when table: <table width="100%" border="1" cellspacing="0" cellpadding="0"> <tr> <td rowspan="5" height="600">img width=100% height=auto</td> <td>1</td> </tr> <tr> <td>2</td> </tr> <tr> <td>3</td> </tr> <tr> <td>4</td> </tr> <tr> <td>5</td> </tr> </table> as example , every cell in right column has 1/5 of left cell's height. how can without table , div or li elements? left cell's height not known; element responsive. <div style="width:100%;border:1px solid red;"> <div style="width:50%;height:100px;float:left;line-height:227px">test</div> <div style="width:49%;float:right;border:1px solid re

c# - DirectoryNotFoundException error while copying the file -

i trying develop web application send file server (in case server local one). when try send file, gives: directorynotfoundexception: not find part of path. i have verified folder exists. , ensure, create directory before copying still error. please? here code: string filename = system.io.path.getfilename("c:\\test\\sample.txt"); string savelocation = httpcontext.current.server.mappath("uploadfile") + "\\"; if (system.io.directory.exists(savelocation)) { system.io.directory.createdirectory(savelocation); system.io.file.copy("c:\\test\\sample.txt", savelocation, true); } the value of savelocation is: c:\users\nerd\documents\visual studio 2012\projects\webapplication3\webapplication3\uploadfile\ the system.io.file.copy needs second argument path file , not path directory. adjust code include name want file saved. string filename = system.io.path.getfilename("c:\\test\\sample.txt"); string savel

select - MySql how to count rows in 1 command -

hey got table workers , number of department work @ , need show amount of departments , there way in 1 select command? been trying use count , group manage show either total amount of workers or total amount of workers per department. p.s explain alittle better simple version , got table name / department john 5 jerry 4 josh 4 erik 1 in case need somehting : amount_of_departments 3 if use count( ) amount_of_departments ... group department 1 2 1 or if use count( ) amount_of_departments .... 4 if possible lacking basic sql knowledge since starter : x you looking count(distinct) : select count(distinct department) table t;

Matlab - modify class attributes -

i'm trying simulate car's position matlab. far have created class representing car public attributes position (obj.position), speed (obj.vist) , delta (obj.delat). delta represents time steps. when let car drive want change it's position adding actual speed. unfortunately isn't working... the code fprintf(' \n position: %4.0f', obj.position ); obj.position = obj.position + obj.vist*obj.delta; fprintf(' \n position: %4.0f', obj.position ); creates following output: position: 1000 position: what doing wrong? has handle or value class? i'm pretty sure question stupid im starting work matlab i'm needing here... thanks in advance. the class definition: classdef mycar < handle %untitled summary of class goes here % detailed explanation goes here properties id; typ; startzeit; vstart; posstart; position; vist; vsoll; vmax; laenge; aktiv = false; vmaxstrecke; poi;

Create img or iso on android -

i know if there way on android create iso or img file directory. want programmatically. thank much. have tried java iso image creator ? provides java api doing that.

php - Add custom field to Magento Admin (URL field) -

i'm trying add custom field in magento backend, @ configuration -> web section. want add additional url text space (can in of sections, url options, example, work well). how can that? have seen other people tried making custom module, category section. need @ web section though, have not had success yet. thank you! you can add custom field web section. best approach create custom module this. in system.xml need add section web section. more information on this blog .

How to Display XML With JavaScript -

i have xml: <school> <name>big school</name> <located>somewhere</located> <age>163</age> <students>53354</students> </school> i want add new element xml , display in browser. can use dom methods add new element not know how display in browser. found http://www.ehow.com/how_5941838_display-xml-javascript.html did not make work. i want see in browser: <school> <name>big school</name> <located>somewhere</located> <age>163</age> <students>53354</students> <teachers>18752</teachers> </school> can in simple way? you wrap in xmp element, preserve formatting , display markup (not interpret html). <xmp> <school> <name>big school</name> <located>somewhere</located> <age>163</age> <students>53354</students> &

django - Sorting Python lists of objects by keys with different names -

i used merge , sort 2 lists of objects both have "created" attributes datetime. i dit way , worked well: all_events = sorted( chain(list1, list2), key=attrgetter('created')) now, i'd add 3rd list in sort. problem datetime attribute of objects in 3rd list not named 'created'. how sort 3 lists in case? thank you. use lambda attribute fallback: all_events = sorted( chain(list1, list2, list3), key=lambda o: getattr(o, 'created', getattr(o, 'otherattribute', none)) this try either attribute, preferring 'created' .

sockets - Arduino loose serial-connection with our server -

we trying develop webapplication receive data arduino. programmed arduino send (on web server) json's every 5 seconds. works fine 1-2 minutes don't receive data arduino. tx keeps blinking our console shows empty string. ideeas? ps. baudrate set 9600 if tell :) here link code according github issue page ajson library, seems there memory leak in print(ajsonobject *) function, returns buffer char array allocated malloc() , you're responsible calling free() on again. calling function print(ajsonobject *, ajsonstream *), calls printvalue , print(ajsonobject *) , not keep references allocated array , consequently not free it. it seems making ajson send data directly stream work if modify functions call print(ajsonobject *) free memory. alternatively, can call print(ajsonobject *) yourself, send contents of char array out serial port, , free memory. easier modify many function calls in library itself. edit: seems problem indeed, have tried code on mega

Java Desktop file download -

while making desktop application,i want able download video file server , save in client's pc. how it?i have no idea. tools use?please guide looking forward kind of integrated ftp thing.i not clear how work. where wanna download file? direct url or youtube like? something that: public class downloadtofile { private url from; private string to; public downloadtofile(url url, string path_to) { this.url = url; this.to = path_to; } public downloadtofile(string url, string path_to) { try { this.url = new url(url); } catch(malformedurlexception e) { e.printstacktrace(); } this.to = path_to; } public void savefile() throws ioexception { bufferedinputstream in = new bufferedinputstream(this.from.openstream()); fileoutputstream out = new fileoutputstream(this.to); try { final byt

c# - Strange version shown for a Windows Phone 8.1 XAML app -

Image
i have created windows phone 8.1 xaml version of 1 of existing app. set package version 1.5.0.0, created file called slovakapps.windowsphone_1.5.0.1_anycpu_bundle.appxupload. when upload file dev center, strange version shown: is normal? seems strange me. from microsoft support: yes normal when submitting package support windows phone 8.1, automatically generates version number update.

ssl - requestClientCertificate error on browser -

i try request ssl certificate, doesn't work... when this: void main() { securesocket.initialize( database: './bin/security', password: 'dartdart' ); httpserver.bindsecure('127.0.0.1', 8443, certificatename: 'dart').then ((server) => server.listen((req) { req.response.write('hello'); req.response.close(); })); } it's ok, warning message certificate, proceed anyway, 'hello'. when add requestclientcertificate flag in bindsecure, browser ask me choose certificate list, choose one, on browser unable make secure connection server. may problem server, or may requiring client authentication certificate don't have. error code: err_ssl_protocol_error no error server side. i miss ? i'm on mac os marverick. try installing certificate chrome since said it's self-signed. chrome://settings show advanced settings... https/ssl -> manage certificates... import... (follow wizar

c# - Scale Y-Axis of a Chart depending on the Values within a section of X-Values for several Series -

Image
i have got aplication this: textboxes below chart user can set min , max of x-axis of chart. code it: private void textboxxaxismin_textchanged(object sender, eventargs e) { double x; //checks if input double , smaller max value //if (double.tryparse(this.textboxxaxismin.text, out x) && x < chart1.chartareas[0].axisx.maximum) if (double.tryparse(this.textboxxaxismin.text, out x)) { this.textboxxaxismin.backcolor = color.white; chart1.chartareas[0].axisx.minimum = convert.todouble(this.textboxxaxismin.text); //changeyscalamin(chartcharacteristiccurvesthermoelemts, convert.todouble(this.textboxcharacteristiccurvesthermoelementxmin.text), convert.todouble(this.textboxcharacteristiccurvesthermoelementxmax.text)); //method scale y axis } else //if textbox not highlighted this.textboxxaxismin.backcolor = color.orange; //calls max function update chart if max-value valid double y;

php - NetBeans 8.0 formatting, ( automatic join string when i push enter ) how to turn it off -

hello have problem netbeans 8.0. when push enter, in string netbeans automatically put me string new line , join string ".", need in 1 string. for example: want create: $variable = "some string , next string"; but netbeans 8.0 automatically creates me: $variable = "some string" ."and next string"; it not formatting me. how can turn off? in tools -> options -> editor -> code completion -> php -> quotes completion: use string auto-concatenation after typed break.

ruby on rails - Cross site session creation with Devise -

i'm working on project uses sessions manage logged in user slight twist, there no log in form on actual application. instead, site provide button should log in user , redirect profile page. for example, customer viewing profile on site a, 3rd party application. profile on site click on button should log them in site b , redirect profile on site b, site i'm building. i'm unfamiliar security concerns case this. initial thought if site posts via https user's email address , password, should work if filling form out on site, site b. what security concerns missing here or not work @ all? note: 3rd party site out of hands , i'll never convince team setup sort of oauth protocol, or @ least going take unacceptably long. plus, oauth, @ least understanding method accept requests number of 3rd parties. no other site except sitea ever attempt log people in. this sounds typical application oauth provider. get overview , grasp concept here: http://en.w

android - Picasso IllegalArgumentException -

i'm trying use picasso load facebook photos listview. i'm getting " java.lang.illegalargumentexception: target must not null " on line: .into(holder.userpicture); if userpicture imageview 'target', don't understand. guess has adapter, can't figure out what. all appreciated! edit i found problem. made careless mistake. on line, forgot convertview part: holder.userpicture=(imageview)findviewbyid(r.id.userpicture); logcat: 06-01 16:37:14.392: e/androidruntime(7885): java.lang.illegalargumentexception: target must not null. 06-01 16:37:14.392: e/androidruntime(7885): @ com.squareup.picasso.requestcreator.into(requestcreator.java:479) 06-01 16:37:14.392: e/androidruntime(7885): @ com.squareup.picasso.requestcreator.into(requestcreator.java:462) 06-01 16:37:14.392: e/androidruntime(7885): @ com.example.mywebsite.allproductsactivity$myadapter.getview(allproductsactivity.java:327) myadapter: public class myadapter extend

Ctrl + Space not working for content assist on eclipse -

Image
my problem content assist window won't pop after clicking ctrl + space . checked shortcuts , content assist bound ctrl + space . window automatically pops making suggestion after typing dot e.g., won't happen when using keys combination. eclipse version: eclipse java ee ide web developers. version: kepler service release 1 build id: 20130919-0819 my os ubuntu 12.04 if matters. i managed fix finally. problem ibus overriding shortcut deleted shortcut configuration. type ibus in dash: then select keyboard input methods . there click on first 3 dots next enable or disable textfield. windows should appear: if there bound ctrl + space delete it.

Watching changes in typeahead [angularjs+bootstrap] -

i have 2 typeahead .first 1 shows account groups . second 1 should show ledgers listed based on selection of first typeahed. this first typeahead <input type="text" class="form-control" required ng-model="newitem.customselected1" typeahead="account_group account_group.group_name account_group in account_groups | filter:{group_name:$viewvalue}"/> this second typeahead. <input type="text" class="form-control" required ng-model="newitem.customselected2" typeahead="ledger ledger.ledger_name ledger in ledgers | filter:{ledger_name:$viewvalue}"/> i have tried ng-change not provide me solution. update i have tried this $scope.$watch("newitem.customselected1", function (newitem.customselected1) { if(newitem.customselected2='abc') console.log(newitem.customselected2); }); but not giving te solution. please help something should work: &

Universal Google Analytics - grab some statistics to your own site -

i looking way, how can grab statistics google universal analytics site? there way display users statistics on site, grabbing analytics below? example: users today: 10 week: 70 month:270 total: 1500 i found couple of information google, not suitable topic. finding results old google analytics( without upgrading universal) , displaying statistic results, including charts. you can google analytics api stats looking for. end doing 3 different requests, because of fact request made dates. have problem getting correct count today , yesterday, because google analytics data hasn't finished processing yet takes 24 - 48 hours numbers correct. becouse of fact looking see own data recommend using service account authentication.

c++ - isalpha : If argv is not alphabets. How to conditionise? -

i have made program accepts 2 command line arguments in first argument file name itself, , second alphabetical keyword. if have reject numeric argument how conditionise, or write? my pseudocode: if argv[1] not alphabets reject it(return 1). how do this? sorry i'm newbie computer programming , c in particular. edit: second argument string. have check user enters string , no numberic value. if user inputs number, or string number( bacon11 ), program should reject , return 1; should do? my code looks this: // reject numeric value (int = 0, n = strlen(argv[1]); < n; i++) { if //todo: if letter not letter reject it. { return 1; } } what should write in todo line? cant conditionise code! you can use isalpha function. edit : code seems in way. nevertheless, not work, can give clues! check this tutorials understand if statement (you check isalpha example). don't forget argv 2 dimensional character array. specific characte

formatting - sml-mode for emacs does extremely strange things. Is there an alternative, or an easy elisp fix? -

i'm having lot of trouble getting sml-mode in emacs sanely indent code. example, here block behaving particularly strangely: datatype type_node = param of typaram.t | longid of longid.t | offset of field * field list option | list of type_t list | fun of type_t list * t list | | vproc | cont of tyarg.t list option | addr of type_t , dataconsdef_node = consdef of bomid.t * type_t option , field_node = immutable of int * type_t | mutable of int * type_t , fundef_node = def of attrs.t option * bomid.t * typaram.t list option * param.t list option * param.t list option * type_t * exp_t , varpat_node = wild | var of bomid.t * type_t option , caserule_node = longrule of longid.t * varpat_t list * exp_t | literalrule literal.t * exp_t | defaultrule

jquery - How to break when contents of a div is changing? -

Image
here code: <html> <head> <script type="text/javascript" src="c:\jquery2.js"></script> <script type="text/javascript"> $(document).ready(function() { $('#mydiv').html('hello world'); }); </script> </head> <body> <div id="mydiv"> text... </div> </body> </html> the scenario is, have no idea changing div content. how use chrome, firefox or firebug (pick one) work out changing 'mydiv'? ideally want able add break point on div before changes, @ point 'some text...' displayed on screen. step through code , see javascript code interacts div. after stepping through, see div content change 'some text...' 'hello world'. bonkers? please explain why if so. as want break on dom changes, , not code, can follows: google chrome devtools: press f12 c

mongodb - How to use pre-aggregation? -

i building stats online application. logging every hits mongodb. like log = {:user => 'devid',:activity=>'visited home page',:browser=>'chrome-5.3',:ip=>'10.11.35.211',:controller=>'home',:action=>'home_page',:created_at=>'2014-06-02 15:43:00'} mongo.insert(log) pre-aggregations controller-action combination log.daily.update ({_id=>'20140602-home-home_page',:metadata=>{:controller=>'home',:action=>'home_page',date=>isodate("2014-06-02t15:34:23")}},{$inc:{daily.3=>1}},{:upsert=>true}) pre-aggregations user combination log.daily.update ({_id=>'20140602-devid',:metadata=>{:user_name=>'devid',date=>isodate("2014-06-02t15:34:23")}},{$inc:{daily.3=>1}},{:upsert=>true}) similarly creating monthly , yearly aggregation. gives every hit webpage there total 7 collections need updated (1 need create

php - Creating simple SIP service -

recently i've discovered linphone offers ios sdk creating voip calls. integrate existing chat application , problem need make sip service on server gives me headaches. there out of box solution service can compiled , integrated mysql database? found opensips , kamailio , asterisk since i'm new in field complicated @ first. when start linphone example app can create sip user account using free sip service. need create similar service can used withing php script. i have experience in unix / linux , server side programming (php & mysql) pointing me tutorial helpful. a step step tutorial installing kamailio mysql backend available at: http://www.kamailio.org/wiki/install/4.1.x/git there web admin application named siremis written in php can used management of users gui.

Use window.innerHeight to set div height in html -

i have 3 div , want fixed header , footer 100px height, , midle dinamic height related window inner height. wrote bellow lines in html doesn't work. can help? many thanks. <div id="header" style="background-color:white;width:100px; height:12vh; margin: 0; padding: 0 ;border:0;"></div> <div id="map_canvas" style="background-color:black;width:window.innerheight-200;height:78vh;margin: 0; padding: 0 ;border:0"></div> <div id="footer" style="background-color:white;width:100px; height:10vh; margin: 0; padding: 0 ;border:0;bottom:0px"></div> window.innerheight javascript, not css. if want #map_canvas element have width of 100vh (see viewport-percentage lengths ) minus 200px can use css's calc() function : <div id="map_canvas" style="...width: calc(100vh - 200px);..."></div> jsfiddle demo . ideally shouldn't using inline styles

Adding advertisement to android application using php file -

i have created android application chatting whatsapp. want show advertisement @ specified location , content of advertise title,link,image fetch using php file.so how can this.please me if know.i have searched lot no solution found. i have solved problem creating popup window...i have created small strip layout contain textview,imgaview,button , on. popup.xml <?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:id="@+id/popup" android:color="#66ff0000" android:layout_height="wrap_content" android:background="#fff" > <imageview android:id="@+id/imageview1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignparentleft="true" android:layout_alignparenttop="true"

c# - Generating Unique 6-digit numbers per day -

i'm developing multi-process solution , have assign 6 digit unique numbers objects (specifying more 6 digits or using alphanumeric characters not possible. length of number third-party constraint). since multi-process solution (multiple instances of application run @ same time), cannot depend on using lock shared variables in project , i'd prevent using shared storage (db/file system/...) maintain , generate these unique numbers. also, it's highly unlikely need more 300,000 unique numbers per day. there algorithm (probably dependent on time of day) can generate unique 6-digit numbers per day? would possible divide groups of numbers give each thread? ie. if have total of 300 000 id numbers , 3 threads, can provide each thread interval work with. thread 1 -> 1 - 99 9999 thread 2 -> 100 000 - 199 999 thread 3 -> 200 000 - 300 000 you provide smaller intervals , thread gets assigned number of ids can use , when runs out has go , ask central

internet explorer 8 - IE 8 wont allow me setScr (mediaelement.js) -

i playing video mediaelement.js. works fine when want change source of video error: script438: object doesn't support property or method 'setsrc' anyone idea how fix this? code: function playvideo(source) { var fileformat:string player.pause(); if (modernizr.video) { fileformat = ".mp4"; } else { fileformat = ".flv"; } var sources = [ { src: 'media/'+ source + fileformat } ]; player.setsrc(sources); player.load(); player.play(); }

scala - Write to multiple outputs by key Scalding Hadoop, one MapReduce Job -

how can write multiple outputs dependent on key using scalding(/cascading) in single map reduce job. of course use .filter possible keys, horrible hack, fire many jobs. there templatedtsv in scalding (from version 0.9.0rc16 , up), same cascading templatetsv. tsv(args("input"), ('country, 'gdp)) .read .write(templatedtsv(args("output"), "%s", 'country)) // create directory each country under "output" path in hadoop mode.

php - How to know if the date is in past? -

i have field called "date2" in table users. it's this: "2014-06-01" need check if date in past. tried this, not working $result = mysql_query("select date2 users"); $json = array(); while($r=mysql_fetch_array($result,mysql_assoc)){ $date=$r; if (time() > strtotime($date)) { $result = mysql_query("update users set seat1='p',seat2='p',seat3='p',seat4='p',request_pass='p',payed=0 date2='$r'"); } } if want update users have date2 value in past ( e.g. expired) can in 1 query: update users set seat1='p',seat2='p',seat3='p',seat4='p',request_pass='p',payed=0 date2 < curdate()

Openstreetmap (Overpass API): Get nearest Node with a special tag -

i got point on map , i'm trying name of city (or suburb) in point is. first attempt this: <query type="node"> <bbox-query {{bbox}}/> <has-kv k="place" v="suburb"/> </query> <print/> but won't work me, if suburb-node isn't in bounding-box. there around-, nearest- or is-in-condition node? thanks lot! if looking city, country or otherwise named place given coordinate in, better of using geocoder. nominatim provides geocoding capabilities based on osm data. to answer original question: if feature searching not inside bounding box, can of course try extending bounding box. there around keyword searching something near else . note return all data matching given tags, not closest 1 given point. furthermore because overpass not geocoder won't work correctly features mapped area or relation instead of simple node .

knockout.js - kncokout, flat ui and bootstrap binding issue -

we using flat ui in project , have ui issues. file upload control issue. radio buttons/check boxes/drop downs css issue. file upload: normal html (design time) when select file it's showing change , remove button file name. whereas in durandal application it's not showing change/remove , file name in control, showing select button only. html content. <div class="pull-right col-xs-12 col-sm-6 col-md-6 form-group"> <label>upload condo logo</label> <div class="fileinput fileinput-new" data-provides="fileinput"> <div class="input-group"> <div class="form-control uneditable-input" data-trigger="fileinput"> <span class="fui-clip fileinput-exists"></span> <span class="fileinput-filename"></span> </div> <span class="input-group-btn btn

javascript - Is it possible to get a "screen shot" of only a single div -

i want users able take picture programmatically of design have made on site . design in div panorama extends off both left/right edge of screen. basically create .jpg, .png, etc of div , it's contents. is possible image magic , combination of other plugins? i've found way download 'screenshot' of single div using html2canvas (here's link: http://html2canvas.hertzen.com/ ) library. code generate canvas based on html of div, doesn't display it, converts canvas image (in case png image file) provides download link connected generated image: html: <div id="capture"><h2>this should save image</h2><p>amazing!</p></div> <p id="notice"></p> javascript: html2canvas($("#capture"), { onrendered: function(canvas){ img = canvas.todataurl(); document.getelementbyid("notice").innerhtml = "<a href='"+img+"' download='download

java - How to implement i18n(Subdirectories with gTLDs) in Spring Framework? -

i'm working on web application uses spring framework, spring (mvc), spring security, etc... spring documentation shows internationalization adding parameter in url, (e.g. http://myexample.com?lang=fr ) have read article google "multi-regional , multilingual sites" states practice not recommended. so decided implement way: http://myexample.com/ -> default locale (en) http://myexample.com/es/ -> locale es http://myexample.com/fr/ -> locale fr my question is: best way implement i18n (subdirectories gtlds) in spring framework? ideas, articles, examples welcome. <!-- defines interceptors locale change , theme change before request goes dispatcherservlet further operation. --> <mvc:interceptors> <ref bean="localechangeinterceptor"/> <ref bean="themechangeinterceptor" /> <!-- <ref bean="conversionserviceexposinginterceptor"/> --> </mvc

PyQt4 and Python 3 - Display an image from URL -

i found code displaying image url. code doesn't work python 3.4. think urllib seperated 2 modules on python 3 urllib.request. can't convert code display on python 3. from pyqt4.qtgui import qpixmap, qicon import urllib url = 'http://example.com/image.png' data = urllib.urlopen(url).read() pixmap = qpixmap() pixmap.loadfromdata(data) icon = qicon(pixmap) so how can display image on python 3 , pyqt4? thanks. try this: import sys pyqt4 import qtgui import urllib.request class example(qtgui.qwidget): def __init__(self): super(example, self).__init__() self.initui() def initui(self): hbox = qtgui.qhboxlayout(self) url = 'http://www.google.com/images/srpr/logo1w.png' data = urllib.request.urlopen(url).read() image = qtgui.qimage() image.loadfromdata(data) lbl = qtgui.qlabel(self) lbl.setpixmap(qtgui.qpixmap(image)) hbox.addwidget(lbl) self.se

ios - NSString, NSMutableString memory -

here have 2 string objects nsstring *name1 = @"julia"; nsstring *name2 = @"julia"; nslog(@"name1's memory: %p , name2's memory: %p", name1, name2); these 2 objects, because content same, automatically points same memory. this log name1's memory: 0x100002320 , name2's memory: 0x100002320 this same behavior exists in java programming language. next, same test nsmutablestring. nsstring *name1 = [nsmutablestring stringwithstring:@"julia"]; nsstring *name2 = [nsmutablestring stringwithstring:@"julia"]; nslog(@"name1's memory: %p , name2's memory: %p", name1, name2); this log name1's memory: 0x10010a4c0 , name2's memory: 0x10010a550 the results different. each of points own memory. how explain this? nsstring more efficient? in contrived example, same performance from: nsstring *name1 = [nsmutablestring stringwithstring:@"julia

javafx - Java EventHandler on Taskbar Icon -

is possible listen mouse click on icon shown in taskbar (not system tray)? problem using undecorated window gui, , causes me lose ability minimize application clicking on taskbar icon. minimize application via button have added scene. help.

c - Binary conversion code Segmentation fault -

i new programing in c (only 2 weeks it). unable figure out why code throwing segmentation fault. able program work if set long int num equal static number. need program able accept user input command line (not once program running) example: ./binary 7 should output binary number 7 is: 111 i have tried using strcpy(num, argv[0]) throws errors when compiling. #include<stdio.h> #include <string.h> #include<math.h> void dectobinary(long int num) // function definition { long int remainder[50]; int i=0; int length=0; printf("the binary number %d is: ",num); while(num > 0) { remainder[i]=num%2; // mod function num=num/2; // divides original number 2 i++; // increases count upcoming for-loop length++; // increases length display digits } for(i=length-1;i>=0;i--) // prints out binary number in order (ignoring

convert a complicated text to date format in ms excel 2007 -

Image
i have text in following (many lines): may 1, 2014, 11:26 ,second:51 ideas convert recognize-able (and can ordered) like: yyyy-mm-dd hh:mm:ss nice if can have column describing day (e.g. monday-sunday). appreciate help. best regards, ben it not clear question whether month abbreviated of written in full. may bad example. not clear if single digit hours have leading zero. next time, please provide bigger data sample. my suggestion formula create date/time value can formatted , sorted. =date(mid(a1,find(",",a1)+2,4)+0,match(left(a1,find(" ",a1)-1),{"jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec"},0),mid(a1,find(",",a1)-2,2)+0)+timevalue(mid(a1,find(":",a1)-2,8))+time(0,0,right(a1,2))+0 format result format prefer. screenshot has custom format yyyy-mm-dd hh:mm:ss

centos6 - how to add rhel-beta repo on centos 6.2? -

i want install xvfb on centos 6.2 , added repo refered in https://serverfault.com/questions/344793/install-xvfb-via-yum-yum-repository-for-xvfb/361304#361304 . found ftp://ftp.redhat.com/pub/redhat/rhel/beta/6/x86_64/os/repodata/repomd.xml invalid now, ...beta/7/... valid. can use repo? you can follow these steps so. 1) install rpm containing repo definitions $ su -c 'rpm -ivh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-5.noarch.rpm' 2) enable optional channel host logging rhn , enabling optional channel. according epel wiki page required resolve package dependencies. 3) make sure epel , optional channel enabled $ yum repolist learn more configuring epel @ fedora wiki . if prefer configure epel repo hand, follow these steps: 1) root, put following in separate file (with name ending in .repo) in /etc/yum.repos.d: [epel] name=extra packages enterprise linux 6 - $basearch #baseurl=http://download.fedoraproject.org/pub/epel/6/$ba

php - Get Multiple value from Multiple table in mysql? -

i make music online 's website . stuck when try track , playlist ,album created user order time created . have 4 table including : user,track,album,playlist : +---------------+------------------+ | field | type | +---------------+------------------+ | album_id | int(10) unsigned | | user_id | int(10) unsigned | | album_title | varchar(255) | | album_created | datetime() | +---------------+------------------+ | field | type | +---------------+------------------+ | playlist_id | int(10) unsigned | | user_id | int(10) unsigned | | playlist_title| varchar(255) | | plist_created | datetime() | +---------------+------------------+ | field | type | +---------------+------------------+ | track_id | int(10) unsigned | | user_id | int(10) unsigned | | track_title | varchar(255) | | track_created | datetime() | +---------------+------------------+ | field

android - How To Detect Is Text Human Readable? -

i wondering if there's way tell given text human readable. human readable, mean: has meanings, format article written somebody, or @ least generated software translator intended read human. here's background story: making app allows user upload short text database. @ stage of deployment noticed user uploaded corrupted text due problem encoding. problem fixed later, leaves me wonder if there's way pick non human readable text before serving text users. any advice appreciated. scope might large include other languages, @ moment let's limit discussion english only. you can try language identification tool, or similar. basically have count characters, or groups of character (character n-grams), , compare distribution of letters of text submitted distribution of letters of collection of texts written in english. (make sure such collection of texts representative of expected input). in continuity of n-gram approach might want try dictionary based approach

Python argparse static arguments -

i'm new argparse in python. my program can reset create, delete or reset password of account. python manager.py create <some_username> # create account delete <some_username> # delete account resetpw <some_username> mysql # reset mysql pw of account resetpw <some_username> unix # reset unix pw of account the arguments "create", "delete", "mysql" , "unix" static. how can implement in argparse? i've tried following: parser = argparse.argumentparser(prog='manager') parser.add_argument('create', action='store_true', help='create account') parser.add_argument('delete', action='store_true', help='delete account') args = parser.parse_args() but doesn't work. you're looking subparsers : import argparse parser = argparse.argumentparser(prog='manager') sub =

php - Wrong object passed to Mailer when upgrading to laravel 4.2 -

after upgrading 4.2 artisan gives error argument 1 passed illuminate\mail\mailer::__construct() must instance of illuminate\view\factory, instance of illuminate\view\environment given how can fixed? this issue resolved removing /bootstrap/compiled.php. should after every laravel upgrade

debugging - Java : the first letter of each line of a file dissapair on read -

i'm writing, training purpose, class used read/write/modify text file. my problem 1 of function (openfile), purpose convert text file content arraylist seem bugged : fist character of each line disappear. here java file, test script, , test script result: textfile.java /** * */ package files; import java.io.bufferedreader; import java.io.bufferedwriter; import java.io.file; import java.io.filereader; import java.io.filewriter; import java.io.ioexception; import java.io.printwriter; import java.util.arraylist; /** * @author erwan georget <egeorget@openmailbox.org> * @licence gplv3 * */ public class textfile { //-----------------------------------données------------------------------------ arraylist<string> arraystring; //--------------------------------constructeurs--------------------------------- public textfile(){//ok this.arraystring = new arraylist<string>(); } //------------------------------méthodes

twitter - Call back issue in twitter4j android -

Image
i using twitter4j library post on twitter android app. have followed question . having 1 issue displays login screen, after entering username , password, it's displaying screen. i tried display on sign in 4-5 times, still it's displaying me screen , not going app again. manifest file <application android:allowbackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/apptheme" > <activity android:name="com.objectlounge.obltwitter.mainactivity" android:label="@string/app_name" > android:launchmode="singleinstance"> <intent-filter> <action android:name="android.intent.action.main" /> <category android:name="android.intent.category.launcher" /> </intent-filter> <intent-filter> <act

Do Android automatically recycle the bitmaps sometimes? -

i try simple can.i have 1 activity , fragments replaced in frequently.main work done on each fragment manipulate bitmap viz applying sticker,rotate,filters etc... each fragment has method return manipulated bitmap , manipulated bitmap stored in reference of activity parent activity has class member variable of bitmap type holds latest manipulated bitmap of fragment. in code had never recycled bitmap explicitly. still when using bitmap parent activity's reference in 1 of fragment,its throwing exception bitmap recycled. have checked @ each point. the point generating bitmap fragment not recycled. the point @ assigning bitmap fragment parent activity's variable not recycled. when fetch bitmap again separate fragment shows bitmap recycled. hope got clear picture of problem..please guys

onsen ui - How to control page routes in the controller? -

onsenui great. fast , easy. however, there not documentation controlling onsen logic in controller. like instance, want $location.path('/newpath') inside controller. how done in onsen? tried "ons.navigator.pushpage('partials/latestjob.html');" in controller function doesn't work. limited ng-click in onsen go page? thanks. in onsen ui 1.04, can access navigator inside controller follows. $rootscope.ons.navigator.pushpage('new_page.html'); another way $rootscope.ons.$get('#navigator').pushpage(pagename); where #navigator id of navigator put on s.t. <ons-navigator id="navigator" page="page1.html"></ons-navigator> this method can choose navigator use. the third way 1 obtaining navigator scope. example, var element = document.queryselector( ".navigator-container"); var scope = angular.element( element ).scope(); scope.pushpage(pagename); the class name .navigator

ajax - cannot bind values to dynamically created textbox jquery -

i'm trying bind jquery autocomplete result dynamically created textboxes, have searched internet , forums couldn't found appropriate solution, i'm sharing code jquery: function bindautocomplete(classname) { $("." + classname).autocomplete({ source: function (request, response) { $.ajax({ url: '/admin/ticket/getpart', type: "get", datatype: "json", data: { term: request.term }, success: function (data) { if (data != null) { if (data.length > 0) { response($.map(data, function (item) { return { label: item.partnumber, value: item.partnumber }; })) } else { response([{ label: 'no results found.' }]);