Posts

Showing posts from July, 2010

python - pip install lxml and gdal failing in anaconda env -

i've had persistent problems trying install frameworks , packages requiring gdal or lxml using pip within anaconda env. i'm running osx 10.8 anaconda-installed python 2.7.5. i've got xcode 4.6.3 command line tools installed. on packages requiring lxml or gdal (just every gis package) clang errors. these error 1 or error 254. have gdal framework installed , (apparently) functioning qgis (though refers system python , not anaconda distribution). have anaconda- provided lxml, seems working scripting purposes within env. have tried updating lxml, no effect. 2 sample logs included @ end of question. apologies question bit long... the commonly repeated advice seems to xcode , clt. said, i've done that. the other idea i've seen on web has c compiler used build anaconda python distribution osx. know absolutely nothing c compilers, know pip installs packages system python without issue. when start system python get: python 2.7.2 (default, oct 11 2012, 20:14:37) ...

.net - Is there a way to find a 'friendly' name for an executable given its path? -

i'm creating ui has buttons start number of .exe files in own thread. i know path .exe files, i'm wanting display friendly application name rather file name of executable. of applications referenced big name applications microsoft word or skype; not in house exe files. as example, path may be: "c:\program files\microsoft office\office15\winword.exe" but in ui want display button "word" on it. i've noticed in registry many applications store friendlyappname in area of registry can access follows: command.text = microsoft.win32.registry.getvalue ( "hkey_local_machine\software\classes\applications\" + io.path.getfilename(path), "friendlyappname", io.path.getfilenamewithoutextension(path) ) but many applications name isn't present. know if there better way friendlyappname? you can use filedescription property of fileversioninfo class. var info = fileversioninfo.getversioninfo( ...

java - How to ImageIcon Array List resize in following code -

i have imageicon array list , has many sizes of icons, need set them specific (85*100) size. how this? code follow: file file = new file("c://users/ks/desktop/db"); if (file != null) { file[] files = file.listfiles(new filenamefilter() { public boolean accept(file file, string filename) { if (filename.endswith(".png")) { return true; } else { system.out.println("no jpg files"); return false; } } }); system.out.println("current dir : " + file.getcanonicalpath()); list<imageicon> images = new arraylist<imageicon>();// array list (int fileinlist = 0; fileinlist < files.length; fileinlist++) { system.out.print(files[fil...

c# - Converting image from project folder -

i trying convert image in image folder , image name defaultimage , update database table. but having problem in line of code: i change code using this: image uploaded6 = image.fromfile("/image/defaultimage.jpg"); instead of this: system.drawing.image uploaded = system.drawing.image.fromstream( ~/images/defaultimage ); i getting error of filenotfoundexception unhandled user code i have tried method using fileupload control , working fine not sure how convert image in folder. how image folder in order convert using method shown below. image uploaded6 = image.fromfile("/image/defaultimage.jpg"); //system.drawing.image uploaded = system.drawing.image.fromstream(); system.drawing.image newimage = new bitmap(1024, 768); using (graphics g = graphics.fromimage(newimage)) { g.interpolationmode = interpolationmode.highqualitybicubic; g.drawimage(uploaded, 0, 0, 1024, 768); } byte[] results; using (memorystream ms = new memorystream()) { ...

c# - Adjust brightness in windows phone 8 -

i want able adjust brightness in windows phone 8 programmatically using c#. possible ways that? api brightness unavailibale. however there possible workarond: overlay view black border , change opacity of border.

Conversion failed when converting date and/or time from string SQL Server -

i surprised, while copy , paste 'mon, 26 aug 2013 5:32:44 gmt' in database table field of type datetime in editable mode update cell while executing query declare @manoj date set @manoj = 'mon, 26 aug 2013 5:32:44 gmt' update nk_news set pubdate =@manoj id= 70 here pubdate datetime field it generate error conversion failed when converting date and/or time character string is there way find query run @ editable mode in sql server management studio. set @manoj = stuff(replace('mon, 26 aug 2013 5:32:44 gmt', ' gmt', ''), 1,5, '')

dojox.grid - Dojo (1.9.1) datagrid does not render if not a direct child of body -

i have problems rendering datagrid in custom widget. i able pinpoint problem this: datagrids not direct child of body do not render correctly. showcase: <!doctype html> <html> <head> <title>problems datagrid</title> <meta charset="utf-8"> <link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/dojo/1.9.1/dojo/resources/dojo.css"> <link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/dojo/1.9.1/dijit/themes/claro/claro.css" media="screen"> <link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/dojo/1.9.1/dojox/grid/resources/grid.css"> <link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/dojo/1.9.1/dojox/grid/resources/clarogrid.css"> </head...

reporting services - SSRS Repeating group headers? -

Image
i have data daterecived jobnumber reccnt 20130626 1234 1 20130627 1238 11 20130628 1240 2 20130629 1242 23 i applied group on daterecieved in ssrs , output daterecived jobnumber reccnt 20130626 1234 1 20130627 1238 11 20130628 1240 2 20130629 1242 23 total 37 but want output daterecived jobnumber reccnt 20130626 1234 1 total 1 daterecived jobnumber reccnt 20130627 1238 11 total 11 daterecived jobnumber reccnt 20130627 1240 2 total 2 daterecived jobnumber reccnt 20130628 1242 23 total ...

java - confusing Android SDK error: static reference to non-static method -

can explain why in line 6 of following code (contained in .java file i'm working on in adt eclipse ide) i'm getting error marker: "cannot make static reference non-static method getremotedevice(string) type bluetoothadapter" import android.bluetooth.*; public final class bluetooth{ void initconnection(string address){ bluetoothsocket sock = bluetoothadapter.getremotedevice(address).createinsecurerfcommsockettoservicerecord(00001101-0000-1000-8000-00805f9b34fb); } } what in above code makes static? , why not handed same error use of createinsecurerfcommsockettoservicerecord method of bluetoothdevice? you can't can't call getremotedevice() on bluetoothadapter class, it's not static method. need instance, this: bluetoothadapter adapter = bluetoothadapter.getdefaultadapter(); bluetoothsocket sock = adapter.getremotedevice(address) .createinsecurerfcommsockettoservicerecord(00001101-0000-1000-8000-00805f9b34fb); ...

php - calculate two consecutive days with XYZ values within a week in a month -

i have database in mysql , have table named user_daily_data_recorded . have following columns date_of_record steps_walked member_id the table contains data of each , every date , populated regularly. want send congratulation mail user/members who have walked 15000 steps @ least 2 days per week on month (say in month february user1 has walked 15000 on monday , thursday receive congratulatory mail) . should do? let me know if question not clear. file containing script executed once per month. need find 2 days 15000 steps per week in a particular month. if want know how select users should e-mail today, help: select member_id user_daily_data_recorded uddr # selects users created record today. join (select distinct ( member_id ) id user_daily_data_recorded date_of_record = curdate()) todays_users on todays_users.id = uddr.id # selects users below 15000 steps yesterday. join (select distinct ( me...

visual studio - Handling white space and formatting in source control -

i work on team uses tfs source control. team members complaining others checking in files have been heavily modified in sense ide (visual studio) has done sort of automatic formatting on them. particularly burdensome on users make heavy use of comparison functionality. admittedly unfamiliar nuts , bolts of visual studio. 1 member has suggested use same editor settings doesn't happen. is having team members adopt same code editor settings best way handle problem? having use same settings idea in general. if adheres same format, settings, , conventions, can reduce "learning curve" when switching between code person wrote. that being said, if of differences whitespaces may indicate shortcoming of diff tool. fortunately, visual studio allows swap out built-in diff tool of choosing. have find 1 works best needs. kdiff3 pretty one. here's example on how configure kdiff3 visual studio . there's setting (possibly command line parameter) in kdiff can set...

javascript - Side-effect free version of Underscore.js default function? -

to initialize object using default values using underscore's default function. according documentation, works this: var foo = _.defaults(object, *defaults) it described as: fill in undefined properties in object values defaults objects, , return object. property filled, further defaults have no effect. although works fine, there 1 thing stumble upon: side effect of manipulating original object. if run var foo = { bar: 'baz' }; and say var bar = _.defaults(foo, { dummy: 23 }); not only, bar has property called dummy , original foo object has been changed well. current workaround is: var bar = _.defaults({}, foo, { dummy: 23 }); unfortunately, can forget this. think it's quite strange behavior defaults function changes input parameter returning result return value. should either or. how deal situation? there better ways deal this? the function doing it's documented do. it's not uncommon modify objects passed functions, ...

google app engine - Webapp2 List (and/or kill) All Sessions for User (Appengine Python) -

i'm working on appengine app using webapp2. based authentication off of ideas put forward in this article . i added ability delete account (it's requirement of app), , i've run issue sessions. if user logged in more 1 location, there 2 auth tokens user. when account deleted 1 of logins, session login destroyed. however, other login have auth token in datastore. i altered user_required / check_login decorator/function first looks user in session. if doesn't find one, let client know need login in. if find one, user datastore. if none, assume there multiple logins, , different 1 deleted account (which deletes user). therefore, kill session, , tell client user no longer exists. otherwise, check if user verified, , if isn't tell client user has verified before anything. i'd rather able kill sessions user if account deleted. there way this? want functionality can have feature logged in user can see of sessions user, , kill/revoke them @ (sort of facebook ,...

ios - How exactly does AFNetworking work? -

hi all, i've played asihttprequest , afnetworking while, today, try read source code of afnetworking more deeply, it's powerful , designed network framework, got several questions ask: 1, afjsonrequestoperation : nsmutableurlrequest *request = [httpclient requestwithmethod:@"post" path:kmobilebind parameters:paramsbase]; afjsonrequestoperation *operation = [afjsonrequestoperation jsonrequestoperationwithrequest:request success:^(nsurlrequest *request, nshttpurlresponse *response, id json) { //successblock } fail:^(nsurlrequest *request, nshttpurlresponse *response, nserror *error, id json){ //failblock } after this, operation created , success block , fail block set it, start operation, starts nsurlconnection in singleton thread, [self performselector:@selector(operationdidstart) onthread:[[self class] networkrequestthread] withobject:nil waituntildone:no modes:[self.runloopmodes allobjects]]; inside operationdidstart: [self.lock lock]; nsrunlo...

android - Pinch and Zoom imageview -

i have task pinch , zoom imageview, have made app swiping images , working fine; want pinch , zoom imageview on same class ;but not able this.i have gone through various example seems nothing helping in case.below code,or provide me example problem. imageview.setontouchlistener(new ontouchlistener() { @override public boolean ontouch(view view, motionevent event) { bitmap = bitmapfactory.decoderesource(context.getresources(), image_id[position]); bmpwidth = bitmap.getwidth(); bmpheight = bitmap.getheight(); distcurrent = 1; dist0 = 1; drawmatrix(); float distx, disty; switch(event.getaction() & motionevent.action_mask){ case motionevent.action_down: //a pressed gesture has started, motion contains initial starting location. touchstate = touch; break; case motionevent.action_pointer_up: //a non-primary pointer has gone up. touchstate = touch; break; case motionevent.action_pointer_down: //a n...

php - how to get variable from multipe forms when one of them already submit -

i have 2 form <form name='theform' id='theform' method="post"> and <form id="frmdate" action="?page=absensi" method="post"> i submit first form this <input type="radio" name="keterangan" value="hadir" onchange="theform.submit();" /> second form this <script type="text/javascript"> jquery(function(){ $('#tgl').daterangepicker({ arrows:true, onchange: function(){ $('#frmdate').submit(); }//removed comma here }); }); </script> i can variable 1 of forms this <?php $keterangan = ""; $date1 = ""; $date2 = ""; if(isset($_post["keterangan"])){ $keterangan = $_post["keterangan"]; } elseif(isset($_post["tgl"])){ $dates = explode(...

c# - Copy Table to another Table with indexes, triggers, ... NOT trough Sql Server Managment Studio -

this question has answer here: copy access table structure , constraints using c# or sql 2 answers short situation sketch (i have many databases have same table, can have different indexes or triggers or ...) i'm trying create program can make exact copy of table (including indexes, triggers , other constraints). part of data should copied new database. know can through ssms option generate , publish scripts, great if have 1 or 2 times. i'm faced more databases. i'm looking way in code (or script). have idea? if dont want use tools within ssms, or other third-party tool generate scripts, may have - use meta-data stored in sql server regarding table, columns, indexes (stored in different information_schema views ) retrieve info need, , use build scripts need. you can see example of with answer .

javascript - Jquerymobile Panel link problems -

i'm trying configure slide-panel jqm 1.3.1. created "one page-jqm"-pages 1 index.html , several now im trying slide panel work when add second page, page stuck in loading screen. my code explain mean: <!doctype html> <html lang="de"> <head> ... <link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.css"> <!-- jquery , jquery mobile --> <script src="http://code.jquery.com/jquery-1.9.1.min.js"></script> <script src="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.js"></script> </head> <body> <!-- page 1 --> <div data-role="page" id="page1"> <div id="header" data-theme="c" data-role="header"> <a id="men" data-role="button" href="#menue" data-icon="grid" data-iconpos="note...

r - How to change character string into yearqtr -

i have dataseries looks like: gdp <- structure(c(4.61992172242418, 4.6566625355851, 4.36946546173971, 4.84162425714203, 5.27383573389955, 5.13243064162054, 4.95781801538584, 5.26294884122223, 12.5001588735103, 14.5451731219964, 10.3624546107312, 10.3243661354426), .dim = c(4l, 3l), .dimnames = list(null, c("in.gdp.fc", "in.gdp.real", "in.gdpnagri")), index = c("apr-jun 2012", "jul-sep 2012", "oct-dec 2012", "jan-mar 2013"), class = "zoo")` how can change index 'yearqtr' class? tried doing as.date , as.character. throwing error saying: error in chartodate(x) : character string not in standard unambiguous format. can please help? 1) remove , including minus , use as.yearqtr appropriate percent codes : library(zoo) gdp.yq <- gdp index(gdp.yq) <- as.yearqtr(sub(".*-", "", index(gdp)), "%b %y") 2) works , shorter: library(zoo) gdp...

iphone - Proper Encoding for chines character from NSData -

please me i'm using below code file name. here i'm getting nsstring nsdata multipartdata nsmutablearray contain nsdata . nsstring* postinfo = [[nsstring alloc] initwithbytes:[[multipartdata objectatindex:1] bytes] length:[[multipartdata objectatindex:1] length] encoding:nsutf8stringencoding]; i'm getting string like: printing description of postinfo: content-disposition: form-data; name="file"; filename="??:??.png" but should like: printing description of postinfo: content-disposition: form-data; name="file"; filename="华语/華語.png" thanks in advance. obviously server doesn't encode response using utf-8, another chinese-only encoding . need use content-type header detect encoding is, , find appropriate nsstringencoding using following code; // set charset mime charset server cfstringconvertencodingtonsstringencoding(cfstringconvertianacharsetnametoencoding((__bridge cfstringref)(charset))); here d...

javascript - Google+ box hiding on hover -

look @ code: http://codepen.io/lgarcia/pen/fwine share box working good. when hover on g+ share something, writing box hides inmediately without having time share anything. +1 button working, why behavior? help? ps: don't use plugin or something, need fix script.

javascript - PHP's json_encode and JS's JSON.stringify -

i'm using both php , javascript build kind of web service. try validate token calculated on post parameters, sent js php. let's code follows: js : token = json.stringify(params); php : token = json_encode($_post); can please explain me why 2 resulting json strings doesn't have same length ? (i tried trim \n\r\t in php, stripslashes in php, several js libs) php version of string have more characters. in javascript, json key without quote valid. in php, json key without quote not valid. (in fact, right json syntax quotes on keys.) so you’re right, difference came json.stringify strip quotes integer key.

XPath: returning the index of specific tag inside a set of tags with the same type -

here excerpt of xml: <table> ... <tbody> <tr> <td></td> <td></td> <td></td> </tr> <tr> <td></td> <td></td> <td></td> </tr> </tbody> </table> i know how find specific <tr> tag. is possible define <tr> tag index or ordinal number inside <tbody> tag? guess, it's possible loop through table, table quite large , take lots of time. is possible index/ordinal number single xpath statement? i've used following xpath expression: //tbody//td[text()='findme']/../following-sibling::tr these expression calculates, how many 'tr' nodes located under node 'findme' text. actually, useful, because quantity of 'tr' nodes obtained. but, prior given xpath, verification should made, because in case 'finme' string absent, ...

Android app - using AsyncTask - stops opening a URL in WebView, it is opened by the default browser if I call another URL -

i'm beginning develop in android using material http://developer.android.com . i took 1 of examples , modified it, application can connect webpage. works when opened if click on actionbar item should open page new page isn't opened in webview, it's launched default browser. i tried in many way understand how avoid that, little experience didn't allow me fixe problem. can me? many thanks. nino public class mainactivity extends activity { public static final string wifi = "wi-fi"; public static final string = "any"; public static string pagina ="http://www.kibao.org/simu/wap.php?lng="; public static string base ="http://www.kibao.org"; public static string attuale =""; public static string lng = ""; final context context = this; private static boolean wificonnected = false; private static boolean mobileconnected = false; public static boolean refreshdispl...

javascript - What is the fastest levenshtein algorithm for high frequent use -

this question has answer here: sort array “levenshtein distance” best performance in javascript 7 answers for client side search tool need find levenshtein distance of word millions of other words. user should able compare short text of twenty words book. user finding locations of characterizing words of text in book. 'finding locations'does not mean looking exact match match levenshtein. started available implementations needed more speed. ended this: var rowa = new uint16array(1e6); var rowb = new uint16array(1e6); function levenshtein(s1, s2) { var s1_len = s1.length, s2_len = s2.length, i1, i2 = 0, a, b, c, c2, = 0; if (s1_len === 0) return s2_len; if (s2_len === 0) return s1_len; while (i < s1_len) rowa[i] = ++i; while (i2 < s2_len) { c2 = s2[i2]; = i2; ++i2; b = i2; ...

vbscript - Use vbscripting to write into a file which is created with a batch file -

i have text file created use of windows batch echo >myfile.txt attrib +h myfile.txt is possible access 1 (myfile.txt), through vbscripting writing things, knowing file has been not created using vbscripting. if so, please let me know how? thank in advance

How to find sub-journey matches in Google Maps using asp.net? -

as know using "get directions" put starting point , destination , google maps shows marked route. question if person x travels b on route a-a-b-b, , other person y travels b sub part of b,then how can match both traveling on same route. in other words there path same or in cases part of path same. important have in asp.net web application. thank

Check If a Windows Service is Installed or not? (C++) -

this question has answer here: check if services installed using c 2 answers i have written windows service in c++, works perfectly, want add feature when try install can first check has been installed or not? i have tried ideas on how task there not there. of quesions , tutorials c# programmers , using servicecontroller task, unable access such class in c++. http://msdn.microsoft.com/en-us/library/system.serviceprocess.servicecontroller.aspx the above link shows no example class in example portion , says that: "no code example available or language may not supported." other information: using windows 7 64 bit, visual studio 2008, language c++. any sort of highly appreciated. thanks. update: leave answer below, duplicate of this , marked such. you use openservice win32 api. returns handle service, or null if service in question not...

c# - How to Get the Main Window of a process(not the window handle)? -

this question has answer here: get wpf window hwnd 4 answers i have been trying reference main window of process quite sometime. went through many sites looking solution. looks provides solution window handle , not window itself. getting process's mainwindow handle quite straight forward. seem window title expected. i went through of apis provided user32.dll couldn't find looking for. i need reference window because want access few members of window class accomplish work. window referring wpf window. any in regard highly appreciated:) thanks in advance. you can use hwndsource.fromhwnd method. here's simple linqpad-ready example: void main() { var mw = new mainw(); mw.show(); var hwnd = findwindowbycaption(intptr.zero, "testwindow"); var rootvisual = system.windows.interop.hwndsource.fromhwnd(hwnd).rootvis...

authentication - How do we get the macid or any other unique identifier in php for the login system -

i have build login in website bind system. e.g. user can login through machine has registered. i not able mac id or other unique identifier through php can bind login. have hosted website on shared hosting, cannot install new library. standard libraries available. let me know if there best possible ways same. there no unique id of machine, @ all. mac addresses don't transition network boundaries, ip addresses not unique , volatile. beyond have in http headers, not unique or permanent either. the best can set non-expiring cookie on machine unique id , depend on that; i.e. make own id. that'll create problems when user switches browsers or machines or cleans cookie storage though, make sure have procedure in place case. cookies may hijacked, prepare procedure case , transact on ssl secured connections minimize likelihood of occurring. in short: depending on physical machine of user problematic on web, since web explicitly designed client-agnostic. machine id...

a string or function that includes multiple variables (c++) -

i've searched multiple places , watched through entire "thenewboston" c++ guide on youtube, , yet find answer this. i'm writing program practice c++ skills, i'm still noob think possible don't know how it. the program i'm trying make 1 records how many reps excercise when training in gym. #include <iostream> #include <cstdlib> #include <string> using namespace std; int main() { string biceps = "biceps"; string triceps = "triceps"; string quads = "quads"; string musclechoice; cout << "welcome mypt!" << endl; cout << endl; cout << "what going training today?" << endl; cout << endl; cout << "**biceps** \n\n**triceps** \n\n**quads**" << endl; cout << endl; cin >> musclechoice; if ((musclechoice == "biceps") || (musclechoice == "triceps") || (mu...

html - Why do all links change colour when only one is clicked? -

i'm stumped on 1 - have pretty basic document ordered list containing anchors , hidden divs show when link clicked. problem when 1 link clicked links change colour per a:visited css rule . not happen in ie10 (only visited link changes colour expected) happen in opera, chrome , firefox . here's markup: http://jsbin.com/usuwece/3/edit - i'm pretty new web design obvious, appreciated. cheers! that's because point same url, when click on 1 return they've been visited.

Screen orientation of an android application -

is possible write code on android manifest file automatically change screen orientation according device screen size?. may you: instead of fixing orientation on manifest, use setrequestedorientation . on oncreate method of each activity, check if on tablet or smartphone , set desired orientation. another option creating multiple apks different screen sizes , depending on needs.

c# - Where to save SQL Server connection string in a client console application? -

i creating windows console application monitor attendance of users. when user logging in computer(connected network) windows login time should updated in sql server database. all client computers connected using network. the question save database connection string server? if save connection string (encrypted) in console application running in client application, create problem if there change in server name/username/password after few months. please advice best approach problem. you indeed store in application configuration file (see @noone's answer more details). however, mind should not store username , password there. you have following options: (a) encrypt connectionstrings configuration section. has administrative "issues" have discovered ymmv. (b) don't store username , password, query them user during runtime; optionally allowing them specified command line parameters - although has issues of own: parameters (and username/password)...