Posts

Showing posts from September, 2014

django - NoReverseMatch Reverse for '' with arguments '()' and keyword arguments '' not found -

i have in django view: edit_url = reverse('ventas:clientes_edit',kwargs={'id':str(self.object.id)}) and in urls.py: url(r'^clientes/edit/(?p<pk>\d+)$',forms.clienteupdateview.as_view(), name="clientes_edit"), when create new customer via ajax need return reverse url id in json data put in series of actions buttons edit, delete... error , don't know how accomplish it, complete error: noreversematch @ /ventas/clientes/add/ reverse 'clientes_edit' arguments '()' , keyword arguments '{'id': '38'}' not found. any ideas? edit: the django version 1.5 the kwargs should pass pk not id match url edit_url = reverse('ventas:clientes_edit',kwargs={'pk':self.object.id}) also url expects int pk not string.

Difference between Post & Get method in Json Parsing in ios -

i implement json parsing follow: -(void)getallevent { sbjson *json = [sbjson new]; json.humanreadable = yes; responsedata = [[nsmutabledata data] retain]; nsstring *service = @"/getallvenue"; nsstring *str; str = @"calagary"; nsstring *requeststring = [nsstring stringwithformat:@"{\"cityname\":\"%@\"}",str]; //nslog(@"request string:%@",requeststring); // nsstring *requeststring = [nsstring stringwithformat:@"{\"getalleventsdetails\":\"%@\"}",service]; nsdata *requestdata = [nsdata datawithbytes: [requeststring utf8string] length: [requeststring length]]; nsstring *fileloc = [[nsbundle mainbundle] pathforresource:@"urlname" oftype:@"plist"]; nsdictionary *filecontents = [[nsdictionary alloc] initwithcontentsoffile:fileloc]; nsstring *urlloc = [filecontents objectforkey:@"url"]; urlloc = [url

javascript - Split string after 3 times repeated <br> -

i have small problem, have tried solve 3 hours now. i have text this: <div> hello name andreas <br> nice meet <br><br> regards andreas <br> <br> <br> <br> <br> <br> <br> <br> <br> </div> i remove <br> , after have occured 4 times in row <br><br><br><br> . i have tried split , replace, can't twist work desired way. hope can help:-) you : str = str.replace(/(<br>\s*){4,}/g,'<br><br><br>') .replace(/meat/g, 'meet'); demonstration

c# - Different date format in same model -

hi doing project in mvc4 using c# i have model [displayformat(dataformatstring = "{0:ddd, d mmmm yyyy}")] public datetime eve_date { get; set; } that take date sql database (date stored in db mm/dd/yy format time).my problem that, show date in 2 view pages, 1 page shows date sun, 11 august 2013 (@html.displayfor(modelitem=>item.eve_date)) and page shows 8/11/2013 12:00:00 am(@model.eve_date). in case of localhost shown 31-07-2013 pm 05:00:00(@model.eve_date). when published difference shown. can identify actual problem. want show date in pages format sun, 11 august 2013 1st page is @model ienumerable<....models.eventdetails> <tbody> @foreach(var item in model) { <tr><td class="evname"><a href="~/event/eventdetails/@item.id">@html.displayfor(modelitem=>item.eve_na)</a></td> <td class="evdate">@html.displayfor(modelitem=>item.eve_date)</td>

android - Unable to open Eclipse on windows7. Could not load SWT library. Reasons: -

i newbie on android on phone gap . using windows 7 based machine. i trying develop application on phone gap android . i had installed android adt bundle , phone gap plugins in eclipse . and trying create application, giving me , error . (build 1.5.0.25458) [error] unabled create browser control:firefox no more handles (java.lang.unsatisfiedlinkerror: not load swt library. reasons: no swt-xulrunner-win32-4234 in java.library.path no swt-xulrunner-win32 in java.library.path can't load library: c:\users\tom\.swt\lib\win32\x86_64\swt-xulrunner-win32-4234.dll can't load library: c:\users\tom\.swt\lib\win32\x86_64\swt-xulrunner-win32.dll )

delphi - How can I use Tidhttp to make a Get request with a parameter called xml? -

i've been using delphi 2010 make http requests, 1 service expects parameter called 'xml' request fails 'http/1.1 400 bad request' error. i notice calling same service , omitting 'xml' parameter works. i have tried following no success: httpget('http://localhost/service/messaging.svc/sendreports/pdf?xml=<?xml version="1.0"?><email><message><to>email@internal.com</to><from>from@internal.com</from></message></email>&id=42&profile=a1'); ... function treportingframe.httpget(const url: string): string; var responsestream : tmemorystream; html: string; http: tidhttp; begin try try responsestream := tmemorystream.create; http := tidhttp.create(nil); http.onwork:= httpwork; http.request.contenttype := 'text/xml; charset=utf-8'; http.request.contentencoding := 'utf-8'; http.httpoptions := [hoforceen

objective c - Generate RTF, PDF and MS XML output files -

does have suggestions generating rtf, pdf , ms xml reports xcode ? i thinking of creating objective-c classes no doubt may exist. to answer own question... subclass nsdocument , generate formatted text using nsattributedstring, nstextblock, nsparagraphsstyle , on... add attributedstring nsdocuments textstorage. add methods nsdocument provide list of supported output formats available nsattributedstring save dialog. it's not simple works ok , can used generate formatted documents. things can't figure out how following: make use of rtf \stylesheets ms word picks styles used different programs. creating new sections, chapters , pages (e.g. rtf tag \page) creating headers , footers. if knows whether of these supported apple text system please let me know. can custom rtf generator prefer stick standard api's if exist. thanks

Quick way to convert CSV types to original types with PowerShell's Import-Csv cmdlet? -

i'm using powershell v2 , have custom type i've defined called material using code this: add-type @" public struct material { public string businessunit; public string source; public string primarysource; public string legacymaterialnumber; } "@ ...and i've got collection of objects of type i'm writing csv file using export-csv cmdlet. works fine , produces data original type specified this: #type material businessunit,source,primarysource,legacymaterialnumber bu1,nafo,nafo-fg,17502 bu1,nafo,nafo-fg,17504 bu1,nafo,nafo-fg,17739 bu1,nafo,nafo-fg,17837 bu1,nafo,nafo-fg,17841 the issue i'm running when import data using import-csv each line created type: csv:material ...instead of original type started with: material in specific case issue because want pass each material function parameter typed material . parse each row , rebuild material objects data of course, there quick way import csv data original type?

android - CSS Elements change physical size on higher density screens -

i developing android app phonegap , pixel density being problem. developed app using 4.0" screen 320px 480px. fine, elements sized using pixel unit in css. i told pixels in css unit , change on high density screens. tested app on friends 4.0" phone. phone 480px 800px. higher screen resolution. in app tiny, buttons far small click on. so question how best go dealing this. there settings can use in android manifest? or should change units in css (that take while). what standard way of dealing situation html , css powered android apps? if helps using jquery mobile, alot of overriden styles. use media queries and/or use percentage values instead of fixed pixel values. check article responsive design http://alistapart.com/article/responsive-web-design

c# - SQLBulkCopy - WriteToServer method not working -

i'm trying export data excel file mdf database. that, i'm using excel data reader , sql bulk copy : using system; using system.collections.generic; using system.linq; using system.text; using system.io; using excel; using system.data; using system.diagnostics; using system.data.sqlclient; namespace bulktest { class program { static void main(string[] args) { filestream fs = file.open(@"c:\users\maarab\desktop\list_personnel 2013.xlsx", filemode.open, fileaccess.read); iexceldatareader excelreader = excelreaderfactory.createopenxmlreader(fs); datatable dt = createdatatable(); string cx = @"data source=.\sqlexpress;attachdbfilename=|datadirectory|\datatest.mdf;integrated security=true;user instance=true"; sqlbulkcopy bcp = new sqlbulkcopy(cx, sqlbulkcopyoptions.keepidentity); bool first = true; while (excelreader.read()) {

ruby - rails showing blank page -

in rails app need implement conditional search form .there 2 tables named tweets , coordinates , output showing blank page , stuck dis. coordinates_controller class coordinatescontroller < applicationcontroller def home end # def paramas(b) # # @b = params[:show] # return @b end #def coor(latitude,longitude) # @latitude=0 #@longitude=0 #end def query @a=coordinates.find("city=?", params[:show]) if(params[:show]= a.city) latitude= a.latitude longitude=a.longitude end if(latitude=0 && longitude=0) return sql="select * tweets tweet_text '%text%' , user_loc 'params[:show]' order id desc" else if (latitude!=0 && longitude!=0) min_lat = latitude - 1.0 max_lat = latitude + 1.0 min_lng = longitude - 1.0 max_lng = longitude + 1.0 return sql = "select * tweets tweet_text '%text%' , ( ((longitude

sql server - Adjacent List - How to retrieve all sub nodes of a given parent by id? -

i have table so id parent title 1 null cars 2 1 ford 3 2 hatchback 4 2 saloon 5 3 fiesta 6 4 mondeo i need query return list of sub nodes specfic id. for example, if want subnodes of id 2, get 3 2 hatchback 4 2 saloon 5 3 fiesta 6 4 mondeo if wanted subnodes of id 3, get 5 3 fiesta a word of warning, tree can many levels deep, not few levels have shown above of simplification. presume query need recursive in way? you should use recursive query: with t1 ( select t.* t parent=2 union select t.* t join t1 on (t.parent=t1.id) ) select * t1 sqlfiddle demo

How can a Chrome extension get a user's permission to use user's computer's microphone? -

if run html5's web speech api's javascript codes below in website on chrome, chrome ask user's permission use of user's computer's microphone. var recognition = new webkitspeechrecognition(); recognition.start(); but if run codes above on chrome extension's page, chrome doesn't ask users give permission. how can chrome extension user's permission use user's computer's microphone? thank you. i think have implement yourself. in chrome extension's manifest.json, there permissions parameter. think first have permission use microphone in file. don't know parameter called can check in documentation. this permission warning shown when user installs extension. after that, extension can turn microphone on/off @ volition. seek permission user, first check website user using , if want activate microphone on that. after that, inject html/css code in webpage show popup user asking permission. if permission yes, send message backgr

symfony - Symfony2 MopaBootstrap - exception in BootstrapSandbox CSS -

i'm trying mopabootstrapsandbox demo , running on win 7 / xampp installation. can see main demo page isn't styled. when @ stylesheet see following exception in ... isn't whole of exception interleaved css. [exception] 500 | internal server error | exception [message] expected color value: failed @ `color: darken(@graylight, 10%); }` line: 33 [1] exception: expected color value: failed @ `color: darken(@graylight, 10%); }` line: 33 at n/a in c:\xampp\htdocs\t1\vendor\leafo\lessphp\lessc.inc.php line 3258 @ lessc_parser-&gt;throwerror(&#039;expected color value&#039;, &#039;399&#039;) in c:\xampp\htdocs\t1\vendor\leafo\lessphp\lessc.inc.php line 1862 @ lessc-&gt;throwerror(&#039;expected color value&#039;) in c:\xampp\htdocs\t1\vendor\leafo\lessphp\lessc.inc.php line 1070 @ lessc-&gt;assertcolor(array(&#039;keyword&#039;, &#039;&#039;)) in c:\xampp\htdocs\t1\vendor\leafo\lessphp\lessc.inc

class - Object initialization with 0 -

i wonder, happen if initialize object 0. for example : class vehicle { } main() { vehicle v =0; // or vehicle v; v=0; } assuming c++, code generate compilation error @ least 4 reasons: unlike k&r c, c++ not support functions implicit return values. main function returns int , , must explicitly declared such. the class keyword not capitalized, , language case-sensitive. might typo, compiler won't care. the declaration of vehicle class invalid. class declarations must end semicolon (after closing brace } ). the vehicle class not define constructor accepts integer (or implicitly convertible int ), cannot initialize new vehicle object 0 .

android - Is it possible to set ImageSize with displayImage ()? -

i have question regarding https://github.com/nostra13/android-universal-image-loader library. i'm using imageloader.displayimage(...) load images database imageviews, in listview. the docs this: imagesize targetsize = new imagesize(120, 80); // result bitmap fit size imageloader.loadimage(imageuri, targetsize, displayoptions, new simpleimageloadinglistener() { @override public void onloadingcomplete(string imageuri, view view, bitmap loadedimage) { // whatever want bitmap } }); would possible declare target size imageloader.displayimage method? you can use method: public void loadimage(string uri, imagesize targetimagesize, displayimageoptions options, imageloadinglistener listener) set imagesize parameter. the downloaded image decoded , scaled bitmap of size equal or larger (usually bit larger) incoming targetimagesize.

c# - How do I synchronize ArrangeOverride with my animations? -

i have drag , drop implementation animate items below dragged item. problem animation of item below can still running when drop dragged item. this leads call arrangeoverride resets item below position , storyboard.completed call moves item again leads wrong positioning. reanimate below: 1: direction: 200 reanimate dragged: 0: direction: -200 complete on dragged item: 0: direction: -200 arrangeoverride arrangeoverride done complete on itembelow: 1: direction: 200 is there way synchronize arrangeoverride call animation called when animation done? my code modified version of https://github.com/realistschuckle/wpfchrometabs has same problem

jquery - SEO - Title-Tag via JavaScript after Onload? -

does search engine robot sees meta information written javascript the title tag of page after page loaded? my code following <body onload="myfunction( //find h1 on page , put title-tag in header-section )"> why doing this? because 1 template (same header) different content(controlled url-parameters) so can fill in fix meta-informations yes (same meta different contents)... want dynamic content is someone can give me hints or solutions? does search engine robot sees meta information written javascript the title tag of page after page loaded? no why doing this? because 1 template (same header) different content improve template takes title field.

javascript - Function undefined js -

why function undefined http://jsfiddle.net/arandolph0/8eukn/3/ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <form id="frmcheckbxs" > <c:set var="recordcount" value="2"/> <input type="checkbox" id="chkrefid${recordcount}" onclick="checkrushed ('frmcheckbxs','chkrefid','2')" /> <input type="checkbox" id="chkrefid1" /> </form> i checked , doesn't typo appears functional. you have set jsfiddle wrap javascript in onload event handler function. checkrushed defined inside function, scoped function , not available global. bind event handlers addeventlistener (or helper function of choice if using library abstracts that) instead of using intrinsic event attributes.

sql - Detecting last row of a group -

i using row_number() determine last row of query creating descending order , checking if on position 1. row | value ----+------- 3 | false 2 | false 1 | true do have idea how apply same technique determine last row of every group? the expected result should this: uid | row | value ----+-----+------- 1 | 3 | false 1 | 2 | false 1 | 1 | true 2 | 4 | false 2 | 3 | false 2 | 2 | false 2 | 1 | true 3 | 2 | false 3 | 1 | true or know better way detect last rows in postgresql? use partition by part of over() : select uid,something, row_number() on (partition uid order desc) row sometable partition by causes whatever window function you're using (such row_number() ) operate complete separately on each partition defined - row_number restarts number, max find maximum value rows within partition, etc.

Bootstrap 3 style editors -

are there style editors (such bootstrap themeroller ) support bootstrap 3 yet? try bootstrap-magic , used app customize bootstrap variables border-radius , colors, etc.

Create trigger to insert a column value into other column of same table SQL Server 2005 -

how create trigger insert value in column same value of column of same table of newly inserted row in table. suppose have table below columna | columnb i want columnb value inserted columna row gets inserted table or columnb value gets updated . should not vice versa ie insert columna value columnb .below code handles insert , please me how handle both insertion , updation of table ie when columnb value gets inserted or updated. create trigger inserupdate on triggertesttable after insert,update begin -- set nocount on added prevent result sets -- interfering select statements. set nocount on; -- insert statements trigger here declare @value int select @value=columnb inserted update triggertesttable set columna=@value end go this works fine if values inserted below insert triggertesttable(columnb) values('xyz') columnb value gets inserted columna columna | columnb xyz | xyz but null value gets updated in

LibreOffice automation - substitution -

we have dozen documents tailored different locales. currently, editing 1 means others must edited keep them in step. i'd have master document using generic terms, , generate locale-specific documents. e.g. instead of: en-au you must record vat purchases made in australia. en-ca you must record gst/hst purchases made in canada. 10 more variations... just have master document with: you must record {{sales-tax}} purchases made in {{country}}. and output specific documents substituting {{field}} value . is possible in libreoffice via php or other scripting language? i'm using lo 3.5.7.2. libreoffice documents zip files different extension. unzip them using unzip , you'll see content.xml . search , replace heart's content on xml.

How do I output a string of hex values into a binary file in Perl? -

i'm trying read in binary file, store data string of hex values, use regular expressions modify hex values, , spit data out new binary file (that modified version of original). i can of steps except last one. when open new binary file in hex editor, seems wrong... want how hex string is, in hex editor. here i'm attempting when creating new file: # format data string array file processing @data_ary = unpack('h*', $data_str); generate_new_file($filname, \@data_ary); sub generate_new_file { $fname = "mod -" . shift(@_); $aref = shift(@_); open(bin, ">", $fname) or die; binmode(bin); $nybble(@$aref) { print (bin $nybble) } close(bin); } i'm guessing problem has use of unpack . i'm not sure how else huge hex string form read hex , not ascii characters. suggestions appreciated! the code shown above trying output data new file. have hex want output in $data_str. unpack attempt s

Search box in page to mobile html -

i want add search box site. needs to mobile capable well. filter can me lot. when search page filtered , answer stays. <body> <span class="graytitle"><div align="center">אזורים</span> <ul class="pageitem"> </li> <li class="menu"><a href="https"> <span class="name">blue</span><span class="arrow"></span></a></li> </li> <li class="menu"><a href="https"> <span class="name">oreng</span><span class="arrow"></span></a></li> </li> <li class="menu"><a href="https"> <span class="name">red</span><span class="arrow"></span></a></li> </ul> </div> <

jquery - How to change the src attr in <audio> tag with another online mp3 resource and reload it -

i tried modify src attribute of tag , reload it. however, seems not work. $.getjson('/handler', function(data) { var items=[] alert('data') $('#artist').html(data.artist); $('#title').html(data.title); $(".audio").attr('src', data.url); $(".audio").attr('autoplay', true); $(".audio").load(); } <audio id="players" class="audio" controls> <!-- <source src="horse.ogg" type="audio/ogg"> --> <source src="http://mr4.douban.com/201307252205/c015e7928c2cbcb3be6ad0e38ff21838/view/song/small/p1451474.mp3" type="audio/mp3" reload="auto" > browser not support audio element. </audio> i did experiments, if change src local files like: $(".audio").attr('src','/static/music/p186609.mp

Parse multiple JSON in Objective C -

long story, short. need access parent in json file. how parse multiple json in objective-c? ) need access author > name json. (*removed link) the code is: nsurl *blogurl = [nsurl urlwithstring:@"*removed link"]; nsdata *jsondata = [nsdata datawithcontentsofurl:blogurl]; nserror *error = nil; nsdictionary *datadictionary = [nsjsonserialization jsonobjectwithdata:jsondata options:0 error:&error]; // nslog(@"%@",datadictionary); self.blogposts = [nsmutablearray array]; nsarray *blogpostsarray = [datadictionary objectforkey:@"posts"]; (nsdictionary *bpdictionary in blogpostsarray) { blogpost *blogpost = [blogpost blogpostwithtitle:[bpdictionary objectforkey:@"title"]]; blogpost.author = [bpdictionary objectforkey:@"author"]; blogpost.thumbnail = [bpdictionary objectforkey:@"thumbnail"]; blogpost.date = [bpdictionary objectforkey:@"date"];

java - Construct specific instance of ObjectWriter from the shared ObjectMapper in Jackson 2 to ignore null fields -

i working jackson 2 , cxf. i have done lots of research find clean , safe way writer object shared object mapper given cxf un/marshaling json. cannot use annotation or set mapper object ignore null fields when serializing due business logic. the code below seem correct, output json still include null fields. please !! objectwriter writer = this.jacksonmapper.writer().without( serializationfeature.write_null_map_values ) ; if( writer.isenabled( serializationfeature.write_null_map_values ) ) { system.out.println("oppa gangname style"); } string json = null; try { json = writer.writevalueasstring( myobject ); system.out.println ( json ) ; } catch (jsonprocessingexception e) { throw new runtimeexception() ; } the if case verify have successful disable serializationfeature.write_null_map_values. however, result still include null fields. i'm using older jackson version works me: jsonfactory factory = new

postgresql - PostrgeSQL storage using 2^n-1 for char and varchar -

there rule once heard when assigning storage size char , varchar instead of doing regular 4, 8, 16, 32 rule want use 3,7,15, 31. apparently has optimizing space in stored. know if there validity statement or there better way of assigning size char , varchar in postgresql? rule postgresql or keep in mind in of sql languages? you're mis-remembering applies @ lower level. strings in "c" language terminated zero-byte. so: "hello" traditionally take 6 bytes. of course, when assumed single character fit neatly single byte. not case more. the other (main) way store strings have length stored @ front, , have characters following. happens postgresql does, , believe has optimisation length doesn't take space short strings. there separate issues memory access cheaper/easier @ 2/4/8 byte boundaries (depending on age of machine) , memory allocation can more efficient in powers of 2 (1024, 2048, 4096 bytes). for postgresql (or of major scripting la

ios - Xcode PhoneGap navigator.connection Undefined -

trying port phonegap javascript code xcode debugging in ios. using cordova-3.0.0. when call: navigator.connection.type i getting 'undefined' navigator.connection. did not include network connection plugin correctly in config.xml, or else amiss? yes, included correct cordova.js file ios. yes, deviceready has been fired. update: running on ios emulator. my config.xml: <?xml version='1.0' encoding='utf-8'?> <widget id="com.app.test" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0"> <name>hello cordova</name> <description> description </description> <author email="dev@callback.apache.org" href="http://cordova.io"> apache cordova team </author> <access origin="*" /> <preference name="fullscreen" value="true" />

java - Bonjour - DNS_SD.jar library for linux? -

i'm using dns_sd.jar library in java program running on mac register bonjour service. this library imported in java project using package: com.apple.dnssd.*; tried several time understand library comes ? suppose library created apple , installed on each mac osx. correct ? it seems that same api of library available on linux , windows. means there other dns_sd.jar each specific os ? or can use same library on linux , windows ? why library not provided on apple developper website ? looked everywhere ! i'm asking these question because want know if can transpose java program on linux system ? thank ! i have same findings , same question; dns_sd.jar on mountain lion ? gone (forever) since oracle has taken on java distribution ? bonjour sdk works on windows, , able build service on top of it. trying port same package osx unsatisfied link error, if manually include windows version of dns_sd.jar maybe there native osx code missing ? it bit funny bonjour wo

c# - Fast random number generation - multiple times per ms -

this question has answer here: random number generator generating 1 random number 9 answers i noticed, when using system.random , if next() called more 1 time in millisecond, returns same number (if has same parameters). assume random algorithm somehow concerns system's time, , dependent on that. i'd call next() many times within single millsecond - there way this, same random class? if not, i'd appreciate resources/other methods of solving this. this because when initialise new instance of random uses system clock seed. if twice, close enough together, you'll end using same seed , you'll same sequence of random numbers 2 instances. the solution alluded in comments already, instantiate 1 random object , repeatedly call next() on it, you'll new random number every time. var val1 = new random().next(); var val2 = new random().

Right Click Drag and Drop Selenium Webdriver -

so i'm trying perform right click drag , drop using selenium webdriver, wondering if had ideas on how this? i have tried using actionchains it, dont seem run. for right click mouse can use webelement elementtorightclick = driver.findelement(by.id("gbqfba")); actions clicker = new actions(driver); clicker.contextclick(elementtorightclick).perform(); for drag&drop, can use actions builder = new actions(driver); action draganddrop = builder.clickandhold(source element).movetoelement(target element).release(target element).build(); draganddrop.perform(); (or) actions builder = new actions(driver); action draganddrop = builder.draganddrop(source element, target element).build(); draganddrop.perform();

objective c - Auto increasing numbers in array -

i'm starting out xcode , need help. have array set up: myarray = [nsmutablearray arraywithobjects: item1type1, item1type, item1type3, item1type4, item1type5, item1type6, item1type7, item1type8, item1type9, nil]; is possible auto-assign numbers elements in sequence? logic simple: item1type(i), item1type(i+1), item1type(i+2),... many thanks there many magic numbers in code, here go: // build array of keys @[@"item_1_type_1", @"item_1_type_2", ..., @"item_1_type_9"] programmatically const int numberofelements = 9; nsmutablearray *keys = [nsmutablearray arraywithcapacity:numberofelements]; (int = 1; <= numberofelements; i++) { [keys addobject:[nsstring stringwithformat:@"item_1_type_%d", i]]; } // extract chosen keys json dictionary array, matching // order of keys above. nsdictionary *subdict = myjsondata[@"item1"]; nsarray *myarray = [subdict objectsforkeys:keys notfoundmarker:[nsnull null]];

ios - Creating Custom Call out View -

i'm trying add view when click in pin, appears title , subtitle , not view did add. here code -(void) inserirmapa { appdelegate *appdelegate = (appdelegate *)[[uiapplication sharedapplication]delegate]; nsmutablearray *pins = [[nsmutablearray alloc]init]; //array de annotations for(int icnt = 0; icnt < [_listapins count]; icnt++) { pin *pin = (pin *) [_listapins objectatindex:icnt]; cllocationcoordinate2d start; start.latitude = pin.place.latitude; start.longitude = pin.place.longitude; mkcoordinateregion region = mkcoordinateregionmakewithdistance(start, 800, 800); [_mymapview setregion:[_mymapview regionthatfits:region] animated:yes]; // add annotation mkpointannotation *point = [[mkpointannotation alloc] init]; point.coordinate = start; point.title = @"where i?"; point.subtitle = @"i'm here!!!"; [_mymapview addannotation:point];

php - json_decode renders The Response content must be a string or object implementing __toString() -

i use laravel , function json_decode . amongst others, use within popular module , doesn't work there on in own, simple testcase. seem have todo setup/settings. (i'm running on pagodabox , locally). data feed twitter/instagram, content json. here example of doesn't work: <?php class instagramcontroller extends basecontroller { /* |-------------------------------------------------------------------------- | default home controller |-------------------------------------------------------------------------- | | may wish use controllers instead of, or in addition to, closure | based routes. that's great! here example controller method | started. route controller, add route: | | route::get('/', 'homecontroller@showwelcome'); | */ public function read($q) { $client_id = '#############'; $uri = 'https://api.instagram.com/v1/tags/'.$q.'/media/recent?clien

python pillow (better PIL) encoding check bug -

i've installed pillow package virtualenv. doing this: from pil import image, imagefont, imagedraw imagefont.load_path('some_path') i'm getting error: traceback (most recent call last): file "<stdin>", line 1, in <module> file "/net/isilonp/public/rw/homes/cbl_adm/.virtualenvs/chembl_webservices/lib/python2.7/site-packages/pil/imagefont.py", line 264, in load_path if not isinstance(filename, "utf-8"): typeerror: isinstance() arg 2 must class, type, or tuple of classes , types and indeed, if check official gihub repository ( https://github.com/python-imaging/pillow/blob/master/pil/imagefont.py#l264 ), can see construct: if not isinstance(filename, "utf-8"): ... my question is: how replace works? someone overlooked testing method; correct incantation is: if not isinstance(filename, str): # ... because rest of code proceeds turn into str , both python 2 , python 3. i've i

linux - remove duplicated values of a specific parameter in bash in a file -

i have file cat file ab,12 ab,45 ab,23 bh,32 bl,12 ab,10 bh,13 and file has duplicated lines first parameter i need output unique values of specific parameter separated comma for example output cat file ab,12 bh,32 bl,12 the following command works example: sort -u -s -t, -k1,1

java - Determining the state of a process -

i creating chatbot-like application , need know when application has reached state. currently using strings find out topic of conversation is. such as string usersaid = text.tostring(); if (usersaid.contains("topic-relevant word") { execstaterelevantmethod(); } however i'd know if there's more reliable way this. such as: if (usersaid.contains("what time it") { state.set(timequery); } if (state == timequery) { execstaterelevantmethod(); } i have made state commands show i'm meaning ask.

Good ORM generator for C# and Oracle DB -

i hope can me. i in need of orm mapper work oracle , generate n-tier solution me (dal, unit tests, domain model, etc.). basically plinqo entity framework or nettiers. the problem is, last 2 don't work oracle. i have used open access in of projects , supports both sql server , oracle. open access telerik

list - Python curiosity: [] > lambda n: n -

one of coworkers using builtin max function (on python 2.7), , found weird behavior. by mistake, instead of using keyword argument key (as in key=lambda n: n ) pre-sort list passed parameter, did: >>> max([1,2,3,3], lambda n : n) [1, 2, 3, 3] he doing in documentation explained as: if 2 or more positional arguments provided, largest of positional arguments returned. , i'm curious why happens: >>> (lambda n:n) < [] true >>> def hello(): ... pass ... >>> hello < [] true >>> len(hello) traceback (most recent call last): file "<stdin>", line 1, in <module> typeerror: object of type 'function' has no len() i know it's not big deal, i'd appreciate if of stackoverflowers explain how comparisons internally made (or point me direction can find information). :-) thank in advance! python 2 orders objects of different types rather arbitrarily. did make lists always so

Eclipse RCP: Bundle jar files to plugin and change them afterwards -

i'm using eclipse rcp 4.3 , need bundle several jar files plugin, have use in rcp application. for reason change jar files in plugin after exporting it. when export plugin, more or less jar file. jar files zipped folders, should possible switch jar files afterwards program (by unzipping, changing , zipping) right? need register or name file names in meta data of plugin jar file? if jars replace have same names , same location no, if have different names yes. references of old jars in .classpath file @ root of bundle , can see need update.

Android List View Item is not working correctly -

i trying show view form listviewitem, when checked item listitems not working. here code below using. public class contentlist<view> extends listactivity { string [] list = {"list item 1","list item 2","list item 3"}; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_content_list); listview lstview = getlistview(); lstview.setchoicemode(listview.choice_mode_multiple); lstview.settextfilterenabled(true); setlistadapter(new arrayadapter<string> this, android.r.layout.simple_list_item_checked,list)); } public void onlistitemclick(listview parent, view v,int pos, long id){ checkedtextview item = (checkedtextview) v; toast.maketext(this, list[pos] + "checked : "+ !item.ischecked(), toast.length_long).show(); } } i see 2 problems , both toas

c - What algorithm is R using to calculate mean? -

i curious know algorithm r's mean function uses. there reference numerical properties of algorithm? i found following c code in summary.c:do_summary(): case realsxp: protect(ans = allocvector(realsxp, 1)); (i = 0; < n; i++) s += real(x)[i]; s /= n; if(r_finite((double)s)) { (i = 0; < n; i++) t += (real(x)[i] - s); s += t/n; } real(ans)[0] = s; break; it seems straight mean: for (i = 0; < n; i++) s += real(x)[i]; s /= n; then adds assume numerical correction seems mean difference mean of data: for (i = 0; < n; i++) t += (real(x)[i] - s); s += t/n; i haven't been able track algorithm down anywhere (mean not great search term). any appreciated. i'm not sure algorithm is, martin maechler mentioned updating method of west, 1979 in response pr#1228 , implemented brian ripley in r-2.3.0. couldn't find reference in source code or version control logs listed actual algorithm used. implemented in cov.c in revision 37389 , in summ

windows - Move new files from dropbox as soon as they sync -

i use dropbox (on windows xp , 7 pcs) way new iso files moved on directory on computer @ home/office. have robocopy script copies files on dropbox folder, using same file structure dropbox folder. question this... there way have dropbox folder checked/monitored, using either script or other software, , run robocopy script move files out of dropbox folder local machine? tried use belvedere run robocopy script have on each file opposed running once because has detected new file. i'm there way don't know is. can help? the robocopy script use manually here... @echo off rem ©2007-2013 http://www.iso.co.uk cls echo. echo ====================================================================== echo file preparation script used update newer iso stuff echo ===================================================================== echo. :start echo. pause cls cls echo shouldn't take long... echo. echo. robocopy "c:\documents , settings\home\desktop\dropbox\latest files\f

Commit all modified files to Github in Netbeans -

in our project using netbeans. when try commit files have modified in netbeans brings current file , have commit every file have modified. have seen co-worker can hit "commit" , bring every file has modified, neither of know how change settings allow multiple file commits. i've tried looking online options, haven't found answer. have suggestions? thanks! okay, figured out answer. lost soul in future. right click on project name -> git -> commit.

active directory - Simplify powershell query -

i learning powershell, , looking query couple of ad groups , determine whether user member of ad group. part 1 : query ad group has 10 nested ad groups part 2: query user's ad group , pull list part 3: not posted, compare output of part 1 , part 2 searched online , found tits , bits. aware of active directory module, avoid using it, since script executed user non-technical , avoid installing rsat that. i have powershell version 2 , windows 7 part 1 group1 ad group has 10 nested ad groups. write-host "fetching information groups.please wait.." add-type -assemblyname system.directoryservices.accountmanagement $ct = [system.directoryservices.accountmanagement.contexttype]::domain $group=[system.directoryservices.accountmanagement.groupprincipal]::findbyidentity ($ct,'group1') $group1 = $group.getmembers | {$_.structuralobjectclass -eq "group"} | select samaccountname $group1 = $group1 -replace("=", " ") -replace(

ruby on rails - Rmagick composite image without source -

i have gallery model , post model. each post has image, , create composite image each gallery based on posts in gallery. have method galleries returns urls top 4 images in gallery: gallery.images_for_preview # => returns array of 4 image urls (200x200 images) i'm using carrierwave + rmagick generate composite image. i'm trying follow along here: http://railscasts.com/episodes/374-image-manipulation seems use case different. have: class galleryimageuploader < carrierwave::uploader::base ... def store_dir "galleries/#{model.obfuscated_id}" end version("full") { process :full_image } def full_image images = model.images_for_preview puts images manipulate! format: "png" image0 = magick::image.read(images[0]).first image1 = magick::image.read(images[1]).first image2 = magick::image.read(images[2]).first image3 = magick::image.read(images[3]).first underlay = magick::image.new(4

Ruby on Rails does not find routes -

i set rails project, , http://dev.xxx.com/public/ resolved /home/xxx/public_html/xxx/public/index.html when try access controller, keep getting 404s. for instance, pages_controller.rb : class pagescontroller < applicationcontroller def index end end when accessing http://dev.xxx.com/pagescontroller , error: file not exist: /home/xxx/public_html/xxx/rails_apps/belldev/pagescontroller when accessing http//dev.xxx.com/xxx/rails_apps/belldev/app/controllers/pages_controller , error: file not exist: /home/xxx/public_html/xxx/rails_apps/belldev/xxx please enlighten me doing wrong, here. assuming of routing setup correctly, address should http://dev.xxx.com/pages/ not http://dev.xxx.com/pagescontroller/

Hadoop - streaming data from HTTP upload (PUT) into HDFS directly -

i have following application deployment web front-end taking data client through http/ftp hadoop cluster i need store client's data on hdfs. best way of doing that? possible stream data hdfs directly, without consuming data client on local drive, , put hdfs? the feasible options can think of right : httpfs webhdfs ftp client on hdfs hdfs on webdav choosing "best" 1 totally upto you, based on convenience , ease.

MySQL Select distinct values from two table that have a common key -

i making query using 3 table. quotes table has key called quote_id stored in quote_items table. there ever 1 instance of quote_id in quotes table in quote_items table may occur several times. want join 2 together, filter out instance quote_id occurs more once. select * quotes inner join quote_items on quotes.quote_id in (select distinct quote_id quote_items) inner join accounts on quotes.account_id = accounts.account_id , quotes.status = 0 primary_sales_id = 2 , quotes.quote_id = quote_items.quote_id order quotes.date_submitted desc you can ignore account_id part. line 3 should different, know, how go i'm not sure. if had quotes looking this quote_id | quote_name 1 | quote1 2 | qute2 and quote_items looking this quote_id | item_name 1 | boards 2 | nails 2 | blocks i should quote_id | quote_name | item_name 1 | quote1 | boards 2 | quote2 | nails you may use: select distinct quotes.quote_

wordpress - xprofile_allowed_tags not accepting unordered list -

im trying budypress site work wp_editor on profile fields. far ok tags being striped. i added following: add_filter( 'xprofile_allowed_tags', 'custom_xprofile_allowed_tags' ); function custom_xprofile_allowed_tags($tags){ $tags['li'] = array(); $tags['ul'] = array( 'type' => true ); return $tags; } but still saving profile field without <ul><li> i know filter working because if add unset($tags['strong']); strong tag stripped. thanks help my code working fine didn't realize need change filter displaying data. code : function xprofile_with_html() { //change allowed tags use same posts when save add_filter( 'xprofile_allowed_tags', 'custom_xprofile_allowed_tags',0 ); //remove wp_filter , add custom 1 when showing in edit field remove_filter( 'bp_get_the_profile_field_edit_value', 'wp_filter_kses', 1 ); add_filter( 'bp_get_

c - printf with reference arguments -

imagine having label after created updates x amount of times / sec. text of label given format-specifier text (ala printf), , arguments format-specifier updated on redraw, because arguments format specifier pointers respective values. variant of sprintf work this? the code work this: /* client */ createlabel("value %f", &myfloatvalue); i haven't quite figured out way yet, have ideas? guess 1 parse format text, retrieve pointers (and types), , store them object in list, later reprint text , maybe delegate formatting objects themselves, passing them textbuffer.. hmmm btw, interface c, host c++. okay got "working" prototype, it's written in assembler. anyway demonstrates supposed use of api. can see portable way / have better idea implementation? it's pretty large i'm posting on pastebin: http://pastebin.com/h8zpwb4u so createlabel interface store format string, along addresses of variables you're wanting display within s

vb.net - Advanced SQL Select and Union Statements -

i've seen other similar questions , have tried implementing many solutions, to no avail far. specific questions involves little more complexity. need create table , join columns right side depending on criterion. seems simple enough, there few bumps encountering. the tables follows: adc_data_collection_header (pk)transaction_id | bemsid | device | timestamp | config_name adc_data_collection_apps (fk)config_name | num_data_elements | data_element1 | data_element2 | data_element3 | data_element4 adc_data_collection_data (fk)transaction_id | data_element_number | data i want final output like: transaction_id | device | config_name | data | data | data | data the "data" column filled in using table adc_data_collection_data. first instance of "data" "data" field in adc_data_collection_data data_element_number = 1. second instance of "data" "data" field in adc_data_collection_data data_element_number = 2... , on. the

Should I use composite primary keys in Grails? -

the grails docs discourage use of composite primary keys, in this video (26:00 - 29:00) @burtbeckwith uses composite primary keys speaks performance benefits of mapping of join tables domain classes opposed using collections. raises several questions: why grails docs discourage use of composite primary keys? why burt using composite key? tried without 1 , seems work fine. didn't override hashcode or equals . burt using grails 1.3 when video made, performance concerns regarding collections still valid? can test myself turning on sql logging, haven't done yet. hibernate prefers simple primary key, if there's natural unique key (e.g. username in user table) since auto-incrementing long values simpler use foreign keys. supports other approaches of course, , gorm. the reason use composite pk in userrole table keep same implicitly created join table when use many-to-many in gorm. approach proposed intended same far database concerned, more performant,

javascript - How to implement drag and drop image? -

how implement function users can upload images , drag , drop them in order present photos? i'm using ror framework. gems perhaps? one way put images in list , give each li data-attribute it's image id, like: <ul> <li data-image_id="1"><img src="/image1.png" /></li> <li data-image_id="2"><img src="/image2.png" /></li> </ul> then write nice javascript code (you use jquery plugins http://farhadi.ir/projects/html5sortable/ ) , use callbacks end of dragging. in callback write little code loops list, parses data-image_id values , sends data server further processing (by storing 'position' int in database example). ps. advice use position field desc new images, 0/null position, automatically end last 1 in row. client thrilled not having re-arrange images after added 4 new images ordered set.

ruby on rails - RefineryCMS for RESTful API -

i need build site cms interface , restful api (to use clientside framework, angularjs). refinerycms work me? also, have experience refinery, locomotivecms, or other rails-based cmss? prefer 1 on other? why? thanks! what mean cms interface? need allow users create pages, embed images/files, etc? i use refinery alot, , it. however, has no built in support restful api want, i'm assuming mean via json or something. you'd have override refinerycms-core engine , it's crud.rb file. refinery defines rest actions dynamically. i'm sure you'd have override other engines depending on functionality of core engines you're using. i'd try doing proof of concept first, on seeing how smoothly goes, decide continue or try cms framework. another lightweight alternative refinery comfortable mexican sofa . pretty easy add on full rails app maintain provide cms functionality. though didn't have override internal parts of it. i've never used l

Selecting data from two MySQL tables at once in php -

what have tried achieve; counting number of rows in 2 tables (adding them together) grouping them country code in country column in table. output results number of rows , country e.g. gb => 200 views us => 500 views ch => 119 views mysql code have far; select count(id) totalclicks, country adverts_analytics_user_clicks advertid =:advertid group country this works well, need select same data table @ same time , combine count() values according country field. any appreciated! repeat first query against second table, such output coumns have same name , datatype. then union results together. finally sum total clicks country. select country, sum(totalclicks) totalclicks ( select count(id) totalclicks, country adverts_analytics_user_clicks advertid =:advertid group country union select count(id) totalclicks, country table 2 advertid =:advertid group country ) group country