Posts

Showing posts from April, 2011

How to Find Class of + in Ruby -

the design philosophy of ruby amazing. did 1 + 2 , got 3 . managed make this: 1.+(2) # => 3 . as cool was, wanted test out class method on + method. +.class => syntaxerror: (irb):14: syntax error, unexpected '.' +.class ^ and then: +().class => nomethoderror: undefined method `+@' nilclass:class while: +(2).class nomethoderror: undefined method `+@' fixnum:class why +(2).class fixnum , not integer? try again +(2.to_i).class , same error appears +(2).class . but key question: how find class of + method? 1 + 2 calling + method on 1 2 argument, same 1.+(2) . however, because of precedence, +(2).class calling (2).class first, returning instance of class , calling nonexistent +@ method, unary plus method exists numeric . can test typing (+(2)).class , returns fixnum 1 expect. source of error +().class , because () returns nil , , class of nil nilclass , doesn't have +@ method. tl;dr: because precedence ma...

squeak - How do I make really large text in Smalltalk? -

i'm trying make large text banner in squeak smalltalk, following code: t := textmorph new. t string: 'you win!' fontname: 'bitstreamverasans' size: 400. t extent: 600@100. t center: display center. t openinworld. but text size seems max out @ 60. using wrong class? don't need text editable. two ways: add font size: (textstyle named: #bitstreamverasans) addnewfontsize: 200 , use regular text morph before. use "truetype banner" can arbitrarily scaled: either 1 object catalog, or use ttsamplestringmorph new initializetostandalone openinhand . initializetostandalone method make own. for large heading use

C# - Creating variable dynamically to get each variable value -

i'm going need have list size of list depended on jsonarray. need create slider according size of list. can make slider dynamically according jsonarray's list, can't take value processed later. many help! here attempted code: private void generatedynamic() { listbox lb = new listbox(); (int = 0; list.count; i++) { stackpanel stackpanel = new stackpanel(); slider slider = new slider(); stackpanel.children.add(slider); lb.items.insert(i, stackpanel); } } private void onsavevalue(object sender, eventargs e) { // need save each slider's value here } start converting jsonarray c# typed collection. able leverage two-way binding directly in xaml. add listbox view set itemsource property collection define itemtemplate containing stackpanel + slider (check msdn ) bind slider value object... done...

android - in-app purchase queryInventoryAsync doesnt return item which is already purchased -

i using test product id (product_id = "1023608") implement nokia in-app purchase. i can purchase item using following code snippet. mhelper.launchpurchaseflow(this, product_id, rc_request, this, ""); i getting succes response in oniabpurchasefinished . when try query recent purchases using mhelper.queryinventoryasync(this); getting owned items response: 0 . i wondering should return me product id of purchased item. can please me if missing ? thanks :-) are using emulator testing: known issues state " state of test ids not stored back-end when emulator used initiate purchase transactions. " here's link it: http://developer.nokia.com/community/wiki/nokia_x_known_issues

python - Dokku + tornado app = 502 Bad Gateway -

i'm trying make friends dokku. i'm run dokku on digitalocean droplet. user@mypc:~$ cat procfile web: python3 main.py user@mypc:~$ git push dokku master counting objects: 5, done. delta compression using 4 threads. compressing objects: 100% (3/3), done. writing objects: 100% (3/3), 295 bytes | 0 bytes/s, done. total 3 (delta 2), reused 0 (delta 0) -----> building app ... -----> installing env in build environment ... python app detected -----> preparing python runtime (python-3.4.0) -----> installing setuptools (2.1) -----> installing pip (1.5.4) -----> installing dependencies using pip (1.5.4) < long install reqs log > cleaning up... -----> discovering process types procfile declares types -> web -----> releasing app ... -----> deploying app ... -----> cleaning ... =====> application deployed: http://app.myapp.ru dokku@myapp.ru:app d2cd6b3..7733adf master -> master despite fact download successful, i...

c# - How can I unzip a file to a .NET memory stream? -

i have files (from 3rd parties) being ftp'd directory on our server. download them , process them 'x' minutes. works great. now, of files .zip files. means can't process them. need unzip them first. ftp has no concept of zip/unzipping - i'll need grab zip file, unzip it, process it. looking @ msdn zip api , there seems no way can unzip memory stream? so way this... unzip file (what directory? need -very- temp location ...) read file contents delete file. note: contents of file small - 4k <-> 1000k. zip compression support built in: using system.io; using system.io.compression; // ^^^ requires reference system.io.compression.dll static class program { const string path = ... static void main() { using(var file = file.openread(path)) using(var zip = new ziparchive(file, ziparchivemode.read)) { foreach(var entry in zip.entries) { using(var stream = entry.op...

winforms - The statement if combobox selectedindex == 1 || 2 gives a syntax error in c# -

i'm making human animal year converter. my code: if (combobox2.selectedindex == 1 || 2) { combobox3.visible = true; } i following error : operator '||' cannot applied operands of type 'bool' , 'int' you can't use above expression if (combobox2.selectedindex == 1 || 2) { combobox3.visible = true; } you have use in following way: if (combobox2.selectedindex == 1 || combobox2.selectedindex == 2 ) { combobox3.visible = true; }

sockets - udp connection to server -

i got template ($request) send server on udp port. i compile $request as: $request = '<?xml version="1.0" encoding="utf-8"?> <srv version="1.0" msg_type="request"> <header> <param name="sn" value="' . ++$sn . '" /> <param name="user" value="' . $api_user . '" /> <param name="cmd" value="' . $cmd . '" /> </header> <mycmd> </mycmd> </srv>'; i try communicate server with: if(!($sock = socket_create(af_inet, sock_dgram, 0))) { $errorcode = socket_last_error(); $errormsg = socket_strerror($errorcode); die("couldn't create socket: [$errorcode] $errormsg \n"); } echo "socket created \n<br />"; //communication loop while(1) { if( ! socket_sendto($sock, $input , str...

java - How can receive multiple files in InputStream and process it accordingly? -

i want receive multiple files uploaded client-side. uploaded multiple files , request server-side (java) using jax-rs (jersey) . i have following code, @post @consumes(mediatype.multipart_form_data) public void upload(@context uriinfo uriinfo, @formdataparam("file") final inputstream is, @formdataparam("file") final formdatacontentdisposition detail) { fileoutputstream os = new fileoutputstream("path/to/save/" + appropriatefilename); byte[] buffer = new byte[1024]; int length; while ((length = is.read(buffer)) > 0) { os.write(buffer, 0, length); } } how can write files separately in server side uploaded in client side. for eg. uploaded files such my_file.txt, my_file.png, my_file.doc . need write same above my_file.txt, my_file.png, my_file.doc in server side. how can achieve this? you try this: @post @consumes(mediatype.multipart_form_data)...

java - Execute Select HQL with no locks? -

i have below hql query. want select without getting lock on tables department, employees other query concurrent retrieve records these table when below query running/executing from department dept inner join fetch dept.employees emp dept.id = :deptid i tried below thats still acquiring locks from department dept nolock inner join fetch dept.employees emp nolock dept.id = :deptid from department dept with(nolock) inner join fetch dept.employees emp dept.id = :deptid try this. note with(nolock) appended clause.

javascript - Incorrect output post JSON.parse(...) -

the controller method : @requestmapping(value = "channelintentiondetails.html", method = requestmethod.post) public @responsebody report getchannelintentiondetails(@requestbody searchparameters searchparameters) { logger.info("in reportcontroller.getchannelintentiondetails(...), searchparameters " + searchparameters); return channeldetailsservice.getintentiondetails(searchparameters); } the report pojo : public class report { private map<string, collection<string>> parameterwiseresult; private collection<string> results; private string result; private string spid; . . . } the results collection holds json strings returned mongodb collection the js ajax snippet : var xmlhttp = new xmlhttprequest(); xmlhttp.open("post","channelintentiondetails.html",false); xmlhttp.setrequestheader("content-type","appl...

java - Hesitation about blank fields in access database -

i'm trying values db in *.accdb format microsoft access. i'm writing java programa using proper jdbc driver gets values access database. the query this: select * table_name i able retrieve values need , have no problem that. issue comes when see (apparently, i'm quite sure are) empty fields on file, retrieved "null" or "" (empty strings) text datatype columns when convert results strings in java. i analyzed database looking default value of each column etc.. found no logical reason retrieving null or "" empty cell. according office support page: when field contains no values, contains null value or, for text, memo, or hyperlink fields, null value or zero-length string . then see empty fields can returned in both types still can't understand the criteria . i found out in mssql databases depends on how value entered. if have table (asuming als cols string): tbl1 ---------------------- | col1 | col2 | col3 | --...

classpath - How to resolve this error Caused by: java.lang.ClassNotFoundException -

i wrote console application helloworld.java , ran javac helloworld.java ,and java helloworld . worked fine. i created package com.abc.project , moved helloworld.java it(the package import statement correctly generated package com.abc.project; ). , ran javac helloworld.java worked fine , generated class properly. however, when ran java com.abc.project.helloworld console, threw "class not found" error. please can advise problem? try running java -cp absolute_path com.abc.project.helloworld where absolute_path refers directory class files along packages present. bin directory class files generated along same directory structure source files

c# - How to catch all Exceptions in a WPF program so that TextWriterTraceListener writes it to the log before crashing -

i have pretty normal wpf program (in vb.net same should no different c#) , have implemented textwritertracelistener writes log file. issue have if there exception uncaught app crashes , log file seems "behind" not show last entry before crashing. can somehow make textwritertracelistener write log file faster? i have implemented application_dispatcherunhandledexception not seem catch unhandled errors. i aware on proper close down have call flush , close on textwritertracelistener object, issue if app crashes don't opportunity this. have tried add appdomain.currentdomain.unhandledexception += appdomain_unhandledexception; as application_dispatcherunhandledexception ?

is ArrayList a java library class if not, what is a java library class used to store arrays? -

if is, , wanted store input user array without using java library class, how go doing this? know how use arraylist< string > items = new arraylist< string >(); arraylist part of javas collection framework. instead in search of how use array? may this: string items = new string[size]; but need know how in advance how many items need store.

java - Terribly slow on Grails app -

the performance of grails app terribly slow. needs @ least 5-7 seconds load page. prompt me outofmemory , server error 500 every page. the terribly slow performance affects work , unable test , develop project in acceptable time. have deal problem first. i tried to: config settings in idea64.exe.vmoptions , idea.exe.vmoptions settings in development handbook. config settings of java in java control panel added runtime parameters –xms-4096m. config settings of %grails_home%\bin\startgrails.bat, grails_opts . however, situation not improveing. i using win7-64 bit, 8gb ram, intellij 13.0.2 develop. please help. thank much!! this issue database lookup. out of memory errors caused bringing data (possibly filtering in jvm instead of database query). slowness possibly caused again bringing data, or n+1 selects

java - Spring MVC conversion HOW TO -

i have vehicle service that, among other has list of parts. adding new service not problem, viewing of service not problem, when try implement edit, not preselects list of parts. so, thinking thymeleaf issue, post question here . and answer got try implement spring conversion service. did (i think), , need me out of mess. problem view compares instances of parts service instances of parts form partsattribute containing parts, , never uses converters, not work. receive no errors... in view, parts not selected. bellow find converters, webmvcconfig, partrepository, servicecontroller , html w/ thymeleaf, reference. doing wrong??? converters: parttostring: public class parttostringconverter implements converter<part, string> { /** string represents null. */ private static final string null_representation = "null"; @resource private partrepository partrepository; @override public string convert(final part part) { if (part...

mysql - Select the amount of billable hours and non-billable hours -

i started in database, kind me please. application want write seems basic, tried, failed. here problem: have this: table: employee # | colonne | type | interclassement | attributs | null | défaut | | action 1 | id | int(11) | no | aucune | auto_increment 2 | name | varchar(50) | latin1_swedish_ci | yes | null 3 | firstname | varchar(50) | latin1_swedish_ci | yes | null | 4 | idnumber | int(11) | yes | null 5 | mail | varchar(50) | latin1_swedish_ci | no | aucune | 6 | password | varchar(50) | latin1_swedish_ci | no | aucune | 7 | site | varchar(50) | latin1_swedish_ci | yes | null | 8 | entrance | date | yes | null | 9 | departure | date | yes | null | 10 | car_id | int(11) | yes | null | 11 | profil_id | int(11) | yes | null | table : imputation # | colonne | type | interclassement | attributs | null | défaut | | action 1 | id | int(11) | | | no | aucune | auto_increment 2 | hours | int(11) | | | yes | null | 3 | description | varchar(256) | latin1_swedish_ci | ...

java - AMQP 1.0 topic non-durable consumer -

for time i'm trying create topic consumer not require subscription. achieve similar behavior jms non-durable topic subscriber. i'm using ms azure amqp 1.0 service bus , apache qpid amqp 1.0 client (jms implementation). thanks

excel - Range.Resize not working -

i'm baffled, i've read on multiple sites valid code ws.range("b6").resize(, 2) ws being worksheet. cannot, life of me, work. however, if this. ws.range("b6").resize(, 2).select it magically works. don't want range selected, resized. doing wrong? as mentioned in comments, range.resize doesn't somehow modify representation of range in sheet, modify range variable in vba code. so set rng = ws.range("b6") refers cell b6 , set rng = ws.range("b6").resize(, 2) refers b6:c6 what you're looking merging cells this: ws.range("b6").resize(, 2).merge

php - How can I use mail() with redhat, I can't send mail -

i experiencing problem since week.... installed redhat web server 6 , upload file. work nor form. when want send form, got error message : object(socketexception) { [protected] _attributes => array() [protected] _messagetemplate => '' [protected] _responseheaders => null [protected] message => 'could not send email.' [protected] code => (int) 500 [protected] file => '/var/www/step/lib/cake/network/email/mailtransport.php' [protected] line => (int) 76 } the form use mail() function of php. i have no idea, should configure on redhat web server let him send e-mail. the ports smtp, www, ssh open i install postfix did not solve problem. someone know can do? should installed , how configure it? many thank in order use function mail() "fatal: chdir /var/spool/postfix: permission denied" can solved with: setsebool -p httpd_can_network_connect 1 see: http://chirale.wordpress.com/201...

python - wx.DestroyChildren in event handler cause segmentation fault on osx -

the following python code runs fine on windows, cause segmentation fault on osx. suggestions why? not make difference use callafter... import wx class myframe(wx.frame): def __init__(self): wx.frame.__init__(self, none) self.sizer = wx.boxsizer(wx.vertical) self.sizer.add(wx.statictext(self, -1, 'static text')) self.sizer.add(wx.button(self, -1, 'button')) self.setsizer(self.sizer) self.bind(wx.evt_button, self.on_button) def on_button(self, event): self.sizer.clear() self.destroychildren() app = wx.app() frame = myframe() frame.show() app.mainloop() it because there still system messages pending destroyed widgets, (mouse motion in case) possibility code run after return event handler try use destroyed widgets (calling methods or accessing attributes.) using callafter delay destruction solve problem me, version of wxpython using? if doesn't work may want try using wx.calllat...

javascript - Table column styling with jquery -

i have table on website , trying style jquery. code using works fine normal table if in column 2 cells merged destroys style. want 1 column coloured , 1 column blank jquery code $( document ).ready(function() { $('#tab-table').find("table").addclass('s-table'); $(".s-table tr td:nth-child(2n+1)").css("background-color","#d1deec"); }); link fiddle i'd use loop (if merged cells stay same.. see fiddle: http://jsfiddle.net/jfit/k5yz9/4/ $("table tr:not(:first)").each(function() { if($(this).find('td').length == 7) { //can replace array 2/4/6 $(this).find('td:nth-child(2)').css("background-color","#d1deec"); } else { // 3/5/7 $(this).find('td:nth-child(3)').css("background-color","#d1deec"); } //loop array }); update http://jsfiddle.net/jfit/k5yz9/6/ using array: $("table tr:not(:first)...

python - If expression variables inside if block -

this common idiom: if foo.get("bar"): bar = foo.get("bar") # bar instead want like if foo.get("bar") bar: # bar is there way in python? no, there not. bar = foo.get('bar') if bar: ... del bar

Android set background from filepath -

i similar imageview.setimageresource(r.drawable.myimage); instead of providing image app's resources, point file ( /sdcard/.../image.jpg ). is there way that not involve loading bitmap , setting bitmap imageview ? thanks you can update background sdcard follows... string pathname = environment.getexternalstoragedirectory().getpath() + "/folder/" + "image.jpg"; bitmap bitmap = bitmapfactory.decodefile(pathname); imageview.setimagebitmap(bitmap);

ruby on rails 3 - Is there any alias for text fields when using Active Admin in ROR -

am using active admin, in database, field name big. so, want make alias field in display. want this f.input :incorrect_price_and_designer_1 , :alias=>"incorrect 1" please, let me know if available. thanks support in advance.. inc_answer.input :incorrect_price_1, :label => "incorrect 1" this works fine... it might helpful people

Define enum representation type in C# -

i know, there posibility in c# change default (integer) representation of enum less weight char . many of ask me why want it? answer simple: i have work @ huge, huge array . pc allow me allocate memory array of integer 540 000 000 elements (2048 * 2048 * 128). know integer needs aroud 4 times more memory char . char representation give me 2 000 000 000 elements manipulate. much easier in programming masive algorithms work @ enum char if change of representation isn't possible have work on charracters. yes, can change type of enum not char . byte can work it's 1 byte type. check enum (c# reference) on msdn (emphasis mine): every enumeration type has underlying type, can integral type except char . default underlying type of enumeration elements int. declare enum of integral type, such byte, use colon after identifier followed type , shown in following example. enum days : byte {sat, sun, mon, tue, wed, thu, fri}; the approved types en...

iphone - iOS 7 Background Fetch When the App is Not Running -

Image
i've written simple application in order test , monitor how background fetch feature works in ios7. first of all, i've set uibackgroundmode options in info.plist file. then; i added below code application:didfinishlaunchingwithoptions: method in appdelegate.m : at last, i've implemented application:(uiapplication *)application performfetchwithcompletionhandler: method requested. every time click debug->simulate background fetch button, changes application's batch number , works expected. however, i've never been able make work when application not running (not in background mode, not running). apple says when application not running , os wants execute following methods respectively: application:(uiapplication *)application didfinishlaunchingwithoptions: applicationdidenterbackground:(uiapplication *)application application:(uiapplication *)application performfetchwithcompletionhandler: so question is there way test background f...

linear algebra - OpenGL Depth Calculation for Bounding Boxes -

Image
i´m writing opengl app uses transparency/translucency algorithms based on depth ordering. my first approach calculates bounding box center distance camera objects, realized 1 bounding box can closest camera other, center farthest. the orientation of boxes can different axis aren't aligned. how can calculate correctly bounding box distance camera? the best approximation can done sorting objects using farthest obb point z-component in camera space (the point highest/lowest z-component in camera space depending on handedness) , hence comes name z-sorting. can use squared distance fine. remember when issuing draw commands need render 1 of them first (you can't draw them partially unless break each of them separate objects. in case object1 should drawn first, , notice has farthest point along camera axis. the algorithm in nutshell: transform each bounding box points camera space. find farthest point along camera z axis point each box. become depth key...

javascript - Write href with jQuery at domain level -

not sure if title makes sense or not. but i'm doing looking anchor inside div class of banner. trying write href www.domain.com/catno.prd. however, because i've build sat on www.domain.com/foo/bar/ it's returning www.domain.com/foo/bar/catno.prd how can remove /foo/bar/ link returns on domain? here's have $('.banner a').attr('href', function() { return $sd(this).attr('catno') + '.prd' }); thanks :) just add leading / : $('.banner a').attr('href', function() { return '/' + $sd(this).attr('catno') + '.prd' });

php - How do I get the external IP address in a Symfony2 controller? -

similar https://stackoverflow.com/a/9029790/1069375 what symfony2 (built-in?) way external/public ip address of web server? eg. there close this? $this->container->get('request')->getclientip(); // returns string '::1' (length=3) note i coding , testing on localhost, behind nat firewall. don't want "127.0.0.1" answer, whatever web visitors perceive should gateway forward www ports dev server. use dynamic dns hostname, in case have resort it, prefer more portable method. to avoid going off topic in comments: $_server['remote_addr'] // returns '::1' you have 2 possibilities. first 1 simple one, ask third parties server: $externalcontent = file_get_contents('http://checkip.dyndns.com/'); preg_match('/current ip address: ([\[\]:.[0-9a-fa-f]+)</', $externalcontent, $m); $externalip = $m[1]; and other one, parse server config, like: /sbin/ifconfig |grep -b1 "inet addr" |awk ...

c# - User Controls not working in asp.net -

i have asp.net application developed using .net 1.1 . header , footer user controls. need change text , images in user control, have limitation don't have visual studio 2003 installed in machine. when edit user control files in notepad , save changes not getting reflected in pages. note need make changes ui of user controls no code behind changes needed. advice.... the controls need rebuilt, not source code edited. you need use visual studio

android - Reading a XML file -

i using following code read xml file named contactfile saved in resourcefile in c: directory public class mainactivity extends activity { @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); extract(null); } public static void extract(string argv[]) { try { file xmlfile = new file("c:\\resourcefile\\contactfile.xml"); documentbuilderfactory dbfactory = documentbuilderfactory.newinstance(); documentbuilder dbuilder = dbfactory.newdocumentbuilder(); document doc = dbuilder.parse(xmlfile); doc.getdocumentelement().normalize(); system.out.println("root element :" + doc.getdocumentelement().getnodename()); nodelist nlist = doc.getelementsbytagname("extractcontact"); system.out.println("-----------...

How to compile and work samtools with cygwin -

i need resolve problem. got error when compiled samtools under cygwin (windows 8 64 bit). i got following message: admin@user ~/samtools-0.1.19 $ make make[1]: entering directory '/cygdrive/c/users/admin/cygwin/home/samtools-0.1.19' make[2]: entering directory '/cygdrive/c/users/admin/cygwin/home/samtools-0.1.19' gcc -c -g -wall -o2 -d_file_offset_bits=64 -d_largefile64_source -d_use_knetfile -d_curses_lib=1 -dbgzf_cache -i. bgzf.c -o bgzf.o in file included bgzf.c:32:0: bgzf.h:33:18: fatal error: zlib.h: no such file or directory #include <zlib.h> ^ compilation terminated. makefile:56: recipe target 'bgzf.o' failed make[2]: *** [bgzf.o] error 1 make[2]: leaving directory '/cygdrive/c/users/admin/cygwin/home/samtools-0.1.19' makefile:27: recipe target 'lib-recur' failed make[1]: *** [lib-recur] error 1 make[1]: leaving directory '/cygdrive/c/users/admin/cygwin/home/samtools-0.1....

verilog representation of a flops -

i teaching myself verilog , trying write modelling flop. have come across following modeling ck->q delay arcs in specify section not understand dos. (posedge ck => (q : 1'b1))=(0, 0); can explain me on how works? when d=1, ck->q considers these delays? if need have (posedge ck => (q : 1'b0))=(0, 0); then x propagation on pin d verliog can used model many levels. simple behavioural model, rtl (synthesizable) modelling transfer of data , control or gate level @ logic gate level, (ands ors, flip-flops). typically gate level has aware of these delays. the typical way of modelling flip-flip behaviour in rtl : always @(posedge clk) begin q <= d; end

jquery - Bootstrap 3.0 Carousel - not working -

so want implement above carousel page , seem have multiple problems it. page in question is: http://wasup.si/test-bid1 as see looks doesn't start...no console errors whatsoever. can me out here i'm doing wrong? <!-- carousel ================================================== --> <div id="mycarousel" class="carousel slide" data-ride="carousel"> <!-- indicators --> <ol class="carousel-indicators"> <li data-target="#mycarousel" data-slide-to="0" class="active"></li> <li data-target="#mycarousel" data-slide-to="1"></li> <li data-target="#mycarousel" data-slide-to="2"></li> </ol> <div class="carousel-inner"> ...

c# - Need to search multiple words using linq -

i have requirement user comes , enters search words based on need query using linq , display records. eg goes here: search eg 1: "infosys" if user enters infosys search term can use contains , result easily. eg 2: "tata consultancy services" if user enters can still use contains , record easily. catch if user enters "tata services" or grammitical mistake "tata constult service" still want show records consists of of 3 words. either tata/consutult/service. this search dynamic , not restricted 3 array. can split words space. use any extension method: string querystring = "tata services"; var queryparts = querystring.split(' '); var result = records.where(r => queryparts.any(p => r.name.contains(p)));

How to read from a list and print the elements using C#? -

i have list consists of different bitmap images elements. question how can see content of list? you can check count property iterate on images in list this: if(list1.count > 0) { foreach(var img in list1) { picturebox3.image = img; await task.delay(10); // wait 10 millisecond asynchronously } } note: in order use await , need make method async .see documentation .

wpf - How to make Label Text Underline? -

how can make label text underline in wpf? stucked , not find property underline: <label name="lblusername" content="username" fontsize="14" fontweight="medium" /> in label no textdecorations , therefore try this: <label width="100" height="30"> <textblock textdecorations="underline">testtext</textblock> </label> edit: more universal solution in case, instead of label.content using label.tag , because content property can set once: <label tag="testcontent" width="100" height="30" horizontalcontentalignment="center" background="aliceblue"> <textblock textdecorations="underline" text="{binding path=tag, relativesource={relativesource mode=findancestor, ...

c# - Generating Image in Winform from MS Chart -

i have generated piechart using ms chart library.now per requirement have generate image of chart , later use image in application.here @ present generating image through hard coded image name , path dont want do.i want image generated , saved variable use later in application. here code in c# generate image.. piechart.saveimage(@"d:\myimage.jpg", system.windows.forms.datavisualization.charting.chartimageformat.jpeg); please me . in advance. create bitmap variable private bitmap chartimage; save chart memory stream , create bitmap memory stream. using (memorystream ms = new memorystream()) { piechart.saveimage(ms, chartimageformat.jpeg); this.chartimage= new bitmap(ms); }

mysql - Find and delete categories dont have product -

i have table in offer_category , product tables. want make query find offer_categories dont have product . on product have 170k rows , on offer_category table 3.6k my query: select offer_category.title,product.name,offer_category.id `offer_category` left join product on product.category_id = offer_category.id product.id null when want run , browser running (i can see circle looping) 10 min not response anything. how can make ? your query seems fine: select oc.title, p.name, oc.id `offer_category` oc left join product p on p.category_id = oc.id p.id null; (i rewrote table aliases make more readable.) the problem seem performance (or hanging connection database). improve performance, want index on product(category_id, id) : create index product_category_id_id on product(category_id, id);

arrays - java recursion: best collection of numbers -

given array of integers , given integer. how use recursion find collection of integers array sum of collection closest given integer? example, given array:1,2,3 , given integer 5, method returns 2,3; example: if given array is: 35,14,45,3 , given integer 50, method returns 35 , 14. it looks homework , i'll not put code, try explain algorithm . imagine, you're given [35, 14, 45, 3] , 50 ; 1. first sort array in descending order: [45, 35, 14, 3] 2. should remove 1st item in array , take or leave 3. you'll have 2 smaller problems: [35, 14, 3] , 5 (45 taken) [35, 14, 3] , 50 (45 left) 4. cut story short keep best score far: 5 in case. let trim negative value branches [35, 14, 3] , 5 (45 taken) best far 5. if array not empty, go step 2 the whole trace is [35, 14, 3] , 5 (45 taken) // best score far [14, 3] , -30 (45, 35 taken) // trim: worse best score far [14, 3] , 5 (45 taken) [3] , -9 (45,...

Webview frame not changing in ios7 when autolayout is enabled? -

i m working project in view had few labels @ top , web view in bottom content changes dynamically server.i wanted view scroll till web view content not happening when auto layout enabled. in way changed frame of web view (void)webviewdidfinishload:(uiwebview *)webview { //giving view default width , event content length height cgsize mywebviewtextsize = [webview sizethatfits:cgsizemake(self.view.frame.size.width,[mycalendarobj.event_content length])]; cgrect mywebviewframe = webview.frame; mywebviewframe.size.height = mywebviewtextsize.height; //setting frame size of web view display dynamic content string webview.frame = mywebviewframe; webview.scrollview.scrollenabled=no; //setting content size of scrollview equal web view content scroll till end [scrollview setcontentsize:cgsizemake(self.view.frame.size.width,(mywebviewtextsize.height+200))]; } this worked me when disabled auto layout wanted when auto layout enabled. please me on issue thanks in advance ...

android - Get drawable size without scale -

i want size of drawable without scaling. function take drawable , can't take uri : static private drawable applytheme (drawable drawable) { bitmap bitmap; if (drawable instanceof bitmapdrawable) { bitmap notmutable =((bitmapdrawable)drawable).getbitmap(); bitmap = notmutable.copy(bitmap.config.argb_8888, true); log.w(tag, "bitmap width:"+bitmap.getwidth()); } // etc... } actually code print 93px width drawable whereas original image width 140px. difficulty can't drawable uri because function must not take in argument. just need have original width & height of drawable. and ration imagescale/appscale return 1... thanks.

java - Gradle failed: unsupported Gradle DSL method found: 'exclude()' -

i'm trying include android project (android studio - latest, gradle) classes google endpoints (python) coded. server side tested , working. i'm not used gradle, therefore i'm following documentation @ google developers . after changing build.gradle file under src (as instructed doc) to: build.gradle: buildscript { repositories { mavencentral() } dependencies { classpath 'com.android.tools.build:gradle:0.9.+' } } apply plugin: 'android' repositories { maven { url 'http://google-api-client-libraries.appspot.com/mavenrepo' } mavencentral() mavenlocal() } android { compilesdkversion 19 buildtoolsversion "19.0.2" defaultconfig { minsdkversion 17 targetsdkversion 19 versioncode 1 versionname "1.0" } buildtypes { release { runproguard false proguardfiles getdefaultproguardfile('pro...

java - Problems with determining "Overlap" -

so have been trying find way determine "overlap" in images java game writing. know create box follow trainer encompasses , use contains point see if trainer's box contains point of car/pokemon, trying find alternate way around this. tried using nested if statements, not seem work. if wrong coding, or error in way of thinking, please let me know. example of nested ifs below. if (trainer.getpy() == squirtle.getpy() & trainer.getpx() == squirtle.getpx()){ if (trainer.getpy() >= squirtle.getpy() - 50) if (trainer.getpy() <= squirtle.getpy() + 50) if (trainer.getpx() >= squirtle.getpx() -50) if (trainer.getpx() <= squirtle.getpx() + 50) trainer.dead(); skully skull = new skully (trainer.getpx(), trainer.getpy()); } if (trainer.getpy() == pikachu.getpy() & trainer.getpx() == pikachu.getpx()){ if (trainer.getpy() >= pikachu.getpy() - 50) if (trainer.getpy() <= pikach...

date - current time minus mod_date_time -

i want able subtract current time mod_date_time field. this have far: select * prod_trkg_tran.mod_date_time - current_time user_id = '12345' * 24 * 60 "interval in minutes" any help? if using oracle, can use following query: select (mod_date_time - sysdate) * 24 * 60 prod_trkg_tran user_id = '12345';

twitter bootstrap - Orchard and CSS Preprocessing -

has attempted use css preprocessing when doing front end development in orchard (particularly bootstrap)? i use web matrix orchard dev work, looking expand beyond available bootstrap themes , incorporate less. i'm unsure of best route go. any tips appreciated. if must use webmatrix, install extension, compile less files ide when save them. http://extensions.webmatrix.com/packages/orangebits

UDDI config error: input string was not in correct format -

i'm trying install uddi 3 (from biztalk media) , i'm getting error while configuring web services: input string not in correct format. i've used same method install on server , worked fine, it's not working now. does know problem is, or @ least should check? thanks.

java - Error while setting LookAndFeel -

Image
i getting error when using syntheticablackmoonlookandfeel in java swing code. below code :: don't know why getting error ? try { uimanager.setlookandfeel(new syntheticablackmoonlookandfeel()); }catch(exception e) { e.printstacktrace(); } it showing me type of error : the solution issue specify fully-qualified name of lookandfeel class string argument uimanager.setlookandfeel() rather try pass instance of argument. so, in case, you'd want write: uimanager.setlookandfeel("(package).(namespace).syntheticablackmoonlookandfeel"); ...where you'd replace (package) , (namespace) correct values. it may this, i'm not 100% sure don't use theme you're referencing: de.javasoft.plaf.synthetica.syntheticastandardlookandfeel

sql loader - copying SQLLDR from one Oracle install to another -

i writing shell script import text files oracle database. script has in turn invoke sqlldr . discovered particular oracle install (let's call sys1) not have sqlldr in reason, , can't update running installer. did find system (sys2) seemingly same version of oracle installed (11.2.0) has sqlldr.exe in c:\oracle\product\11.2.0\client_1\bin . copied exe file, plus whatever in on sys2 in c:\oracle\product\11.2.0\client_1\lib missing form sys1. defined oracle_base , oracle_home . still, when invoke copied sqlldr.exe on sys1, get: message 2100 not found; no message file product=rdbms, facility=ulmessage 2100 not found; no message file product=rdbms, facility=ul what else need able run transplanted exe on sys1? thx! first thing missing %oracle_home%/rdbms/mesg/ulus.msb fiel. there might more things missing after copy one.

Grails make one g:datePicker depend on other g:datePicker -

imagine have index.gsp 2 dates: starting day , ending day. when user picks starting day, how can calculate + 2 months in ending day? i know in controller have like: use (timecategory) { c = new date() + 2.month } but how best way change ending day in gsp? remotefunction? edit: yes worked, thank lukelazarovic. like said thing needed change last line, changed to: $("#myid_month").val(month+3); function datewaschanged(){ .... $("#myid_month").val(month+3); } edit2: needed increment year, reason strings remember do: myinteger = parseint(mystring); i assume want on client - without reloading page +2 months date set end date datepicker. that means have using javascript or javascript-based framework (jquery). you can go along solution suggested in question: get date value grails datepicker change set value of end datepicker on last line of function datewaschanged this: $("#enddatepickerid").datpicker(...

javascript - box-sizing x IE7, the last battle -

i've been searching through web solution can viabilize box-sizing in ie7 (i know, year 2014, project (therefore clients) still demand this). need box-sizing because entire project responsive. i found boxsizing.htc , works pretty in case. but, unfortunately, not case. because i'm using angularjs , have div 3 columns (children divs float left) inside , can click on button change number of columns. when happens boxsizing.htc process calculations again making width , height smaller each time change number of columns. so, thought, angularjs can solve this. found pretty interesting link i adapt code this: myapp.directive('resizable', function($window){ return { restrict: 'a', link: function(scope, element){ scope.initializewindowsize = function(){ var win = angular.element($window); scope.windowheight = win.innerheight(); scope.windowwidth = win.innerwidth(); scope...

json - Load remote data from an AngularJS directive -

i come background of jquery, i'm attempting learn angularjs weather web app i'm building. have 4 select boxes @ top of page list of cities. each select box corresponds weather container below displays current weather selected city. i'm using directive weather containers shown below. proper way structure this? <weather city="select1"></weather> <weather city="select2"></weather> <weather city="select3"></weather> <weather city="select4"></weather> when select atl select box #1 shows atl in weather container select1. part works. need go out server , weather data displayed in directive. have api working can pass atl , returns weather data json. what's proper angular way of doing this? couldn't find in directives call services, ui-router has resolve . thanks. angular.module('yourapp') .directive('weather', ['$http', function ($h...

R search Number between two others in a vector -

i work rand have 2 vectors > k_anfang [1] 11 1723 > k_ende [1] 14 1725 i want have: 11,12,13,14,1723,1724,1725 to skip these rows in loop how numbers between 2 vectors? is looking for? k_anfang <- c(11, 1723) k_ende <- c(14, 1725) c(k_anfang[1]:k_ende[1], k_anfang[2]:k_ende[2]) other option (in inspiration @jilber) is unlist(mapply(seq, k_anfang, k_ende)) ... , one unlist(mapply(`:`, k_anfang, k_ende))

CSS3 background carve or radius issue -

Image
i trying create background carve in css. take in picture below. how can add radius in css3? can help? use: border-top-left-radius: 50%; border-top-right-radius: 50%; i made example of here: http://jsfiddle.net/dfs6h/2/

c# - Read from StreamReader doesn't reach the end - Using Telnet protocol -

i using telnet protocol in order query unix servers , output of commands. using minimalistic telnet code project , did slight modification enable reading output end of stream: public void writecommand(string cmd) { using (networkstream stream = tcpsocket.getstream()) { using (streamwriter writer = new streamwriter(stream)) { writer.autoflush = true; using (streamreader reader = new streamreader(stream)) { string message = cmd; writer.writeline(message); writer.flush(); while (!reader.endofstream) { string response = reader.readline(); console.writeline(response); } } } } } the problem when run method, supposed return output till end, it's blocked because not recognizing end of stream, condition reader.endofstream() never reached. can tell m...