Posts

Showing posts from July, 2014

php - How to manage the teaser and its image field in Drupal 7? -

i'm new drupal , have bounced against pretty straightforward problems. i've been seeking solution while without noticeable success anywhere else i'm depending on guys... how set specific size image in node's teaser? is possible create teaser appearing image cropped out center of actual image (i have pictures same size on teaser, while opening content reveal actual image in original size , proportions)? how style teaser separately node itself, content may placed differently (image of teaser appear beneath text part while opening node display above headline , text) i appreciate , suggestions related of questions here! thank you! go admin/structure/types/manage/[content_type]/display/teaser manage display fields. to configure how image displayed, click gear icon on right, choose image style want , click update. (don't forget click save). to view available image styles , modify them, go admin/config/media/image-styles to add new image style...

Android Local changing when using TTS to speak a String from BARCODE scanner via intent -

i'm developing application scans barcodes using external application via intent (barcode scanner). after receiving result of scan, use result find texte in database texte can either english or french, send via intent activity wich sound synthesis via tts . application supposed support french , english languages. managed playing booleens way : private string localelang = locale.getdefault().getiso3language(); private boolean is_fr = localelang.equalsignorecase("fra"); my goal force app force tts talk english accent if locals not french (so can japannese or whatever tts should keep english accent). i intetionnaly choose device language other frnech or english , here comes problem. because after invoking barcode scanner locals seems change match device once because of external intent barcode scanner, , whatever try tts talk accent of device. i know seems complicated code long sent in message. 1 solution between lot i've been trying in vain : public void ...

printing - Display Large Image in c# -

i want display large image small rectangle using c#. problem when not adjust rectangle size , image, half portion of image displayed every time. there way print image in bounds defined? mean can image re-size rectangle size? following code: int imageprintheight = this.papersize.width - this.printmargins.top - this.printmargins.bottom; int imageprintwidth = this.papersize.height - this.printmargins.left - this.printmargins.right; size datestoprintsize = textrenderer.measuretext(datestoprint, new font(this.font.fontfamily, 10)); y = y + descriptionsize.height + datestoprintsize.height; imageprintheight = imageprintheight - descriptionsize.height - datestoprintsize.height; e.graphics.drawstring(objcurrentprintjob.sdescription, new font(this.font.fontfamily, 10), new solidbrush(color.black), x + (imageprintwidth - descriptionsize.width) / 2, this.printmargins.top); e....

python - Please explain why these two builtin functions behave different when passed in keyword arguments -

consider these different behaviour:: >> def minus(a, b): >> return - b >> minus(**dict(b=2, a=1)) -1 >> int(**dict(base=2, x='100')) 4 >> import operator >> operator.sub.__doc__ 'sub(a, b) -- same - b.' >> operator.sub(**dict(b=2, a=1)) typeerror: sub() takes no keyword arguments why operator.sub behave differently int(x, [base]) ? it implementation detail. python c api retrieve arguments separates between positional , keyword arguments. positional arguments not have name internally. the code used retrieve arguments of operator.add functions (and similar ones sub ) this: pyarg_unpacktuple(a,#op,2,2,&a1,&a2) as can see, not contain argument name. whole code related operator.add is: #define spam2(op,aop) static pyobject *op(pyobject *s, pyobject *a) { \ pyobject *a1, *a2; \ if(! pyarg_unpacktuple(a,#op,2,2,&a1,&a2)) return null; \ return aop(a1,a2); } spam2(op_add ...

iphone - How to stock NSString in Core Data? -

Image
i have model follows this: then want stock city uitableview . problem is, want hold them in iphone (database) until reach 10, after erases first , adds last. have idea, can't reach add , i'm confused. when click city, pushes next view sending response json id , name of city.. thats ok. want store in order make same call uitableview (under it) it's "last cities searched" lik that. i want save id,name , after load in other tableview showing name. i'm ok, can't reach make stock happend. code: -(void)tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath { detailtaxi *detailview = [[detailtaxi alloc] initwithnibname:nil bundle:[nsbundle mainbundle]]; nsstring *nomville = [[_jsondict objectatindex:indexpath.row] objectforkey:@"label"]; nsstring *idville = [[_jsondict objectatindex:indexpath.row] objectforkey:@"id"]; detailview.title = nomville; detailview.idville = idville; nslog(@"va...

c++ file parser slow compared to c# -

i need write file parser in c++. here's code : std::string line; vector<string> slice; while(getline(m_inputstream, line)) { } my file big, loop takes 12 seconds. my c# code : streamreader sr = new streamreader(filename); string strline = ""; while (!sr.endofstream) { strline = sr.readline(); } and takes 0.6 seconds... doing wrong in c++? firstly, doing slice ? chances c# version reading string discarding - , c# jit optimising no-op, 0.6 seconds takes initialise , quit. c++ version generate code read string processing input file. make sure c++ 1 built release settings if you're going compare performance, debug code meaningless perf. do string , you'll see different performance figures, , check memory usage in both systems, c# 1 use lot more ram until gc kicks in.

parsing - How to return numbers in a string file (txt)? -

i want parse txt file information. want is, find numbers in string mean want sub return first number (as many digits number ) after second 1 , third 1 etc. possible? $string = preg_replace('/\d/', ' ', $string); $numberarray = explode(' ',$string);

c# - detecting in form1 that form2 is closed -

i trying detect form2 closed in form1. have far private void addstagebtn_click(object sender, eventargs e) { form2 form2 = new form2(); form2.showdialog(); if (form2.isdisposed) { messagebox.show("it closed!"); } } any suggestions? again! adhere formclosed event of form2. wherever create do: form2.formclosed += new formclosedeventhandler(form2_formclosed); then create method: void form2_formclosed(object sender, formclosedeventargs e) { // whatever want here } you'll want use .show() instead of .showdialog() if want able use either form, otherwise form1 unavailable until form2 closed (which assuming not behavior looking for).

graphviz - Enforcing horizontal node ordering in a .dot tree -

Image
i trying recreate example diagram binary search tree graphviz. how should in end: this first attempt: digraph g { nodesep=0.3; ranksep=0.2; margin=0.1; node [shape=circle]; edge [arrowsize=0.8]; 6 -> 4; 6 -> 11; 4 -> 2; 4 -> 5; 2 -> 1; 2 -> 3; 11 -> 8; 11 -> 14; 8 -> 7; 8 -> 10; 10 -> 9; 14 -> 13; 14 -> 16; 13 -> 12; 16 -> 15; 16 -> 17; } but unfortunately graphviz doesn't care horizontal positions of tree, get: how can add constraints horizontal positions of vertices reflects total ordering? you follow usual approach of adding invisible nodes , invisible edges, , playing edge weight etc. proposed on graphviz faq balanced trees . in simple cases , enough. but there better solution: graphviz comes tool called gvpr ( graph pattern scanning , processing language ) allows to copy input graphs output, possibly transforming s...

php - how to automatically put title in url -

how site put title of question dynamically url bar. is through rewritemapping , mod rewrite , how can on normal web host. thanks in url: https://stackoverflow.com/questions/10903041/how-to-automatically-put-title-in-url the part matters question id, 10903041 . set redirection rule ignores @ end of url, this: rewriterule /questions/(\d+) question.php?id=$1 the php script can redirect correct title if title not provided or incorrect; happens when visit https://stackoverflow.com/questions/10903041/why-is-this-question-title-so-wrong? .

css - trouble styling p class -

i'm having trouble styling <p class="wp-caption-text"> . i've tried .detail p.wp-caption-text , .detail .wp-caption-text , .wp-caption-text , , on. nothing seems work. missing? index.php <?php get_header(); ?> <!-- #content --> <div id="content"> <!-- start of .post --> <?php if (have_posts()) : while (have_posts()) : the_post(); ?> <div class="post<?php if(!has_post_thumbnail()) echo " no-featured"; ?>"> <?php if(has_post_thumbnail()): ?> <div class="featured"> <a href="<?php the_permalink(); ?>"><?php the_post_thumbnail(array(700,9999)); ?></a> <div class="credit"></div> </div> <?php endif; ?> <div class="detail"> <h2><a href="<?php the_permalink(); ?>"><?php th...

c# - ASP.NET Implementing "Act As" functionality when using Windows Authentication and Custom Role Provider -

i'm trying implement "act as" functionality asp.net application while @ same time using windows authentication , custom role provider. want able is: use windows auth current user's domain account verify approved domain user use custom role provider permission information sql server database. implement functionality allow admins of application able "act as" user, without requiring them log application user. the scenario i'm trying fulfill application admin attempting assist user problem , clicks "act as" button act user , see application see it. role provider need understand current user acting else , permissions information user instead of current user. my plan implement impersonation feature delete roles cookie , add value session variable indicating user impersonating user. session not populated @ time authorization occurs however, isn't possible. don't want use cookies don't want cause potentially persistent sta...

css - Div not stacked on top of other elements -

i having issues getting image background of ftrbottombanner div on top of black , green areas on page. have tried z-index of div @ 999, , adding overflow property parent divs no luck. know simple, can not find missing. the image below trying achieve. positioning orange banner inside of div on top of black , overlapping black , green area. sample image: http://www.woodsequipment.com/uploadedimages/layering_question.png the black , green bands individual divs positioned relative , there container div centered on black area contain menu , orange banner. what trying have orange banner overlap green area. here css: /**** footer ****/ div#footer{position:relative; width:100%; bottom:0; border:1px solid blue;} div#footerblackribbon{position:relative; height:51px; width:100%; background-color:#000000;border:1px solid white;} div#bottommenucontainer{position: relative; top: 0px; left:0px; height:50px; width: 950px; margin: 0 auto; border:1px solid red; } div#...

c# - Visual Studio 2008 add-in cannot load external text file -

i'm working on simple add-in supposed insert copyright statement source file. works fine copyright text live in text file. text file being deployed same folder dll , .addin file. but since add-in installed in different folders on different machines problem have not been able figure out how path text file programatically add-in code (c#). i've tried kinds of reflection methods non have worked far. if not possible or not right approach please let me know alternatives have besides hardcoding copyright text? thanks! if text file in same folder dll, think related question should you: how path of assembly code in?

c# - I can't display my array that I have populated through form1Load. Will run without errors but wont run -

public partial class form1 : form { datetime[] birth = new datetime[20]; person[] people = new person[20]; public form1() { initializecomponent(); } private void form1_load(object sender, eventargs e) { // create class person following fields _firstname, _lastname, _birthdate(datetime type) add constructor, properties (get only) , method getage returns age (int) of person. // in form1, create array of person objects hold 20 people // in form1_load: populate array 20 person objects // add gui display people in list (first , last names, birthdate, , age // add gui //people[0] = new person("john","stockton", datetime.) string[] first = new string[20] { "scott", "ramona", "todd", "melissa", "naomi", "leland", "conor", "julie", "armondo", "leah", ...

java - compiling ant build and running jar -

hi i'm trying create ant build can run command prompt. when run jar file containing main method this: exception in thread "main" java.lang.noclassdeffounderror: com/fmd/raptorurls/raptorurls caused by: java.lang.classnotfoundexception: com.fmd.raptorurls.raptorurls @ java.net.urlclassloader$1.run(unknown source) @ java.security.accesscontroller.doprivileged(native method) @ java.net.urlclassloader.findclass(unknown source) @ java.lang.classloader.loadclass(unknown source) @ sun.misc.launcher$appclassloader.loadclass(unknown source) @ java.lang.classloader.loadclass(unknown source) @ java.lang.classloader.loadclassinternal(unknown source) not find main class: com.fmd.raptorurls.raptorurls. program exit. here ant build: <?xml version="1.0"?> <project name="raptorurlcheck" basedir="." default="cleandistfiles"> <...

iphone - sqlite3 and fmdb nested FMResultSet is possible? -

i'm trying iterator through master detail sort of tables , i'd populate master/detail structures go. apparently when nest result sets bad access exception: fmdatabase *db = self.database; [db open]; db.traceexecution = yes; db.logserrors = yes; fmresultset *rs = [db executequery:@"select group_id, label main.preference_group order group_id"]; while ([rs next]) { preferencegroup *pg = [[preferencegroup alloc] init]; pg.group_id = [rs intforcolumn:@"group_id"]; pg.label = [rs stringforcolumn:@"label"]; pg.translatedlabel = nslocalizedstring(pg.label, nil); nsmutablearray * prefs = [[nsmutablearray alloc] init]; [prefgroups addobject:prefs]; fmresultset *rs2 = [db executequery:@"select pref_id, label, value main.preference group_id = ? order pref_id", pg.group_id, nil]; while ([rs2 next]) { preference * pref = [[preference alloc] init]; pref.group_id = pg.group_id; ...

Javascript animation is not running -

i'm trying create animated menu slides , down. unfortunately it's not working. i've checked error console , there no syntax errors. here's javascript: function showlayer() { var hiddenlayer = document.getelementbyid("mainmenu"); var layerposition = parseint(hiddenlayer.style.bottom); if (layerposition > 700) { hiddenlayer.style.bottom = (layerposition + 5) + "px"; settimeout("showlayer()", 20); } } function hidelayer() { var hiddenlayer = document.getelementbyid("mainmenu"); hiddenlayer.style.bottom = "700px"; } here's whole context: <script type="text/javascript"> function showlayer() { var hiddenlayer = document.getelementbyid("mainmenu"); var layerposition = parseint(hiddenlayer.style.bottom); if (layerposition > 700) { hiddenlayer.style.bottom = (layerposition + 5) + "px"; settimeout("showlayer()", 20); } } func...

java ee 6 - MyBatis integration with JBoss 7.1 web application -

had attempted use mybatis persistence library jboss 7.1 /java ee6 application? i'm wondering best approaches handling connections, transations, rollbacks etc? how cdi support? looking around online seems @ time mybatis supports 2 dependency injection (jsr-330) frameworks, google guice , spring. did run cdi extensions may into. my idea have container handle of above may difficult getting point. any tips, hints, experiences? there new mybatis-cdi module. not released yet, can try snapshot, @ github: https://github.com/mybatis/cdi

CDMI based storage cloud. Interoperability? -

i doing project on cdmi based storage cloud. can explain, "interoperability" mean in context? interoperability nothing ability work each other. cloud storage has multiple types of cloud data storage interfaces able support both legacy , new applications.to work these interfaces, existing standard protocols such iscsi (and others) block , cifs/nfs or webdav file network storage etc. used.

powershell - Signtool allows me to sign code but Set-AuthenticodeSignature says the "certificate is not suitable for code signing" -

i have self signed code signing certificate (made directions this answer ) , works fine when when use signtool.exe . if try sign using powershell, fails. signing signtool c:\>signtool sign /v /n "vetweb" setuprdppermissions.ps1 following certificate selected: issued to: vetweb issued by: vetweb ca expires: sat dec 31 18:59:59 2039 sha1 hash: 84136ebf8d2603c2cd6668c955f920c6c6482ee4 done adding additional store signed: setuprdppermissions.ps1 number of files signed: 1 number of warnings: 0 signing in powershell ps c:\> $cert = @(get-childitem cert:\currentuser\my | where-object -filterscript {$_.subject -eq 'cn=vetweb'})[0] ps c:\> set-authenticodesignature setuprdppermissions.ps1 $cert set-authenticodesignature : cannot sign code. specified certificate not suitable code signing. @ line:1 char:26 + set-authenticodesignature <<<< setuprdppermissions.ps1 $cert + categoryinfo : invalidargument: (:) [set-...

c# - required fields and asp.net -

im working on .aspx page in visual studio. i want have text box followed drop down menu. if user enters input in text box id , drop down menu both required before corresponding button can clicked. is best way use requiredfieldvalidator ? i think attempt conditional validation question similar question conditional validation asp.net

php pass parameter issue -

this code: <?php $lijstdoelmannen = mysql_query("select * speler positie = 'doelman' order familienaam, voornaam"); $teller = 1; while($rij = mysql_fetch_array($lijstdoelmannen)) { if($teller < 5){ echo "<td><a href='spelerdetail.php?spelerid='" . $rij['id'] . "><img src='images/spelers/unknown.png' alt='' width='50' /> <br /><br />" . $rij["id"] . " " . $rij['familienaam'] . " " . $rij['voornaam'] . "</a></td>"; } } ?> the problem in hyperlink parameter spelerid = spaces (not filled in). if echo $rij["id"] , gives me right value. you have ' in wrong spot in href . "...<a href='spelerdetail.php?spelerid='" . $rij['id'] . ">..." this should be: "...<a href='spelerdetail.php?spelerid=...

java - Set Object's attributes on its creation -

i see code this: new myjframe().setvisible(true); i don't know how works, creates myjframe , sets visible, alternative setting visible on constructor. what know if there way on jmenuitem or jbutton automatically assign actionlistener without having explicitly declaring first, in: myjmenu.add(new jmenuitem("item").addactionlistener(myactionlistener)); which, far i've tried, doesn't work. i don't need work, know if possible, save me time. thanks in advance. it's called method chaining , put, class either supports or not, depending on how it's written. the way done simple: public class bar { private set<foo> foos; public bar addfoo( foo foo ) { this.foos.add( foo ); return this; } } from can see why isn't possible chain methods weren't written way.

spotify - libspotify API: Any simple way to get artist URI by a given artist name? -

to artist uri given artist name, way think of search artist:$artistname ; compare input $artistname artist name search results. if 2. matches, artist uri. is there simpler way artist uri? thanks. in word: no. api doesn't work way i'm afraid.

jsf - selectonemenu options far from the menu box itself -

i using primefaces 3.2 , running app on tomcat 7.0. have pretty big form , couple of <p:selectonemenu> boxes @ bottom of form. when click on box, options appear @ top of form, have scroll top select option. there way keep options close menu box?

Converting string to date in mongodb -

is there way convert string date using custom format using mongodb shell i trying convert "21/may/2012:16:35:33 -0400" date, is there way pass dateformatter or date.parse(...) or isodate(....) method? you can use javascript in second link provided ravi khakhkhar or going have perform string manipulation convert orginal string (as of special characters in original format aren't being recognised valid delimeters) once that, can use "new" training:primary> date() fri jun 08 2012 13:53:03 gmt+0100 (ist) training:primary> new date() isodate("2012-06-08t12:53:06.831z") training:primary> var start = new date("21/may/2012:16:35:33 -0400") => doesn't work training:primary> start isodate("0nan-nan-nantnan:nan:nanz") training:primary> var start = new date("21 may 2012:16:35:33 -0400") => doesn't work training:primary> start isodate("0nan-nan-nantnan:nan:n...

JS load order with jQuery on load inside a function that executes immediately -

can this? var myfunction = function(){ $(function(){ // jquery code here $("#myfield").hide(); }) }(); i had code worked fine everywhere discovered worked 80% of time in ff 9.0.1. fix this: var myfunction = function(){ $(function(){ // jquery code here $("#myfield").hide(); }) }; myfunction(); now i'm bit puzzled why necessary edit: can see bit confusing. maybe should have done have been instead: var myfunction = function(){ // jquery code here $("#myfield").hide(); }; $(function(){ myfunction(); }); the problem not correctly defining function , putting jquery code, when javascript parser reads code ignore var definition , execute jquery defined on document ready. in case don't know: $(function(){}) // equivalent $(document).ready(function(){}). the best option create function like: function myfunction(){ $("#myfield...

jQuery gets wrong html() for span after a p tag -

<html> <head> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" type="text/javascript"/></script> <script> $(function() { alert($('#s1').html()); }); </script> </head> <body> <p/> <span id="s1"><h3>eggs</h3>one dozen please</span> </body> </html> this page puts blank alert <p> tag, <br> shows '<h3>eggs</h3>one dozen please', i'd expected. this appears case firefox 12.0 , chrome 19.0. ie8 gets right. ideas might happening? the / has no meaning, @ least not in html5. have: <p> <span id="s1"><h3>eggs</h3>one dozen please</span> since <p> cannot contain <h3> , browser tries make @ least sense out of interpreting as: <p> <span id="s1"></span> </p> <h3>eggs</h3>one doze...

jquery plugin - calling methods -

so building first plugin jquery have init method init: function(options, elem) { var self = this; this calls couple of methods this.slide(elem); this.lightbox(elem); however in lightbox method try , call custom method setpositon using self.setposition(); //error object [object window] has no method 'setposition' or this.setposition() // object # has no method 'setposition' how refer object created? var myobj = { init: function(){ var self = this; this.alert(); myobj.alert(); self.alert(); }, alert: function(){ alert('im called!'); } }; myobj.init();​ see on jsfiddle .

Android Java How to connect IP camera inside activity -

i looking tip or guidance develop application cam viewer. see live videos on android application using ip address , port. i searched question not find proper answer anywhere please me in regard. need create android application feature. i've looked little, , think apps written camera model. there doesn't seem standard ip cams. i have adapter each camera model. investigate specific model find url video looking @ web page created camera's web server.

How to do String Display Limitation in C#? -

today have learned 2 things 1 - displaying int format : 0001 in text box number.tostring("0000."); 2 - displaying double format : £ 03.00 in text box price.tostring("£ 00.00"); my questions is: how display limitation of string in c#? i mean value in string is string mystring = "hello world!" i display 20 letters display "hello world! " and if more 20 letters skip displaying rest example: string mystring = "i love every thing :*" it display following: "i love every thing y" 20 letters maximum display (counting spaces).. any idea? you need use substring or padright int length = 20; string original = "i love every thing :*"; string finalstring = original.length > length ? original.substring(0, length) : original.padright(length); this take appropriate length substring, or pad spaces, needed.

PHP Downloading a Huge Movie File (500 MB) with cURL -

okay, have problem hope can me fix. i running server stores video files large, 650 mb. need user able request page , have download file machine. have tried everything, plain readfile() request hangs 90 seconds before quitting , gives me "no data received error 324 code," chunked readfile script have found several websites doesn't start download, ftp through php solutions did nothing give me errors when tried file, , curl solutions have found create file on server. not need. to clear i need user able download file their computer , not server. i don't know if code garbage or if needs tweak or two, appreciated! <?php $fn = $_get["fn"]; echo $fn."<br/>"; $url = $fn; $path = "dl".$fn; $fp = fopen($path, 'w'); $ch = curl_init($url); curl_setopt($ch, curlopt_file, $fp); $data = curl_exec($ch); curl_close($ch); fclose($fp); ?> i wouldn't recommend serving large binary files using php or oth...

Communication between two android devices -

is possible 2 android devices communicate without using carrier services you can communicate on http. lars vogel has great tutorial on it: http://www.vogella.com/articles/androidnetworking/article.html also can think using rest in combination this.

parameters - sqlalchemy execute sql with TOP parametrized -

i want use limit in mssql, top, parametrized. hoped can top parametrized that: engine.execute( text("select top :t * orders), t=100) but get: statement(s) not prepared. (8180) (sqlexecdirectw)') 'select top ? * orders' (100,) with top fixed or out works fine. any ideas? as indicated in answer , assuming using @ least sql server 2005, should able run: engine.execute(text('select top (:t) * orders'), t=100) sql server should accept parameter long it's enclosed in parentheses.

ruby - Rails: Ajax-enabled form without a model object -

i'm new rails , having hard time figuring out how create form submits on ajax without having corresponding model object. my use case simple form collects email address , sends email; there's nothing persisted, no model. in cases do have model, i've had success form_for(@model, remote: true) . can't seem find right helper case there no model. tried form_tag(named_path, remote: true) , works, not use ajax. pointers example example proper controller, .html.erb , routes.rb appreciated. here's how solved it. key using form_tag , specifying hash argument matched route. business logic, need pass in "id" param, used in controller logic. <%= form_tag(sendmail_path({ id: 1}), remote: true) %> <%= text_field_tag :email, params[:email] %> <%= submit_tag "send", remote:true %> <% end %> routes.rb : myapp::application.routes.draw post '/sendmail/:id(.:format)' => 'mycontroller#sendmail...

XML and XSLT apply-templates select -

here's xml file: <?xml version="1.0"?> <?xml-stylesheet type="text/xsl" href="2.xsl" ?> <root> <shop> <person> <employee> <name> alexis </name> <role> manager </role> <task> sales </task> </employee> <employee> <name> employee2 </name> </employee> </person> <employee> <name> blake2 </name> </employee> </shop> <person> <employee2> <role2> supervisor </role2> <name2> blake </name2> <task2> control </task2> </employee2> </person> </root> here's xslt file: <?xml version="1.0"?> <xsl:st...

inheritance - Can a structure inherit from a class in .NET? -

i confused inheritance in .net , here why. i of understanding structure cannot inherit class in .net, example, following won't compile: struct mystruct : myclass { } but today read integers (and other value types) structs , not objects , inherit valuetype class. valuetype class inherits system.object , purpose override methods in system.object make these methods suitable value types. so what's deal? can structure inherit class in .net, can not or can in circumstances? thanks within guts of .net, definition struct containing members same definition class same fields , members, , inherits system.valuetype . note compilers not allow 1 declare class inherits valuetype , when 1 declares struct , compiler, "behind scenes" declares class does. what makes value types special in .net way run-time allocates storage locations (variables, fields, parameters, etc.) when storage location of type not inheriting valuetype declared, runtime allocate sp...

c++ - integer comparison incorrect or not comparing -

i have array such: int array[] = { 1,3,2,5,4,7,6,9,8,10 }; when try step through array , compare numbers none of them trigger if condition thereby triggering swap: for( int i=0; i<9; i++) { if (array[i] > array[i++]) { cout << "swapping" << array[i] << " " << array[i++]<< endl; int temp = 0; temp = array[i]; array[i] = array[i++]; array[i++] = temp; temp = 0; } } is there detail of comparing integers missing? treated differently because in array? i++ means "return i , set i = + 1 ". each time you're using i++ increasing i 1 ruins loop. use i+1 instead.

c# - read-loop from TCP/IP -

i need connect server (with ip , port) , create read-loop messages server xml. there no messages server. i tried create connection (works fine) , read messages, first message server , when i'm trying read 1 - stuck. think maybe there no messages right need loop continue until there messages... doesn't go "catch" or "finally", nothing.. public class connection { public connection() { socket server = null; try { string p = string.empty; using (var client = new tcpclient(myipaddress, myport)) using (var stream = client.getstream()) using (var reader = new streamreader(stream)) { while (p != null) { try { p = reader.readline(); } catch (exception e) { // } ...

Pure c++ app for Android and its performance -

can write pure c++ app android? (for example, using ndk?) considering there's no difference of functionality, pure android c++ app faster , consumes lesser memory android java app? in guess, guess yes because c++ app won't garbage collection causes frame rate hiccup. yes , yes, althrough google says: "using native code not result in automatic performance increase, increases application complexity... if write native code, applications still packaged .apk file , still run inside of virtual machine on device. fundamental android application model not change." from http://developer.android.com/sdk/ndk/index.html (personally, don't agree writing in c++ automatically makes more complex program java, i'd it's other way around skilled c++ programmer)

java - twain scanner partially scan -

i use twain 2.1 connecting scanner. how can set scanner scan part of page without displaying preview page of scanner. used source.setregionofinterest method, doesn't finish scanning , scanner can not used until restarted. the area of image acquired rectangle called frame. there may 1 or more frames located on page. tw_frame structure specifies values left, right, top, , bottom of frame acquired.

android - Webconnex Ticket Details API -

i want develop app this. there api this? http://ipclineapro.com/ticketscan/ the ticketscan app made webconnex platform (i.e buys tickets on webconnex). isn't intended other platforms, why provides ticket number. we not, of yet, have android app. when first created ticketscan supported linea pro (ipod accessory, iphone), later added support qrcodes camera. if wanting make android app works our platform, have internal rest based service app uses. service isn't documented, , don't intend release publicly in current form, partly because may changed in near future. currently working on revamp of our platform, have slew of api's available.

Rails 3.1 app can't connect with config.cache_classes = true -

i'm having odd issue in rails 3.1 app app starts without error, can't connect when have config.cache_classes = true . i have existing app upgrading 3.0.10 3.1.5, although i'm not 100% convinced what's causing issue. did make few other changes gems before deploying, shouldn't have done, working fine in dev, wasn't concerned. i've narrowed issue down cache_classes, after being confused day. issue there 0 errors, don't know go this. edit 1 hint well. when try kill rails server cntrl-c gives "sinatra has ended set" thing, restarts itself. can kill kill -9. it's fine config.cache_class = false . here gem listing... gems included bundle: * redcloth (4.2.9) * actionmailer (3.1.5) * actionpack (3.1.5) * activemodel (3.1.5) * activerecord (3.1.5) * activerecord-import (0.2.9) * activeresource (3.1.5) * activesupport (3.1.5) * acts_as_reportable (1.1.1) * addressable (2.2.6) * ancestry (1.2.4) * arel (2.2.3) * aws-sdk (1.3.8) * b...

c# - Error: Unable to evaluate expression because the code is optimized -

i getting error in asp.net app reads "unable evaluate expression because code optimized or native frame on top of call stack." protected void btncustomerprofile_click(object sender, eventargs e) { try { server.transfer("customerprofile.aspx"); } catch (exception ex) { response.write(ex.tostring()); } { } } after searching so, see of similar posts involve response.redirect. code using server.transfer , application using master pages. how can resolve issue? update: reason, error occurs use response.redirect well. unfortunately cannot use server.execute, because server.execute calls calling page towards end. you error, code block below trap , can on life. try this: using system.threading.threadabortexception; catch(threadabortexception ex) { throw; }

Need help in jquery to rectify image caption fade -

Image
http://www.umairdesigner.com/emagics/ hi, i'm working on site i've developed image caption fadeout , img zoom when mouse on , opposite if mouse leave tha image area. notice when hover on image in (meet team, under about-us section) first image effect likewise. suggestion great appreciable. here code; figure.mouseenter(function() { $(this).find('figcaption').fadeout('fast'); $(this).find('img').animate({top:'-20', left: '-20', width: '224', height: '270'}); }); figure.mouseleave(function() { $(this).find('figcaption').fadein('fast'); $(this).find('img').animate({top:'0', left: '0', width: '193', height: '233'}); }); here team section always provide jsfiddle rather providing website url .. always <div id="ibox"></div> change different id's different boxes. you can give class = ibox or id="ibox...

modify jquery nivo zoom plugin to achieve a new behavior -

thanks reading. trying modify jquery nivo zoom plugin make close previous clicked images. you can see current behavior here: http://nivozoom.dev7studios.com/ now plugin open large image when clicking on thumbnail keeping previous clicked opened. said i'd modify close previous clicked images. looking code think should add in part of code, here: function dozoom(img, link, nivozoomhover){ var imglarge = $('img.nivolarge', link); if(link.hasclass('zoomed')){ //hide overlay if(settings.overlay) $('#nivooverlay').fadeout(settings.speed/2); //hide caption if($('.nivocaption', link).length > 0){ $('.nivocaption', link).fadeout(settings.speed/2); } //hide image imglarge.fadeout(settings.speed/2, function(){ img.animate({ opacity:1 }, settings.speed/2); ...

android - NumberPicker in AlertDialog always activates keyboard. How to disable this? -

to all, i trying simple numberpicker work in alertdialog. problem whenever increase/decrease value in numberpicker, keyboard activates. there many posts describing problem, none of suggestions work. have tried: android:configchanges="keyboard|keyboardhidden" and inputmanager.hidesoftinputfromwindow(currentview.getwindowtoken(), 0); and getwindow().setsoftinputmode( windowmanager.layoutparams.soft_input_state_always_hidden); i have tried calling these functions before , after initialization (dialog.show ()), on keypress events (using listeners obviously), etc. no luck far. the complete code: popup.xml <?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content" > <numberpicker android:layout_width="wrap_content" android:l...

Facebook login/logout buttons on Facebook App using PHP -

i created app on website uses facebook post photos facebook albums using php. i further enhance doing following: in order use app - login/logout (i think can done not know how) in order visitors use app have have pressed 'like' on page use app. thank you. here's link php sdk: https://github.com/facebook/php-sdk here's link basic example: https://github.com/facebook/php-sdk/blob/master/examples/example.php and here's link facebook sdk documentation: http://developers.facebook.com/docs/reference/php/ you can use basic example - login , logout , upgrade sute needs. in 2 words: has login , logout url, data stored in sessions. have use open graph check if user has liked page.

Jquery split function not working on setting numeric option value -

i trying use jquery split function set option value not working. must missing simple (new programming!). $("#product").on('change keyup', function() { var value = $('option:selected', this).text(); $("#small").val(value.split('-')[1]); $("#medium").val(value.split('-')[2]); $("#large").val(value.split('-')[3]); }).keyup();​ <select id="product"> <option value="ronald mcdonald-100-200-300">ronald</option> <option value="the hamburglar-150-250-350">ronald</option> </select> <select> <option value="0" id="small">small</option> <option value="0" id="medium">medium</option> <option value="0" id="large">large</option> </select> ​also on jsfiddle viewing pleasure: demo var value = $('option:selected...

java - Should I chain GUI tests or start the applet anew every time? -

in open source project jchempaint , example, gui tested (using fest framework) collecting dozen individual tests each few java files. applet started once per file, , several independent tests performed in chain. i know if practice. of course, starting each time cost time. can see problems side effects of previous actions , possible exceptions, i'm no expert. so, practice put several tests 1 applet start? (i'm looking collection of best practices gui testing can't pose such question, hints welcome nevertheless.) i'm troubled awkward division between these 2 top-level containers : org.openscience.jchempaint.application.jchempaint org.openscience.jchempaint.applet.jchempaintabstractapplet . after cursory reading, reluctant critical; re-factoring contents might limit amount of duplicate testing required. in simplified example , common initialization confined initcontainer() method. comparison, jchempaint considerably more complex , offers number of a...

jquery - How to add escape key functionality to close light box? -

i created lightbox using following script: <script type="text/javascript"> $(document).ready(function(){ $(".btnaction").click(function(){ var objpopup = $($(this).attr("rel")); var mask = $("<div/>", { id : "mask", style: "background:#000; display:block;top:0;left:0;position:absolute;opacity:0.8;filter: alpha(opacity=80);width:100%;height:100%;z-index:9998;", click: function(){ $(objpopup).hide(); $(this).remove(); } }); $(".popupwrap").before(mask); objpopup.show(); }); $(".closeicon").click(function(){ $(this).parent().hide(); $("#mask").remove(); ...

iphone - iOS5 - Create an App that communicates with other iOSs -

i start studing ios last week , before go further ask question. when learn how develop ios create app used in restaurant. waiters use ipods take orders per table. there ipad @ cashier same app receive orders per table. i don't want know how develop app question basic. how can safe orders? locally? , history of transactions(yearly, monthly, etc...), icloud? or other server? since local wifi network, without need of internet, application can send , receive information directly to/from server inside restaurant. ipad application can read server if there order , show it. ipods send orders server, can store in database (like sql server express, free) , ipad can stay reading there. 2 modes inside same application (send orders per table , receive orders). no need super server, , no need local storage on ipods , ipads since it's inside wifi local network. it's more simpler local storage , sync framework server or send data between idevices. with data stored in da...

php - Get values of inputs with same name -

ok, have task write simple php ticket system. can't work out how values input called ages my code looks , don't know go here <form id="form" action="<?php echo $_server['php_self']; ?>" method="post"> <fieldset> <label for="number">ticket count </label> <input type="number" name="number" /> <input id="submit" type="submit" value="set ages" class="submit"/> <?php $numberoftickets = $_post['number']; for($i=1;$i <=$numberoftickets;$i++){ echo "<select class='ages' name='ages'>"; echo "<option value='adult'>18 år och uppåt</option>"; echo "<option value='youth'>13 – 18 år</option>...