Posts

Showing posts from January, 2013

asp.net mvc - webgrid return null when edit -

i try create webgrid editable user.. when click row of webgrid, can edit user username but, why value of username null when send controller webgrid javascript? web grid <div class="form-box"> <div> <input style="width:180px;" type="button" title="adduser" value="add new users" onclick="location.href='@url.action("newuser", "user") '" /> </div> <br /> @if (grid != null) { @grid.gethtml( tablestyle: "grid", headerstyle: "head", alternatingrowstyle: "alt", firsttext: "<< first", previoustext: "< prev", nexttext: "next >", lasttext: "last >>", mode: webgridpagermodes.all, columns: grid.columns( grid.column(header:"login name",format:(item) =...

How can I load 10,000 rows of test.xls file into mysql db table? -

Image
how can load 10,000 rows of test.xls file mysql db table? when use below query shows error. load data infile 'd:/test.xls' table karmaasolutions.tbl_candidatedetail (candidate_firstname,candidate_lastname); my primary key candidateid , has below properties. the test.xls contains data below. i have added rows starting candidateid 61 because upto 60 there candidates in table. please suggest solutions. to import data excel (or other program can produce text file) simple using load data command mysql command prompt. save excel data csv file (in excel 2007 using save as) check saved file using text editor such notepad see looks like, i.e. delimiter used etc. start mysql command prompt (i’m lazy mysql query browser – tools – mysql command line client avoid having enter username , password etc.) enter command: load data local infile ‘c:\temp\yourfile.csv’ table database.table fields terminated ‘;’ enclosed ‘”‘ lines terminated ‘\r\n’ (fi...

How to use YAML front and back matter in Ruby? -

i have heard of term "front matter" , "back matter" refer yaml parsing @ beginning or end of non-yaml file. however, can't seem find examples/documentation of how implement this. maybe isn't standard yaml feature. how can make use of feature in ruby project? fyi: reason want able require ruby files @ top, , assume rest yaml. don't think allowed in yaml file. i came across nice example of similar trying do. isn't example of "front/back matter" might in future: using __end__ keyword, can stop ruby parsing rest of file. rest of file stored in data variable, file object: #!/usr/bin/env ruby %w(yaml pp).each { |dep| require dep } obj = yaml::load(data) pp obj __end__ --- - name: adam age: 28 admin: true - name: maggie age: 28 admin: false source

Middleman App, sort blog posts by month -

i'm using middlemanapp create blog. i'm trying output archive of blog posts sorted month , year display in sidebar. eg. april 2010, may 2010, june 2010, clickable links archive. so far have code below output month in number form (eg. july being output 7) , need have list displayed month shown above. <% blog.articles.group_by {|a| a.date.month }.each |month, articles| %> <li><%= link_to month, blog_year_path(month) %> </a></li> <% end %> can help, i'm not if middleman offers functionality, i'm not familiar ruby. i couldn't find easy built-in way middleman either, following give nested list of years , months, relevant links: <ul> <% blog.articles.group_by {|y| y.date.year }.each |year, articles| %> <li> <a href="<%= blog_year_path(year) %>"> <%= year %> </a> <ul> <% articles.group_by {|a| a.date.month}.each |month, mo...

JSON response to single php variable -

json response is [{"id":630770,"t2":"india a","t1":"south africa a"}, {"id":593454,"t2":"nottinghamshire","t1":"kent"}, {"id":593453,"t2":"northamptonshire","t1":"warwickshire"}, {"id":593457,"t2":"sussex","t1":"worcestershire"}, {"id":593451,"t2":"hampshire","t1":"derbyshire"}, {"id":593456,"t2":"surrey","t1":"durham"},{"id":593449,"t2":"essex","t1":"lancashire"}, {"id":593455,"t2":"somerset","t1":"gloucestershire"}, {"id":593452,"t2":"leicestershire","t1":"middlesex"}, {"id":593450,"t2":"glamorgan","t...

objective c - NSSavePanel File Path -

i use nssavepanel when deal text files. if have image export, use nsopenpanel user can select directory, , don't caught in sandbox file path restriction. time, though, want use nssavepanel let user save image file (bmp, gif, jpeg, jp2, png). - (void)exportfile { nsstring *documentfolderpath = [nssearchpathfordirectoriesindomains(nsdocumentdirectory, nsuserdomainmask, yes) lastobject]; nssavepanel *panel = [nssavepanel savepanel]; [panel setmessage:@"please select path save checkboard image."]; // message inside modal window if ([self fileexists:destinationpath]) { [panel setdirectoryurl:[nsurl fileurlwithpath:destinationpath]]; } else { [panel setdirectoryurl:[nsurl fileurlwithpath:documentfolderpath]]; } //[panel setallowedfiletypes:[[nsarray alloc] initwithobjects:@"bmp",@"gif",@"jpg",@"jp2",@"png",nil]]; [panel setallowsotherfiletypes:yes]; [panel setex...

c++ - The first element of a ( custom ) doubly linked list is repeated -

i need make custom doubly linked list course of data structures. but first element of list repeated , can't see error. this push_back function : template <class dt> void list<dt>::push_back(const dt& elem) { if(first->back == nullptr && first->forward == nullptr) { first->current = elem; last->current = elem; last->back = first; first->forward = last; return; } else { listobject<dt> *temp = new listobject<dt>(*last); last = new listobject<dt>(); last->back = temp; last->forward = nullptr; last->current = elem; temp->back->forward = temp; temp->forward = last; } } the main list<int> c; c.push_back(66); c.push_back(44); c.push_back(88); c.push_back(58); std::cout << "---------------------------" << std::endl; for(listobject<int> *a = c.first...

android - Moving splash screen like facebook's splash screen -

how can splash screen facebook's splash screen? in facebook's splash screen facebook logo moves , apear login view in same view. how can it? tried draw aמ animation on existing view couldn't current canvas. take image view logo or view require. use translate animation , refer post move imageview different position in animated way in android or how move image left right in android

javascript - A regex to identify spans with given class names -

i in process of writing custom bbcode editor (i have excellent reasons doing , not using readymade effort) generates, amongst other things html markup such as <span class='classname'>...</span> all of done , works well. however, need reverse transformation html bbcode time-to-time need identify spans use given classname. example <span class='classnamea' style='font-family"arial"'>span content</span> can convert bbcode markup [font=arial]span content[/font] i aware of dangers of using regexs parse old html , not intent. need reverse parse own html tags - else passing through bbcode editor display. to cut long story short - no regexs particularly require lookaheads etc. appreciate creating javascript regex job. i suggest either use benjamin's suggestion , store bb codes somewhere. alternatives regex innerhtml or textcontent document.queryselectorall("span.classnamea"); or document....

vb.net - VB Script into Windows Forms Application -

i'm new in vb world, have script want run if button clicked. i'm working vs 2010 , (window form app) need paste script? or should need open class that? that's have now: public class form1 private sub button1_click(byval sender system.object, byval e system.eventargs) handles button1.click end sub end class and script dont know paste or call

dictionary - How to convert numbers into strings in python? 1 -> 'one' -

if want program let user input number (e.g. 1, 13, 4354) how can print (one, thirteen, 4 3 5 four) make sense? if it's 2 digit, print though it's joined (thirty-one) if it's more 2 print them sepretly, 1 same line joined space, tried dictionary, , think it's possible, can't figure out how it? l = input('enter number: ') if len(l) > 2: nums = {'1':'one', '2':'two', '3':'three', '4':'four', '5':'five', '6':'six', '7':'seven', '8':'eight', '9':'nine'} elif len(l) == 2: tens = {'10'} k, v in nums.items(): print(k, v) this wrong code, finished result this? in advance! to access items dictionary, can dictionary[key] . value returned. let's input "8" . you can print nu...

javascript - How to detect the status of the element navigation in js? -

i need users latitude , longitude browser, on of browsers restrictions doesn't let it. how tell users geolocation off or doesn't support it? i tried this, neither ipad or safari on mac prompt anything. if (navigator.geolocation) navigator.geolocation.getcurrentposition(success); else alert('not supported'); demo: http://jsfiddle.net/7srds/ if (navigator.geolocation) { navigator.geolocation.getcurrentposition(function(position) { // ... }, function(error) { //error handling switch(error.code) { case error.permission_denied: //user denied request geolocation. break; case error.position_unavailable: //location information unavailable. break; case error.timeout: //the request user location timed out. break; case error.unknown_error: //an unknown error occu...

layout - Flex: Tab Navigator tab position -

Image
i need develop tab navigator few tabs on left hand side , 1 tab on right hand side, have experimented "taboffset" property, not seem able help thanks in advance! i made custom tabnavigator component. package { import mx.containers.tabnavigator; import mx.controls.button; import mx.events.flexevent; public class customtabnavigator extends tabnavigator { public function customtabnavigator() { super(); } override protected function createchildren(): void { super.createchildren(); tabbar.addeventlistener(flexevent.creation_complete, addspacer); } public function addspacer(event: flexevent): void { var buttoncount: int = tabbar.getchildren().length; var _width : number = this.width; var button: button = tabbar.getchildat(buttoncount-1) button; _width = _width - button.width; button.x = _width; } } }

tortoisesvn - SVN: Authorization does not work on repository folders with spaces -

my svn server configured run on linux , unable access folders contain space in name , server returns http 403 forbidden error. for example, unable access folder below: http://svn.prithvi.com/svn/repos/project/branches/advid/base lined work products/deployment/ is there specific need configure on server? thanks & regards, sudhakar note: tried url below , doesn't work (replacing space %20) http://svn.prithvi.com/svn/repos/project/branches/advid/base%20lined%20work%20products/deployment/

windows - Visual Studio 2012 recent projects not updated in taskbar -

i have visual studio pinned taskbar. when clicking on icon mouse right button, list of recent projects , solutions in shown. this used work ok, time now, list not being updated. see same projects , solutions under recent , although have worked newer projects lately. how can fix it? i'm running visual studio ultimate 2012 on windows 8 pro. close vs instance right click on taskbar. click properties go jump lists tab uncheck store opened programs uncheck store , display opened items in jump lists click apply/ok wait moment check store opened programs check store , display opened items in jump lists wait moment open vs solution , should appear in jump list. this worked fix vs 2012 professional win 8 pro

jquery-mobile + codeigniter -

what must problem code: <!doctype html> <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <title><?php echo $title; ?></title> <?php echo link_tag('assets/css/jquery.mobile-1.3.2.min.css', 'stylesheet'); echo script_tag('assets/js/jquery-1.10.2.min.js'); echo script_tag('assets/js/jquery.mobile-1.3.2.min.js'); ?> </head> <body> <div data-role="page"> <header data-role="header"> <a href="#navigation" data-role="button">show</a> <h3><?php echo $title; ?></h3> <div data-role="controlgroup" data-type="horizontal" class="ui-btn-right"> <a href="#" data-role=...

sql - DotNetNuke , The specified password for user account “sa” is not valid -

Image
i installing dotnetnuke, during installation asking database password, giving same password using sql server showing error. the specified password user account “sa” not valid, or failed connect database server screenshot: you aren't configuring complex enough sa password, though web platform installer won't tell requirements (likely 7 characters, other alpha) as daniel said, detest wpi , avoid plague. when works, works great, when doesn't, painful troubleshoot

node.js - How does appjs or node-webkit brings nodejs and CEF together? -

i working on project requires me use nodejs filesystem in cef browser window create. looked node-webkit , appjs. can not use them there other business aspects. not find documentation on how doing it. can explain or provide source understanding ? node-webkit based on cef, later moved content layer of chromium.

php - Warning: mysql_fetch_assoc() expects parameter error in a while loop -

im creating simple mailing list check boxes each email listed. how ever throws out error when try , put form. php <?php error_reporting(-1); require '../database/connect.php'; echo "<h1>mailing list</h1>"; $mailcount = 0; $namecount = 0; $get = mysql_query("select * cliet_data send = 1"); echo "<form action='send.php' method='get'>"; while ($getrow = mysql_fetch_assoc($get)){ echo "<input type='checkbox' name='mail_'".$mailcount." value='".$getrow['email']."' checked <br/>".$getrow['name'].">"; } echo "</form>"; ?> any appreciated use like if(mysql_num_rows($get) > 0) { while ($getrow = mysql_fetch_assoc($get)){ echo "<input type='checkbox' name='mail_'".$mailcount." value='".$getrow['email']."' c...

how to write a batch file / vbscript to insert the current date and time into an AssemblyInfo file -

can please show me how write batch file / vbscript insert current date , time assemblyinfo file? i have assemblyinfo file, , want assemblydescription attribute value time batch file executed. [assemblytitle="myfile"] [assemblydescription=""] [assemblyversion="1.1.0"] many in advance! it's easier in vbscript: filename = "..." set fso = createobject("scripting.filesystemobject") set re = new regexp re.pattern = "\[assemblydescription="".*?""\]" re.ignorecase = true txt = fso.opentextfile(filename).readall txt = re.replace(txt, "[assemblydescription=""" & & """]") fso.opentextfile(filename, 2).write txt

javascript - jQuery UI autocomplete via ajax error: -

i've been searching days now, can't find fix. here's code (shortened core functionality): $("input").autocomplete({ source: function( request, response ){ $.ajax({ url: 'inc/ajax.php', type: "get", async: true, datatype: "json", data: { 'task' : 'tasktodo', 'squery' : request.term }, success: function( data ) { response($.map( data, function(item){ return { label : item['name'], value : item['name'] } })); } }); } }); the autocomplete work, i'm getting following error in browser's console: uncaught typeerror: object has no method 'results' (in chrome) ty...

Java AES-128 encryption of 1 block (16 byte) returns 2 blocks(32 byte) as output -

i'm using following code aes-128 encryption encode single block of 16 byte length of encoded value gives 2 blocks of 32 byte. missing something? plainenc = aes.encrypt("thisisapassword!"); import java.security.*; import java.security.spec.invalidkeyspecexception; import javax.crypto.*; import sun.misc.*; public class aes { private static final string algo = "aes"; private static final byte[] keyvalue = new byte[] { 't', 'h', 'e', 'b', 'e', 's', 't', 's', 'e', 'c', 'r','e', 't', 'k', 'e', 'y' }; public static string encrypt(string data) throws exception { system.out.println("string length: " + (data.getbytes()).length); //length = 16 key key = generatekey(); cipher chiper = cipher.getinstance(algo); chi...

java - How to upload Multiple files using play framework? -

i using play framework 2.1.2 using java , creating view upload multiple files , code here : @form(action = routes.upload.up, 'enctype -> "multipart/form-data") { <input type="file" name="picture" accept="application/pdf" multiple="multiple"><br/> <input type="submit" value="upload"> } i want upload doc , pdf file . how restrict form upload doc , pdf file ? i can java looking html code. after want store multiple file permanent storage in computer. and print name of file uploaded. my code : public static result up(){ multipartformdata md=request().body().asmultipartformdata(); list<filepart>file; file=md.getfiles(); for(filepart p: file){ logger.info(p.getfilename()); } return ok(file.get(0).getfilename()); } it storing file temp directory want store permanent location no...

android - Collapse various date computations into one function -

i have many functions give number of week of current year, week of year give difference of number of year in year minus current week of year , give modulo of difference two. i want create single method take 2 input, current year("2013") , current date "26/08/2013" , return difference modulo 2 0 or 1. int totalweeks = gettotalweeksinyear(2013); int currentweeks = getcurrentweekofyear("26/08/2013"); private int gettotalweeksinyear(int year) { calendar cal = calendar.getinstance(); cal.set(calendar.year, year); cal.set(calendar.month, calendar.december); cal.set(calendar.day_of_month, 31); int ordinalday = cal.get(calendar.day_of_year); int weekday = cal.get(calendar.day_of_week) - 1; // sunday = 0 int numberofweeks = (ordinalday - weekday + 10) / 7; system.out.println(numberofweeks); return numberofweeks ; } private int getcurrentweekofyear(string week) { // string dtstart = "26/10/2013"; // input...

spring - RequestMapping and Controller annotations. Controller is not being hit -

i've controller @controller , @requestmapping annotations. @controller @requestmapping(value = "/copyrightversion") public class copyrightandversioncontroller extends basecontroller { protected copyrightandversioncontroller() { super(copyrightandversioncontroller.class); } /** * reads copyright , version respective files. * * @return model , view */ @requestmapping(value = "/getversion", method = requestmethod.get) public modelandview getcopyrightandversion() { logger.debug("in getcopyrightandversion method"); modelandview mav = new modelandview("copyrightandversion"); mav.getmodelmap().put("copyright", "test copyright"); mav.getmodelmap().put("version", "test version"); return mav; } } in logs see dispatcherservlet name 'xtreme' processing request [/xtreme/copyrightversion/getversion.do] l...

android - viewflipper add view not showing -

this code works in project.setcontentview(a viewgroup).this view group addview(mainview),i think thats problem,but dont know how slove it mainview = mlinflater.inflate(r.layout.playsong, null); mflipper = (myflipper) mainview.findviewbyid(r.id.viewflipper); protected void onpostexecute(void result) { super.onpostexecute(result); mflipper.removeallviews(); for(int i=0;i<listbitmap.size();i++) { mflipper.addview(addimageview(listbitmap.get(i))); } mflipper.invalidate(); mflipper.shownext(); } private view addimageview(bitmap bitmap) { imageview imageview = new imageview(playingsongactivity.this); imageview.setimagebitmap(bitmap); imageview.setscaletype(imageview.scaletype.center); return imageview; } <cn.duole.util.myflipper android:layout_width="fill_parent" android:layout_height="200dip" android:background="@android:color/white" android:id="@+id/viewflipper" a...

php - not all session variables are stored in ie on windows phone -

the following code runs when user logs in: $old_session = $_session; session_write_close(); session_id(sha1(mt_rand())); session_start(); $_session = $old_session; $_session['user'] = $userid;//set userid $_session['last_login'] = getlastlogin($_session['user'], true, $conn);//gets last login date the user info isn't saved in ie on windows phone 7, other session data has been saved, body knows can cause , how fix it? ps. cookies stored, other session information saved. session file made , can see other data, not user , last_login.

sql - ConnectionString" setting -

a network-related or instance-specific error occurred while establishing connection sql server. server not found or not accessible. verify instance name correct , sql server configured allow remote connections. (provider: sql network interfaces, error: 25 - connection string not valid) check web.config file "connectionstring" setting. connection string <add key="connectionstring" value="server=(local)\mssqlserver;database=bugtracker;user id=sa;password=sa123!@#;trusted_connection=no"/> you have error in connection string have declared in web.config file... show me web.config file have declared connection string. check connection string properly

opengl - Got points with white borders when drowning circle via gldrawarrays and GL_POINTS -

Image
i'm trying draw circle opengl using gldrawarrays , gl_points. circle drawn correct, each point has got white border (see screenshot). here code: glenable(gl_blend); glblendfunc(gl_src_alpha,gl_one_minus_src_alpha); glenable(gl_point_smooth); glhint(gl_point_smooth_hint, gl_nicest); color* color = (color*)colors; glenableclientstate(gl_vertex_array); pointsize *= this->getscale(); glpointsize(pointsize); glcolor4f(color->r/255.0f, color->g/255.0f, color->b/255.0f, 1.0f); glvertexpointer(2, gl_float, 0, verts); gldrawarrays(gl_points, 0, count); gldisableclientstate(gl_vertex_array); i think, something's wrong blending mode, can't find right one. suggestions? i believe gl_point_smooth intended used saturation blending glblendfunc(gl_src_alpha_saturate, gl_one) alpha calculated portion of pixel sprite overlaps. depth buffer may interfere rendering too. for more accurate circle i'd suggest using triangle strip, or single textured or (i...

php - Magento CSV import , CSV file with full web address , Download the images -

i looking download images csv , have csv full web address in that example below colmun www.xyz.com/abc.jpg www.xyz.com/abc1.jpg www.xyz.com/abc2.jpg so should download above images specific location on computer or ftp location once downloaded must strip full url , make in following way /abc.jpg /abc1.jpg /abc2.jpg i want use file magento import multiple images , full url know magento not support multiple image or full url so come above solution can download full url on computer , strip url , upload using magento import easily can 1 has idea on macro or script ? you can use imoroved import extension easy import products multiple images directly external urls. extension allow add new column multiple product images , fill separated , urls.

actionscript 3 - how to get the html text length without set it to a textfield? -

in actionscript ,i didn't find direct way string's length of html text.here's how things work var mytext:string = "<p>this <b>some</b> content <i>render</i> <u>html</u> text.</p>"; mytextbox.htmltext = mytext; trace(mytextbox.length); deal large content of html text performance problem. is there way can length while don't have pass text device? i see 2 ways extract text xml: for xhtml best way parse xml , extract text nodes for types of text can try regexp matches text not part of html tag ( http://regexr.com?363li ) var s:string = "<p>this <b>some</b> content <i>render</i> <u>html</u> text.</p>"; //by textfield var tf:textfield = new textfield(); tf.htmltext = s; trace(tf.text); trace(tf.length); //well-formed xml xml.ignorewhitespace = false; var x:xml = new xml(s); var t:string = ""; var list:xmllist = x..*; each...

java - Play framework input without label -

i've started play framework , i'm looking create input field in scala template without label , reason i'm unable rid of generated label element. here how code looks : @helper.inputtext(form("name"), 'id -> "name", 'class -> "ui-state-default", 'autocomplete -> "off", 'placeholder -> "please write name ...") so end element along input (looking @ browser source code) : <dt><label for="s2id_autogen2">name</label></dt> is there way of removing it? my solution : @helper.inputtext(form("name"), 'id -> "name", 'class -> "ui-state-default", 'autocomplete -> "off", 'placeholder -> "please write name ...", '_label -> null )

How to calculate float numbers in shell script? -

i'm trying calculate float numbers in shell these commands: zmin='0.004633' zmax='3.00642' step='0.1' echo "zmin=$zmin" echo "zmax=$zmax" echo "step=$step" n=`echo "(($zmax - $zmin)) / $step " |bc -l ` b=${n/\.*} echo "b=$b" ((j = 1; j <= b; j++)) z_$j=`echo "scale=7; (($zmin + $(($j-1)))) * $step" |bc -l` zup_$j=`echo "scale=7; $((z_$j)) + $step " |bc -l ` echo "z_$j=$((z_$j)) && zup_$j=$((zup_$j))" done but receive correct answer n . z_$j & zup_$j i'm receiving error: 'z_9=.8004633: command not found' how can solve problem? your problem isn't floating-point, it's can't build variable name this. if using strict posix shell, need use eval this: tmp=$( echo "scale=7; ( $zmin + $j - 1 ) * step" | bc -l ) eval "z_$j=$tmp" however, ...

c++ - Why does string sometimes is written in one direction, sometimes in another? -

this code: byte bytes[] = {0x2e, 0x20, 0x65, 0x00, 0x74, 0x00, 0x61, 0x00, 0x64, 0x00, 0x70, 0x00, 0x75, 0x00, 0x67, 0x00}; std::wstring s; s.resize( 8 ); memcpy( &s[0], bytes, 16 ); _tprintf( _t("key: %s\n"), s.c_str()); messagebox ( 0, s.c_str(), _t(""), 0 ); the result in message box gupdate in in console ?etadpug . i think encoding. 0x2e20 or 0x202e mean something? your bytes sequence of chars in utf-16 (2-byte-per-char encoding). it contains reversed string gupdate after rtl override mark (which reverses order of symbols after it). specifically: 0x2e, 0x20 = u+202e = right-to-left override 0x65, 0x00 = u+0065 = e 0x74, 0x00 = u+0065 = t 0x61, 0x00 = u+0074 = etc. note how bytes reversed. so, message box reverses order of characters, because unicode-aware , sees rtl override mark. regular console output not (actually, is, depends on project settings , functions use io. in case it's non-aware version).

javascript - How to configure TinyMCE to allow a block-level elements inside anchor tags? -

here scenario; want able create content like: <div class="a"> <a href="someurl"><img src="somepic"></a> </div> however tinymce strips <div class="a"> <img src="somepic"> </div> thanks! i resolved with: convert_urls : false, remove_script_host : false, verify_html: false, valid_children : "+a[div|h1|h2|h3|h4|h5|h6|p|#text]", :)

Rails route -> if no data, check another route -

i have route match ":id", :to => "doctors#show", :via => :get, :as => :doctor match ":id", :to => "doctors#update", :via => :put, :as => :doctor which gives me: http://domain.com/id now, created controller want have routes same previous. match ":id", :to => "professions#show", :via => :get, :as => :profession which gives me: http://domain.com/id but, want create checking system, example: if first route didn't found data, go , check one. definetly won't same @ time. this show code in controller: def show @profession = profession.find_by_slug(params[:id]) end exception handling job of controller not routing. to rescue no record error class applicationcontroller < actioncontroller::base rescue_from activerecord::recordnotfound, with: :record_not_found private def record_not_found render text: "404 not found", status...

objective c - NSSavePanel Changing File Name Extensions With AccessoryView -

i have nssavepanel accessoryview let user select graphic format can save image (nsimage) file. far, have following. (i'm skipping lines make short.) - (void)exportfile { nsstring *filename; if (formatindex1 == 0) { // default selection user in preferences filename = @"untitled.bmp"; } else if (formatindex1 == 1) { filename = @"untitled.gif"; } ... [panel setallowedfiletypes:[[nsarray alloc] initwithobjects:@"bmp",@"gif",@"jpg",@"jp2",@"png",nil]]; [panel setallowsotherfiletypes:no]; [panel setextensionhidden:no]; [panel setcancreatedirectories:yes]; [panel setnamefieldstringvalue:filename]; [panel setaccessoryview:accessoryview1]; [formatmenu1 setaction:@selector(dropmenuchange:)]; // formatmenu1 nspopupbutton [formatmenu1 settarget:self]; [panel beginsheetmodalforwindow:window completionhandler:^(nsinteger result) { ...

Issue with multiselect combobox control in Windows 8 -

Image
i creating multiselect combobox in windows 8 shown in below image: for have created custom control code mentioned below: problem below code 1. on selecting all items not selected 2. selected items not displayed in textbox how can fix that. need asap pls xaml: <usercontrol x:class="app5.multiselectcombobox" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="using:app5" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:ignorable="d" d:designheight="300" x:name="thisuc" d:designwidth="400"> <combobox x:name="multiselectcombo" scrollviewer.horizontalscrollbarvisibility="auto" scrollviewer.verticalscrollbarvisibi...

Why I have memory leak in C/MEX? -

i'm totally beginner in c/mex. simple code call "magic" function matlab. have no idea why "out of memory" message. #include <mex.h> void mexfunction(int nlhs, mxarray *plhs[], int nrhs, const mxarray *prhs[]) { #define a_in prhs[0] #define a_out plhs[0] mxarray *r; r=mxcreatedoublematrix(a_in,a_in,mxreal); mexcallmatlab(1, r, 1, &a_in, "magic"); a_out = mxduplicatearray(r); mxdestroyarray(r); return; } a_out seems duplicate of r . basically, according doc (that should read before asking question, sayin' :) ), creating new array . calling function allocate more memory store copy. so leak a_out . can use valgrind tool finding those, options --leak-check=full . of course, compile debug flags of compiler ( -g3 gcc ), give of informations need fix leaks.

openrefine - Trying to parse a Json with Open Refine GREL -

i'm trying parse json can't find way extract data want. { "results" : [ { "address_components" : [ { "long_name" : "44", "short_name" : "44", "types" : [ "street_number" ] }, { "long_name" : "rue montaigne", "short_name" : "rue montaigne", "types" : [ "route" ] }, { "long_name" : "agen", "short_name" : "agen", "types" : [ "locality", "political" ] }, { "long_name" : "lot-et-garonne", "short_name" : "lot-et-garonne", "types" : [ "administrative_area_level_2", "political" ] }, { "long_name" : "aquitaine", "short_name" : "aquitaine", "types" : [ "administrative_area_level_1...

java - my logic for printing a loop isnt right. cant get my head aroud this -

//the question (my code after that) variable n randomly generated integer. output characters '*' , '#' first row contains stars , last 1 number signs. number of stars decreases in each consecutive row. total number of characters in row n , there n + 1 rows. for example, if n has value 5, program output: ***** ****# ***## **### *#### ##### //my code below! random r = new random(); int n = r.nextint(5) + 10; system.out.println("n: "+n); while(n>0){ for(int star = n; star>0; star--){ system.out.print("*"); } for(int hash = 0; hash<n; hash++){ system.out.print("#"); } system.out.println(""); //new line n--; } //my code output - problem: #'s need increase in size 0 rather decrease *'s **********########## *********######### ********######## *******####### ******###### *****##### ****#### ***### **## *# just remember line on....

scroll - Get position of clicked element with jquery? -

i want scroll item view when it's clicked, cannot manage it's top position on click: this i'm trying right now: $( "section" ).click(function(e) { console.log("thing top: "+$(this).position().top); //$('html,body').animate({ scrolltop: 0 }, 'slow'); //return false; }); however same top position, matter element clicked. how can right? try $(this).offset().top gets position relative document rather parent offset

linq - Find documents that DON'T have a string in a collection -

i have entity following: class person { public icollection<string> optout { get; set; } //other fields } my application allows user create dynamic mailing lists based on well-known set of fields in person . the customers should able opt out of different mailing lists, optout might contain [ "marketing", "financial" ] . the query specific mailing list aggregates filter expressions (using queryable.where ) , ravendb creates needed indexes without problems. i have been reading, , seems neither of these constructs supported: people.where(x => !x.optout.contains(mailinglisttype)); people.where(x => !x.optout.any(o => o == mailinglisttype)); people.where(x => x.optout.all(o => o != mailinglisttype)); how can create right query? you need create index type of query. in index should flatten optout collection can create queries on it. more on here: how query items nested collections in raven db? edit it seems ...

Nested parallellism in OpenMP -

i want map tasks 3 threads follows: each of taska , taskb , , taskc must executed separate threads. taska has subtasks task(1) , task(2) , , task(3) . taskb has subtasks task(11) , task(12) , , task(13) . taskc has subtasks task(21) , task(22) , , task(23) . if 1 of taska , taskb , , taskc finishes , there @ least 1 unstarted subtask of task, thread associated finished task should steal unstarted subtask. i not able achieve setting. able following mwe. in mwe, threads not obey rules 2, 3, 4. here mwe: double task(int taskid) { int tid = omp_get_thread_num(); int nthreads = omp_get_num_threads(); printf("%d/%d: taskid=%d\n", tid, nthreads, taskid); int i; double t = 1.1; for(i = 0; < 10000000*taskid; i++) { t *= t/i; } return t; } double taska() { int tid = omp_get_thread_num(); int nthreads = omp_get_num_threads(); printf("%s %d/%d\n", __function__, tid, nthreads); double a, b,...

android - Is there a way to keep the dividers around a non selectable preference? -

if set selectability of preference item false, notice dividers around item disappear. do know if there way keep dividers? i have looked @ listview api , not find solution applied here, since there no selectable attribute listview items (except headers , footers ). thanks! i did hack. <preference android:layout="@layout/preference_divider" /> <preference android:title="@string/whatever" android:selectable="false" /> res/layout/preference_divider.xml <?xml version="1.0" encoding="utf-8"?> <view xmlns:android="http://schemas.android.com/apk/res/android" android:background="#cccccc" android:layout_width="fill_parent" android:layout_height="1px" />

Logback / Weblogic How to set different log level? -

i using weblogic 10.3.6 , not able control different log level 2 different appenders (com.my & root) given logback.xml expecting trace level file appender , nothing under weblogic terminal. issue same output on both. <?xml version="1.0" encoding="utf-8"?> <!-- assistance related logback-translator or configuration --> <!-- files in general, please contact logback user mailing list --> <!-- @ http://www.qos.ch/mailman/listinfo/logback-user --> <!-- --> <!-- professional support please see --> <!-- http://www.qos.ch/shop/products/professionalsupport --> <!-- --> <configuration> <contextname>mycontx</contextname> <jmxconfigurator /> <appender name="file" class="ch.qos.logback.core.rol...

Printing validation message on the same page in PHP -

hi have function in handling upload errors. function error($error, $location, $seconds = 5) { header("refresh: $seconds; url=\"$location\""); echo 'error :' . $error . ' please correct before proceeding.'; exit; } since echo 's message, know message shows not in same page , need hit browser return original content page. what wanted validation messages shown on same page, tried changing code following. function error($error) { $errmsg = 'error :' . $error . ' please correct before proceeding.'; } and later in form in table have following call massage. <td><?php if(!empty($errmsg)) echo $errmsg; ?></td> however method doesn't seems giving me solution need, print validation message on same page. can help? thanks. you use ajax call error function , output message on page. or set $_post, $_get, or $_session variable pass error message onto next page. session ex...

delphi - Invoke method on generic type? -

why following generate error in delphi (xe)? unit utest; interface type ttest = class public procedure foo<t>(a: t); end; implementation { ttest } procedure ttest.foo<t>(a: t); begin a.add('hej'); end; end. i thought generic types in delphi inserted generic function, error out if used type don't have add(string) method. your code produces compilation error because compiler has no way of knowing t has method named add receives single string parameter. i thought generic types in delphi inserted generic function, error out if used type don't have add(string) method. if using smalltalk or c++ templates, assumption accurate. however, generics not same templates. generics need apply constraint type parameter. constraint needs tell compiler properties t must have. for example, constrain t derived class has suitable add method. or constrain t implement interface suitable add method. documentation link delphi generic ...

android - How to add own VPN settings to system VPN settings page? -

Image
there system setting vpn. going add additional vpn service based on vpnservice class. see there method setconfigureintent looks similar need not see examples of usage. public vpnservice.builder setconfigureintent (pendingintent intent) added in api level 14 set pendingintent activity users configure vpn connection. if not set, button configure not shown in system-managed dialogs. vpn settings pages here: , . actually need add button system vpn settings clicking on custom dialog vpn specific settings shown. here starting point @shoe rat proposed, using java reflection: package com.nikola.despotoski.whatever; import java.lang.reflect.constructor; import java.lang.reflect.field; import java.lang.reflect.invocationtargetexception; import java.lang.reflect.method; import java.util.hashmap; import java.util.iterator; import java.util.map; import java.util.set; public class vpnsetter { private static map<string , class<?>> getmappedfiel...