Posts

Showing posts from July, 2010

c# - XML serializer returns null on object deserialization -

i have stored procedure in database returns xml stream, , application deserializes stream corresponding object. stored procedure defined (i simplified make more readable): select usrs.firstname 'firstname', usrs.lastname 'lastname', usrs.username 'username', usrs.datejoined 'datejoined' users usrs usrs.username = @username xml path('userprofile') notice username primary key, stored procedure return 1 result. sample query result this: <userprofile> <firstname>chuck</firstname> <lastname>norris</lastname> <username>chuck.awesome</username> <datejoined>2013-07-22t06:58:00</datejoined> </userprofile> now in application, how , deserialize data: internal static t getdata<t>(storedprocedures storedprocedure, parameterlist parameters) { using (var connection = getsqlconnection()) { using (var command = new sqlcommand(s...

7zip ISO extraction -

i have been trying extract iso image through 7zip , winrar. here command line used: 7z x -y "%isocontents%\iso.iso" -o%newfolder% winrar.exe x -y -ow "%isocontents%\iso.iso" "%newfolder%" entire project uses generic batch / 4nt scripting commands. above commandline works when used locally when run on actual machine extraction pretty partial. this strange , have no clue on reason be. while extracting says there 2 files readme.txt bootable_noemulation.img i totally frustrated totally not going per logic. please let me know if i'm missing out something. spent time on before writing !! thanks !! if you're not using same iso file, it's possible other file in udf format. check readme.txt file might have note indicating such. for 7z use -t switch 7z x -tudf -y "%isocontents%\iso.iso" -o%newfolder%

c# - How to create fast and efficient filestream writes on large sparse files -

Image
i have application writes large files in multiple segments. use filestream.seek position each wirte. appears when call filestream.write @ deep position in sparse file write triggers "backfill" operation (writeing 0s) on preceding bytes slow. is there more efficient way of handling situation? the below code demonstrates problem. initial write takes 370 ms on machine. public void writetostream() { datetime dt; using (filestream fs = file.create("c:\\testfile.file")) { fs.setlength(1024 * 1024 * 100); fs.seek(-1, seekorigin.end); dt = datetime.now; fs.writebyte(255); } console.writeline(@"write ms: " + datetime.now.subtract(dt).totalmilliseconds.tostring()); } ntfs support sparse files , there no way in .net without p/invoking native methods. it not hard mark file sparse, know once file marked sparse file can never convert...

c# - MEF not importing methods that has attribute which allows multiple -

created metadataattribute allows using multiple. [metadataattribute] [attributeusage(attributetargets.method, allowmultiple = true)] public class businesslogicmetadataattribute : exportattribute, ibusinesslogicmetadata { //...... } then using getexports<t>() import methods. //..... var imported = _container.getexports<action<object, evantargs>, ibusinesslogicmetadata>("myplugin"); //..... here plugin method: [businesslogicmetadata("myplugin")] [businesslogicmetadata("myplugin1")] public void test(object sender, eventargs e) { //.... } get exports not returning plugin method because of alowmultiple=true in metadataattribute . works fine if set metadataattribute allowmultiple = false , remove second attribute of plugin method. why can't have 2 attributes on plugin method? thanks help! not sure if work particular case since don't know entire design , ultimate goal, since you're creating me...

Style link based on page url with jquery, doesn't work with "www." -

i'm using bit of jquery style links on site based on page url: $(document).ready(function() { var url =window.location; $("#left a").each(function() { if($(this).attr('href') == url){ $(this).addclass('current'); } }); }); and html each link this: <a href="http://mysite.com/our-company.html">our company</a> the problem if tries go www.mysite.com/our-company.html, styling won't work. how can remove "www." variable? tried putting ".replace" in several different spots i'm newbie. i tried: $(document).ready(function() { var urla = window.location; var urlb = urla.replace("www.",""); $("#left a").each(function() { if($(this).attr('href') == urlb){ $(this).addclass('current'); } }); }); which tries redirect " http://mysite.com/www ." you need href of url, not url itself. using window.location...

c# - How to serialize as Json an object structure with circular references? -

i have object structure this: public class proposal { public list<proposalline> lines { get; set; } public string title { get; set; } } public class proposalline { public proposal proposal { get; set; } // <- reference parent object } i try serialize proposal json, tells me there circular reference, correct. unfortunately, can't touch objects, since in referenced dll project - otherwise i'd change them. is there way serialize json , ignore circular properties? use newtonsoft.json (which default .net json serializer) , set jsonserializersettings settings = new jsonserializersettings { preservereferenceshandling = preservereferenceshandling.objects }; var serializer = jsonserializer.create(settings); you can globally define variable if developing mvc applications...

java - group list facebook sdk on android not working -

im trying users group list. before ask how extract information "response" code: permissions: this.login = (loginbutton)findviewbyid(r.id.login_button); login.setreadpermissions(arrays.aslist("user_groups", "friends_groups")); request: request share = request.newgraphpathrequest(session, "/me/groups", new request.callback() { @override public void oncompleted(response response) { graphobject go = response.getgraphobject(); log.d("getting groups", go.tostring()); } }); first of few issues: 1. log.d line not showing. meaning app dosent call back. is code ok? how handle response, meaning how extract information? thank !

javascript - window.open sends the current window to 0 -

on page (we'll call it: domain.com/subdirectory/page.html ) have link this: <a href="javascript:window.open('someurl','_blank');">link</a> the new window opens perfectly, problem is, pre-existing window gets redirected {domain.com}/{subdirectory}/0 , can't figure out why it's adding 0 subdirectory , trying go there. i have tried moving window.open onclick , making href "void(0)" , changed span onclick, same results no matter option try. want new window pop , nothing happen page you're on. the same thing happens in ie9 , in chrome. the reason using window.open , not target="_blank" because want remove menu , other stuff window save space. answer discovered when summarized problem, simplified code make impossible answer (not intention of course). apologize this. here's actual window.open command (minus url): window.open('[hidden url]'_blank',height='400px',width='450px...

spring security - Keep users in Config.groovy list in Grails -

is there way define users can use application in list in config.groovy? using grails 2.2.3 , latest versions of spring security core , spring security ldap. we use active directory authentication, , 2 or 3 people use little application, doesn't seem worthy of making ad group app. simpler define list, , time there new hire instead of adding them ad group have add name external grails config. i following: somecontroller.groovy @secured("authentication.name in grailsapplication.config.my.app.userslist") class somecontroller { } then in config.groovy put code: my.app.userslist = ['bill', 'tom', 'rick'] is possible? if so, terrible idea? lot. that seems silly. why not have list of users in table? can add/remove table without have modify application. i , in userdetailscontextmapper make sure username exists in user s table.

asp.net - Multiple forms to get work -

i want insert same page login form , registration form. tried following: .. <body> <form runat="server"> .. <div id="login"> inputs , validations <asp:button .. /> </div> .. <div id="register"> inputs , validations <asp:button .. /> </div> .. </form> </body> as understand, form tag wraps whole code inside body (webforms' concept). each 'form' (login , registration) includes validations (client side & server side). when click button, of course, sends two 'forms' not before validation controls validate fields (in 2 forms). my goal separate them absolutely. thought not wrap code form tag , include 2 form tag, each form, break 'rule' , concept of webforms, guess. in addition, understood, cannot include 2 forms runat=server . can in situation? instead of trying have 2 forms on 1 page, forget form tag ...

c# - Binding in ItemsControl not bubbling to the item from ItemsSource -

here code have in xaml: <!-- itemscontrol print gdts on map overlay on tiles --> <itemscontrol itemssource="{binding gdts, mode=oneway}" grid.columnspan="3" grid.rowspan="3" panel.zindex="7"> <itemscontrol.itemspanel> <itemspaneltemplate> <canvas cliptobounds="true" snapstodevicepixels="true"/> </itemspaneltemplate> </itemscontrol.itemspanel> <itemscontrol.itemcontainerstyle> <style targettype="contentpresenter"> <setter property="canvas.left" value="{binding distancetoleft}"/> <setter property="canvas.top" value="{binding distancetotop}"/> <setter property="contenttemplate"> <setter.value> <datatemplate>...

ios - how to hide the navigation bar in delegate -

i want hide navigation bar in app. using tab bar controller in app. for hiding, using below code on tab first controller (and controller avoid error). -(void)viewwillappear:(bool)animated { [self.navigationcontroller setnavigationbarhidden:yes animated:yes]; } this hiding navigation bar on each controller can see navigation bar getting hided @ top. see effect. however don't want see effect , hence want hide navigation bar when app loaded. hence trying handle in - (bool)application:(uiapplication *)application didfinishlaunchingwithoptions:(nsdictionary *)launchoptions or - (void)applicationdidbecomeactive:(uiapplication *)application . any idea how can in delegate? main motto not see effect on each tab. atleast on home tab fine, don't want see on tabs. use animated:no instead: -(void)viewwillappear:(bool)animated { [self.navigationcontroller setnavigationbarhidden:yes animated:no]; } [self.navigationcontroller setnavigationbarhid...

xpath - Selenium - difference between @FindBy and WebElement.findElement() -

i using selenium test user interface. i trying use @findby-annotation. following piece of code works fine: @findby(how=how.xpath, xpath ="//input[contains(@id,'idofinputfield')]") private webelement somewebelement; private void somemethod(){ webelement = somewebelement.findelement(by.xpath("//a[contains(@class, 'ui-spinner-up')][1]")); webelement span1 = a.findelement(by.xpath("//a[contains(@class, 'ui-spinner-up')][1]")); webelement span2 = span1.findelement(by.xpath("//span[contains(@class, 'ui-button-text')][1]")); webelement b = span2.findelement(by.xpath("//span[contains(@class,'ui-icon ui-icon-triangle-1-n')]")); b.click(); } i use following code, because annotation-based, doesnt work, although think same: @findby(how=how.xpath, xpath ="//input[contains(@id,'idofinputfield')]" + "//a[contains(@class, 'ui-spinner-up')...

How can I set content font for pdf generation using wkhtmltopdf? -

i use wkhtmltopdf generate pdfs. sets header , footer fonts explicitly not find way set font of content.. in advance.. to convert html pdf wkhtmltopdf try avoid woff font face. use trutype format of google web fonts base64 encode. recently tried use google web font google web fonts. in browser shows correctly doesn't show after converting html pdf. then after searching lots of web @ last found tools encode fonts base64 encoded format , got css @font-face .

ms access 2007 - Combo Box with multiple selections clicking ok -

in access multi combo box have requires me click okay add selections box. there vb code make when check beside selections automatically adds them box when leave it? if using sharepoint database, add sharepoint tag post. if not using sharepoint, research indicates should not use multi-valued combo box. reference 1 reference 2 reference 3 reference 4 it's 1 of features provided access tries offer shortcut while undercutting database design. original classic lookup field. if still want use feature, vba might let smooth user experience using docmd.setwarnings.false , (later) docmd.setwarnings.true .

python - Converting PDF to html with PDFminer -

i trying use pdfminer command line tool convert pdf file html file, after running this pdf2txt.py -o output.html -t html casino.pdf i getting following error: traceback (most recent call last): file "/usr/local/bin/pdf2txt.py", line 101, in <module> if __name__ == '__main__': sys.exit(main(sys.argv)) file "/usr/local/bin/pdf2txt.py", line 87, in main layoutmode=layoutmode, laparams=laparams, outdir=outdir) typeerror: __init__() got unexpected keyword argument 'outdir' i have used library before , working perfectly, having hard time understand whats going on here link library http://www.unixuser.org/~euske/python/pdfminer/index.html it seems working after deleting , re-installing library

jquery - Submit button closes fancy box -

i have form display inside of fancybox modal. using jquery , ajax submit form. reason, when hit submit, fancybox modal closes. form gets submitted via jquery , ajax fine. problem because if there errors, supposed displayed inside of modal. can stop closing upon submit? my jquery , ajax: $("#change-pass").submit(function() { var datastring = $(this).serialize(); var $this = $(this); $.ajax({ type: "post", url: "change_password.php", data: datastring, success: function(html) { $this.parent().find('.tutorial-text').html(html); } }); return false; }); thanks! since using ajax, may need fancybox errors. add error handler ajax call : $("#change-pass").submit(function() { var datastring = $(this).serialize(); var $this = $(this); $.ajax({ type: "post", ...

http - IceCast 2.3.2-kh29 server streaming 404 Error -

i loading mp3 stream icecast 2.3.2-kh29 server in android app mediaplayer class. playing works well, stops happen. if see server responses in icystreammeta class id3 tags, there 404 error case. happens in windows 7: firefox , other browsers. here normal headers (some data ***ed): http://***:14534/***.mp3 /***.mp3 http/1.1 host: ***:14534 user-agent: mozilla/5.0 (windows nt 6.1; wow64; rv:22.0) gecko/20100101 firefox/22.0 accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 accept-language: ru-ru,ru;q=0.8,en-us;q=0.5,en;q=0.3 accept-encoding: gzip, deflate connection: keep-alive http/1.1 200 ok server: nginx/1.4.1 date: tue, 23 jul 2013 21:22:00 gmt content-type: audio/mpeg transfer-encoding: chunked connection: keep-alive icy-br: 192 ice-audio-info: bitrate=192;samplerate=44100;channels=2 icy-description: mp3 192 kbps icy-genre: *** icy-name: *** icy-pub: 1 icy-url: *** cache-control: no-cache expires: mon, 26 jul 1997 05:00:00 gmt pragma: no-cache so...

html - Text-align right not flush -

i have text aligned right within td. text aligning right lines not flush against border. <td style="text-align: right;"> <p> street address <br> state <br> country </p> </td> to solve quirk put text on 1 line in code , worked. <td style="text-align: right;"> <p> street address<br>state<br>country </p> </td>

Increase file upload size but cannot locate/access php.ini -

i'm testing file uploading page etc i'm working on. chose largish file @ random , received: request entity large the requested resource /admin.php not allow request data post requests, or amount of data provided in request exceeds capacity limit. as error message. brief google led changing values in php.ini can't locate or access it. the site hosted on free site 000.webhosting.org - i'm guessing have restricted somehow. there workaround? create .htaccess document , put in document root directory. inside, place: php_value upload_max_filesize 10m source: http://www.cyberciti.biz/faq/linux-unix-apache-increase-php-upload-limit/ honestly, i've never tried this, appears need. edit: here's else found, can try: ini_set("upload_max_filesize", "xm"); x number , m signifies megabytes. i'm not sure if works versions, it's listed being editable on php website ( http://www.php.net/manual/en/ini.list.php ).

php - "Array" is displaying in dropdown instead of values fetched from database -

code snippet html_form_class <?php $frmstr = $frm->addselectlist( 'city', $city, true, '', '--- select city ---', array( 'class' => 'dropdown-style5', 'id' => 'city')); echo $frmstr; ?> code snippet seachcar.php $city = $db->select('city','city_name'); foreach($city $row) { $row; } "array" displaying in dropdown instead of values fetched database please advice! function addselectlist($name, $option_list, $bval = true, $selected_value = null, $header = null, $attr_ar = array() ) { $str = "<select name=\"$name\""; if ($attr_ar) { $str .= $this->addattributes( $attr_ar ); } $str .= ">\n"; i...

javascript - Spacebar key not working in this particular input field -

hi have these tabs created jquery ui , have script if double click on title of tab, allow change name of tab. everything works including changing of tab names..etc. input field lets me change tab name not allow spacebar work? have never encounter before , coming here help. here snippet of code triggers double click change title. html: <li class="tab"><a href="#tab-1" title="cool">cool</a><span class="hide edit-field"><input type="text" value="cool" name="tab_title[]" placeholder="enter title" /><button name="edit" type="submit">done</button></span></li> js: $( '.tab' ).on( 'dblclick', 'a', function() { $( ).hide(); $( ).siblings( '.edit-field' ).show(); } ); $( 'button[name="edit"]' ).click( function() { // stuff here. } ); so stated works somehow spacebar g...

sql - Stored Procedure update with parameter a column name from a different table -

consider little script example create table customers (customerid int not null ,storeid int ,primary key(customerid) ) go create table stores (storeid int ,storename varchar(50) ,primary key(storeid) ) go alter table customers add foreign key (storeid) references stores(storeid) go insert stores values (1,'biggest store') ,(2,'mediumest store') ,(3,'smaller store') ,(4,'smallest store') go insert customers values (1,1) ,(2,1) ,(3,2) ,(4,3) ,(5,4) let's want use stored update called spupdatecustomerinformation takes 2 parameters: 1 customerid , other name of store user wishes update (storename stores table). in customers table record (1,1) means customer 1 bought biggest store . pass 2 parameters stored procedure spupdatecustomerinformation 1,'smallest store' , after stored procedure ran record (1,1) (1,4) . attempt create proc spupdatecustomerinformation @...

android - HTTP Post not working JAVA -

this question has answer here: how fix android.os.networkonmainthreadexception? 45 answers the problem whenever click login button on mobile app, app force closes. there ton of errors fill console.. basically i'm trying send user has typed in 2 text boxes .php page , session key back, used let app know user logged in. however, these errors have no idea how fix, , don't know why force closing. activity_main.xml <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" android:background="#004f00"> <linearlayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerhorizontal="true...

python - Use google.appengine.api.logservice outside of an app engine project? -

i'm trying write better way view logs color codes , allows filtering , such while developing locally on app engine, first need figure out how load logs external python application. this error i'm getting, , it's bit on head. traceback (most recent call last): file "pretty_logs.py", line 20, in <module> request in logservice.fetch(include_app_logs=true, start_time = time.tim e() + since): file "c:\program files (x86)\google\google_appengine\google\appengine\api\logs ervice\logservice.py", line 435, in __iter__ self._advance() file "c:\program files (x86)\google\google_appengine\google\appengine\api\logs ervice\logservice.py", line 449, in _advance response) file "c:\program files (x86)\google\google_appengine\google\appengine\api\apip roxy_stub_map.py", line 94, in makesynccall return stubmap.makesynccall(service, call, request, response) file "c:\program files (x86)\google\google_appengine\...

ISNULL in SQL Server 2008 -

today have encountered odd issue isnull function in sql i have table contains customer information have display full name concatenating first, middle initial , last name, in table know middle initial nullable column. so used isnull function in sql return middle initial if not null, works fine used isnull function expression below ideally should not work in case if mi null, interestingly worked. select firstname + ' ' + lastname + ' '+ isnull(mi + '.', '') middleinitial cs_tblmaster customerno = 2627240 above sol query should return me middleinitial "." when middleinitial null, did return empty string. so wrote query below. select (mi + '.') middleinitial cs_tblmaster customerno = 2627240 which again given null somehow when concatenate string null value returns null. understand of implementation. can – original statement select firstname + ' ' + lastname + ' '+ isnull(mi + '.', ...

c++ - Can I access strings from a .wxl localization file from a custom action with WiX? -

i have following wix markup instructs msi installer call custom action included dll: <customaction id="ca_setproperties_finalize" property="ca_oninstallfinalize" value="[installed],[reinstall],[upgradingproductcode],[remove]" /> <customaction id='ca_oninstallfinalize' binarykey='cadll' dllentry='msioninstallfinalize' execute='deferred' impersonate='no' /> <installexecutesequence> <custom action='ca_setproperties_finalize' before='installfinalize'></custom> <custom action='ca_oninstallfinalize' after='ca_setproperties_finalize'></custom> </installexecutesequence> <binary id='cadll' sourcefile='sources\ca-installer.dll' /> and dll has following c++ code custom action: #pragma comment(linker, "/export:msioninstallfinalize=_msion...

I want to get auto-generated channel's information(music, sports...) using YouTube API v3 -

i've got channel's id, playlist id , playlistitem's id. result different saw in youtube page. how can korean auto-generated channel information? https://www.googleapis.com/youtube/v3/playlists?part=id,snippet,contentdetails&channelid= {channel id} -> playlist id https://www.googleapis.com/youtube/v3/playlistitems?part=id,snippet,contentdetails,status&playlistid= {playlist} -> playlistitem id it worked except youtube auto-generated channels. plaese help..

Is it possible to include Google App Script (associated with spreadsheet) in JSP or call .gs function in a JSP -

i'm using google spreadsheet , html 5 create different charts in application. i'm using xmlhttp.responsexml , fetching spreadsheet , able display data. i want know how can call function of code.gs in jsp. function can simple one. ex. function getscripturl() { var url = scriptapp.getservice().geturl(); return url; } my actual purpose log activites in particular sheet in same spreadsheet. if i'm able call function in code.gs, easily. solution or better suggestion welcomed. thanks, shahid you can not directly call functions of *gs.file you can send , receive data through contentservice

javascript - AngularJS Routing Case Sensitivity -

i haven't been able find straightforward answer this, leads me believe it's really simple. either way, here go. all of calls in $routeprovider work great, case sensitive. here's code sample: config(function ($routeprovider) { $routeprovider. when('/', { controller: 'tmpctrl', templateurl: '/app/home.html' }). when('/foo', { controller: 'tmpctrl', templateurl: '/app/foo.html' }). otherwise({ redirectto: '/' }); }); what need add '/foo', '/foo', '/foo', etc, redirect same path? there option can pass $routeprovider toggle case sensitivity: config(function ($routeprovider) { $routeprovider. when('/', { controller: 'tmpctrl', templateurl: '/app/home.html' }). when('/foo', { controller: 'tmpctrl', templateurl: '/app/foo.html', caseinsensitivematch: true }). otherwise({ redir...

iphone - MBProgressHUD activity indicator doesn't show in viewDidAppear after segue is performed -

i have 2 uitableviewcontrollers , b, , i'm trying when click on table view cell in a: prepare segue b setting of b's variables a. perform segue b. b appears. display "loading" activity indicator [mbprogresshud][1] . in background task, retrieve data url. if error occurs in url request (either no data received or non-200 status code), (a) hide activity indicator, (b) display uialertview error message else, (a) reload b's tableview retrieved data, (b) hide activity indicator however, what's happening, , don't know how fix it: after clicking cell in a, b slides in right empty plain uitableview . mbprogresshud does not show . after while, tableview reloads retrieved data, mbprogresshud appearing briefly. the mbprogresshud disappears. there doesn't seem error way background task performed. problem is, how display mbprogresshud activity indicator b view controller appears? (and actually, how come it's not showing?) code bel...

json - php json_decode skippes some keys -

here json decode: {"somearray":[ { "id":71398, "prices":{ "simple":270, "vip":300, "sofa":540, "extra":320 } }, { "id":71399, "prices":{ "simple":190, "vip":190, "sofa":380 } }, {...} ]} note: items have price "extra", , not have it. json valid according online json validators. when try decode in php json_decode($json, true); (true - retrieve data associative array.) key "extra" ignored json_decode. so if var_dump() decoded resul or try $item['prices']['extra'] there no "extra" key-value in it. why??? this works fine when json valid: <?php $json = '{"somearray":[ { "id":71398, "prices":{ "simple":270, ...

How to create a blob to a file content and save it to postgre sql using ruby -

hi um facing issue of creating blob file , save binary column in postgre sql using rails . still dont have idea of how start it. happy if 1 can tell me way it. file.each_line |line| line = iconv.conv('utf-8', 'iso-8859-1', line) i want save file binary data (as binary large object) , file contains string if looking gem this, carrier-wave should helpflul: https://github.com/diogob/carrierwave-postgresql

java - Can I include persistence.xml file in my own .jar file? -

can include persistence.xml file in our own user define .jar file in jpa. if yes, please guide me how can add persistence.xml file in folder structure? yes can, persistence.xml goes in meta-inf/persistence.xml if packaging inside *.jar, or web-inf/classes/meta-inf/persistence.xml if packaging inside *.war

google app engine - Connecting GWT and PostgreSQL -

i've been working gwt , appengine. want change database relational one. prefer postgresql on mysql because of schema architecture. i work in projects jdbc, cannot make work in appengine project. what doing wrong? i think mistake. if want backend connect jdbc have disable appengine. i recommend creating new web project google eclipse plugin without appengine. copy source files , start there. i let class connect postgresql vua jdbc public class conexionbd { private vector <connection> connections = new vector<connection>(); protected int cantcon=3; private static conexionbd pool; private conexionbd(){ (int i= 0; i< cantcon;i++) connections.add(connect()); } public static conexionbd getpoolconnection(){ if (pool== null) pool =new conexionbd(); return pool; } private connection connect() { try { //setear driver class.forn...

php - How to make a dynatree from sql query results? -

i'm trying make dynatree selection of overlays googlemaps. screenshot here: http://i.imgur.com/tglhenn.png now i'm having trouble making dynatree's content dynamic. user's should able upload these maps , it'd available selected in tree. in screenshot, tree working content static because declared in .js file. turning php sql array "tree" array what's puzzling me. ideas? you need create json data or , js array query result, , can use ajax or children option set tree depending on needs.

java - Get complete path from URI - Nexus specific -

we have code running convert local uri path complete path. code doesn't seem work on nexus series (android 4.1+ jelly bean). code string[] proj = { mediastore.images.media.data }; cursor cursor = app.getinstance().getcontentresolver().query(contenturi, proj, null, null, null); int column_index = cursor.getcolumnindexorthrow(mediastore.images.media.data); cursor.movetofirst(); return cursor.getstring(column_index); i've read various thread on stackoverflow , relative 1 this one. solution provided in issue still persisting. basically path returned code this: /storage/emulated/0/folder_we_are_trying_to_access but in nexus there no emulated storage. trying see path various file managers seems path is: /storage/sdcard0/folder_we_are_trying_to_access any appreciated. in advance.

python - Processing files in memory -

i have file each line like name1 name2 name3 i can read in line line, split each line, process line , output processed line line. however read whole file in, sort middle column, output whole sorted file in same format input in. my first attempt splits each line read in make list of tuples, sorts using key= , rejoins each tuple , outputs line line. is there more pythonic way of doing this? something ought do: with open('datafile') fin: lines = list(fin) lines.sort(key=lambda line: line.split()[1]) open('outfile','w') fout: fout.writelines(lines) a few notes: my sort key bit ugly. however, advantage here preserves lines in input file. if split lines , sorted, code might little prettier, need join split lines correctly on output (plus, runs of whitespace might lost) outfile can same filename datafile make change "in place" if need support quoting of fields ( field1 "field 2" field3 ), you'll wan...

mysql - Multiple queries VS Stored Procedure -

i have application around 20000 data-operations per/hour data-operation has overall 30 parameters(for 10 queries). text, numeric. text params long 10000 chars. every data-operation following: a single data-operation, inserts / updates multiple tables(around 10) in database. for every data-operation, take 1 connection, then use new prepared-statement each query in data-operation. prepared-statement closed every time query executed. connection reused 10 prepared-statements. connection closed when data-operation completed. now perform data-operation, 10 queries, 10 prepared-statement(create, execute, close), 1o n/w calls. 1 connection (open,close). i think that, if create stored procedure above 10 queries, better choice. in case of sp, data-operation have: 1 connection, 1 callable statement, 1 n/w hit. i suggested this, told this might more time consuming sql-queries. it put additional load on db server. i still think sp better choice. please l...

filereader - Read From txt file in android in mobile device -

i have several txt file already.i want read files in application.i click button , choose name of txt file , read it. how it? pls me. you can put file in asset directory of projet , use assetmanager = context.getassets(); i think link can : http://www.technotalkative.com/android-read-file-from-assets/

DataType vs ContentType in jquery ajax -

this question has answer here: differences between contenttype , datatype in jquery ajax function 2 answers what significance of datatype , contenttype in jquery ajax ? purpose of both in client side request , server side response ? datatype: the type of data you're expecting server. contenttype: when sending data server, use content type. default "application/x-www-form-urlencoded; charset=utf-8", fine cases. if explicitly pass in content-type $.ajax(), sent server (even if no data sent). w3c xmlhttprequest specification dictates charset utf-8; specifying charset not force browser change encoding.

css3 - How do I override CSS set on a pseudo element? -

i know has been asked before, find no clean way of overriding css: .ui-input-search:after { content: ""; height: 18px; left: 0.3125em; margin-top: -9px; opacity: 0.5; position: absolute; top: 50%; width: 18px; } i need leave ui-input-search on element, can add own class, like: .ui-input-search-no-pseudo:after { content: ""; } question : there easy way remove "pseudo-css" without having overwrite css line line? thanks! as far can tell there no other way override properties. styles defined on element, won't disappear because of selector targets element. if want remove pseudo element page can content: none .

c++ - Function pointer type not recognized inside template class -

i have typedef define function pointer. typedef script*(*createobjectfn)(tixmlelement* node); i've created generic container purpose acts map. it's called dictionary, i've created dictionary of createobjectfn inside class this: class scriptbank { public: ~scriptbank(); static dictionary<createobjectfn>& getinstance() { static dictionary<createobjectfn>& registry = m_registry; return registry; } private: static dictionary<createobjectfn> m_registry; scriptbank(); }; i have various type of script in dictionary want put inside function of derived script. now template class: template <class t> class register { public: register() { scriptbank::getinstance().insert("some string", t::create); } ~register() { } }; inside derived script have like: static script* create(tixmlelement* node); static register<doorchstatescript> m_registry; my...

php - I cant get user email address on facebook -

i have big problem code. try write first facebook app. code cant email user, , dont know why. can me? require_once 'phpmailer.php'; require_once 'facebook.php'; error_reporting(0); //application configurations $app_id = 'my app id'; $app_secret = 'my secret id'; $site_url = 'my site url'; // create our application instance $facebook = new facebook(array( 'appid' => $app_id, 'secret' => $app_secret, 'cookie'=>true, )); $user = $facebook->getuser(); if($user == 0){ $user = $facebook->getuser(); } if($user){ $user_profile=$facebook->api('/me'); $logouturl= $facebook->getlogouturl(); if(empty($_post['send'])){ echo"<form method='post'>"; echo"hi ".$user_profile['name']."</br>"; echo"<textarea name='message' rows='6' cols='80...

java - Get severals class same name with JSOUP -

is there way html severals class same name plugin jsoup of java ? for example: <div class="div_idalgo_content_result_date_match_local"> blablabla </div> <div class="div_idalgo_content_result_date_match_local"> 123456789 </div> i'd blablabla in 1 string , 123456789 in another. i wish question understandable. this can done in several different ways. if want select div's class name above, can use following: elements div = doc.select("div.div_idalgo_content_result_date_match_local"); this give collection of element can iterate over. if after select perhaps first one, can use :eq(0) -parameter, or first() -parameter. element firstdiv = div.first(); or elements div = doc.select("div.div_idalgo_content_result_date_match_local:eq(0)"); note second method selecting document, while in first method select collection of element 's. can of course change value of :eq(0) else ...

html - Need equivalent CSS Selectors of an XPATH expression -

i have html code below : <div id="select_a_boundary" class="dataset_select2">homes name</div> i wrote xpath expression same: //div[@id = 'select_a_boundary' , @class = 'dataset_select2'] what equivalent css selectors same? first of if using id , don't require use class, secondly if willing yo select element id select_a_boundary can use #select_a_boundary { /* styles goes here */ } demo note: not selecting element has id , class here, id sufficient has unique, if using id multiple elements it's invalid as per comment div[id=select_a_boundary][class=dataset_select2] { color: red; } demo x-path equivalent or easier 1 (credits: jack ) #select_a_boundary.dataset_select2 { color: red; } note: still recommend use #select_a_boundary more enough

ruby - No Method Error // Helper // Rails 3 -

i'm trying admin avatar gravatar using email address. copied code ryan bate's railscast http://railscasts.com/episodes/244-gravatar the application helper: module applicationhelper def avatar_url(current_admin) if current_admin.avatar_url.present? current_admin.avatar_url else default_url = "#{root_url}images/guest.png" gravatar_id = digest::md5.hexdigest(current_admin.email.downcase) "http://gravatar.com/avatar/#{gravatar_id}.png?s=48&d=#{cgi.escape(default_url)}" end end end my application controller has helper :all my view has <%= image_tag, avatar_url(current_admin), :class => "img-circle" %> error nomethoderror , more specifically, undefined method 'avatar_url' #<admin:0x007fc4ae804ee8> the current_admin set devise. i looked through railscast , poor actually. @ 1 point ryan says add avatar_url user without giving hint data field should come from. s...

PHP MySQL Session -

we moved our website new server came new ip address. puzzles me; website login sessions not work on new server when change database ip old server working. mysql version old server = 5.1.58- community new server = 5.1.68 - community at first thought php error believe it's not , suspect mysql related. knows might have caused conflict? debugging error notice: session had been started - ignoring session_start() in c:\inetpub\wwwroot\gtest\libs\products.php on line 2 notice: undefined index: uusertypeid in c:\inetpub\wwwroot\gtest\admin\index.php on line 50 notice: undefined offset: 0 in c:\inetpub\wwwroot\gtest\admin\index.php on line 52 notice: undefined offset: 0 in c:\inetpub\wwwroot\gtest\admin\index.php on line 52 line 50 getusertype($_session['uusertypeid'], $usertypeid, $usertypedescr, $active_tag); line 52 if (($usertypedescr[0] == 'admin') || ($usertypedescr[0] == 'report')) let's go through notices in order: ...

plot - How to control xtics in gnuplot -

as title says, want control range , amount of xtics . use gnuplot plotting data files in horizontal axes time (t) taking values in interval [0, t_max]. ok, let's suppose following scenario: the maximum value of time 4086 , particular value not known beforehand. however, can found using stats "data.out" u 1 set xrange [0:stats_max] my question how can round maximum value of t closest hundred (4100 in case)? also, there way tell gnuplot print 5 ticks @ horizontal axes regardless of range (rounding maximum value closest hundred, or decade divided 5)? many in advance! to round closest hundred, use ceil function: set xrange[0: 100*ceil(stats_max/100.0)] regarding xtics , can set start, increment, end, , explicit tic position of tics, not number of ticks. since set xrange manually, can use information calculate tic frequency: x_lim = 100*ceil(stats_max/100.0) set xrange[0: x_lim] set xtics x_lim/4.0

ios - how to draw an arrow between two points on the map? MapKit -

Image
how draw arrow between 2 points on map? try calc latitude , longitude, goes wrong. best regards, max this code , result picture int currpoints1 = 2; nslog(@"!!!!!!!!%d ",numpoints); while(currpoints1 < numpoints) { trackpoint* current = nil; cllocationcoordinate2d* coordsarrrow = malloc((3) * sizeof(cllocationcoordinate2d)); (int =currpoints1, j=0; < numpoints; i=i+1, j++) { current = [cashpoints objectatindex:i]; coordsarrrow[j] = current.coordinate; if (i % 2 !=0) { int gug = 30; int ug; float bx, by, ex, ey; bx = coordsarrrow[0].latitude;by = coordsarrrow[0].longitude; ex = coordsarrrow[1].latitude;ey = coordsarrrow[1].longitude; float lstr = sqrt((ex-ey)*(ex-ey)+(bx-by)*(bx-by)); ug = [self retgradw:(abs(coordsarrrow[1].latitude-coordsarrrow[0].latitude)) h...