Posts

Showing posts from January, 2015

silverlight 4.0 - WCF RIA Getting Large Data Faster -

silverlight 4.0 - WCF RIA Getting Large Data Faster - i have silverlight client(4.0) calling wcf ria service method returns big set of data.the method returns list customobject has around 20 fields. what noticed it's extremely slow when number of items in list 20,000. if set break point on homecoming statement in server , set 1 break point on client side, can see taking @ to the lowest degree 40 seconds, nail break point on client side 1 time returns list server.i wondering why taking much time bring info server client. is normal wcf ria services ? there way increment efficiency, thanks ! well, 20.000 records are... 20.000 records. lengthy download not uncommon issue in scenario this. might 2 things: page records. ask wcf compress data. not sure if possible silverlight not uses total wcf functionality. silverlight-4.0 wcf-ria-services

c++ - switch win32 console application to graphics mode -

c++ - switch win32 console application to graphics mode - i want switch win32 console application graphics mode utilize setpixel function draw lines: #include "stdafx.h" int _tmain(int argc, _tchar* argv[]) { //code switch graphics mode homecoming 0; } please advice :) here's fine setpixel() example. create win32 application project , paste code , compile it //header files include #include<windows.h> #include<stdlib.h> #include<time.h> //application title #define apptitle "hello world" //function prototypes (forward declarations) bool initinstance(hinstance, int); atom myregisterclass(hinstance); lresult callback winproc(hwnd, uint, wparam, lparam); //the window event callback function lresult callback winproc(hwnd hwnd, uint message, wparam wparam, lparam lparam) { paintstruct ps; hdc hdc; char *szhello = "setpixel"; rect rt; int x=0, y=0, n=0; colorref c; int ...

sha256 - Problems encoding Amazon Flexible Payments secret string in PHP -

sha256 - Problems encoding Amazon Flexible Payments secret string in PHP - i trying utilize amazon payment services, , require me this: here finish signature can see added signature method: $string_to_sign = "get\n authorize.payments-sandbox.amazon.com\n cobranded-ui/actions/start? signaturemethod=hmacsha256&signatureversion=2&callerkey=my_key&callerreference=yourcallerreference&paymentreason=donation&pipelinename=singleuse&returnurl=http%3a%2f%2fyourwebsite.com%2freturn.html&transactionamount=4.0"; and encrypt below. $encoded_string_to_sign = urlencode(base64_encode(hash_hmac("sha256", $string_to_sign, 'my_secret_key'))); i that, error them saying: caller input exception: next input(s) either invalid or absent:[signaturemethod] any thought might going wrong here? here entire code this: (the variables assigned values above) <?php $string_to_sign = 'get authorize.payments-sandbox.amazon.com/...

Passing values from ASP.NET to PHP -

Passing values from ASP.NET to PHP - is there anyway pass values asp.net php using session or other? tried in below way didn't work me. either right below code or suggest me way pass values asp.net php without using url query string. asp.net code. protected void button1_click(object sender, eventargs e) { httpcookie cookie = new httpcookie("myvalue1"); cookie.value = "joe@example.com"; response.redirect("default.php"); } php code. <?php session_start(); $_cookie['myvalue1']; $cookies = getcookies(); $sessionid = $cookies['myvalue1']; ?> there few ways this, none particularly sexy. post info asp.net using httpwebrequest php page, done server side. a cookie encrypted value. if php , .net both run on same server, save file system. a database server. asp.net supports multiple forms of persisting session state. state server , sql beingness 2 of them. i'm sure php co...

rest - Restlet client different responses using android -

rest - Restlet client different responses using android - i have code restful resource public string loadresourcestring() { reference ref = new reference("http://192.0.0.1:8080/op/op2"); clientresource resource = new clientresource(ref); form paramspost = new form(); paramspost.add("id", "abcd"); paramspost.add("code", "2"); representation representation = paramspost.getwebrepresentation(); representation.setcharacterset(characterset.utf_8); representation result = resource.post(representation); string sresult = ""; seek { sresult = result.gettext(); } grab (ioexception e) { homecoming ("ioexception "); } homecoming ("return \n" + sresult + "\n"); } i have code attached button , works ok lot of times result null. don't understand reason. anybody knowledge related restlet framework can help me? ...

Google Apps Calendar API Push Event Query -

Google Apps Calendar API Push Event Query - had hunt around reply google apps query can't find direct reply going flick 1 out community. the plan: have google apps domain business relationship , want create utilize of calendar api , create php web app pushes events calendars of users of google apps domain when triggered. question: possible force users? or read impossible accomplish without users beingness logged in etc , authorizing itself? i dont believe possible, wanted seek , set 'push all' feature while back, no luck. the best consolation maybe creating 1 shared user/calendar , sharing out across of accounts. new user, calendar title 'exampleeventsforgroup' shared tom, dick & mary, , add/modify events onto calendar, pushing out members. its workaround, us, works! rick google-calendar google-apps server-push web-api

php - Imagick missing but extension and module exists -

php - Imagick missing but extension and module exists - i'm getting next error: fatal error: class 'imagick' not found in pdfthumbnail.php on line 2 when running $im = new imagick($_get['pdf'].'[0]'); however if run $test = system('rpm - qa | grep imagemagick'); echo $test; i following: imagemagick-6.2.8.0-4.el5_5.3 imagemagick-devel-6.2.8.0-4.el5_5.3 imagemagick-devel-6.2.8.0-4.el5_5.3 imagemagick-6.2.8.0-4.el5_5.3 imagemagick-6.2.8.0-4.el5_5.3 inside phpinfo can't find section imagemagick module, within php.ini (the 1 listed within phpinfo(); , find: extension=imagick.so my extension path set extension_dir = "/usr/lib64/php/modules" , within folder get: dbase.so libmagickcore.so mysqli.so soap.so xsl.so dom.so libmagick++.so mysql.so sw-engine gd.so libmagickwand.so pdo_mysql.so _unused_imagick.so imagick.so libpdf_php.so pdo.so xmlr...

How to get Enterprise Manager installed in SQL Server 2008 Express? -

How to get Enterprise Manager installed in SQL Server 2008 Express? - i've installed microsoft sql server 2008 express twice now, , services work , can create databases visual studio 2010, don't have enterprise manager (i learned called management studio) available in sql server 2008 programme menu-- have other menu items configuration manager, etc. nil management studio / enterprise manager. is there checkbox i've missed during installation? ran search exes in sql server root folder , nil jumped out belonging enterprise manager, i'm not 100% sure executable named. primary question:     procedure required install management studio client [for/with sql 2008 express] ? secondary question:     name of client's executable file ? sql server express doesn't come sql server management studio (what looking when enterprise manager). have download separately: http://www.microsoft.com/download/en/details.aspx?id=7593 or tools part of download http...

Append not working in jQuery -

Append not working in jQuery - i'm trying append tp-lightboxactitem tp-lightboxcontainer . can 1 help me thing. it's not working, want lightbox activeitem comes within tp-lightboxcontainer , tp-lightboxactitem comes in center of . $('body').append('<div id="tp-lightboxcontainer" class="'+opt.style+' lightboxitem"></div>'); var tp-lightboxcontainer=find('#tp-lightboxcontainer'); tp-lightboxcontainer.append('<div id="tp-lightboxactitem" class="'+opt.style+' lightboxitem"></div>'); $('<div id="tp-lightboxcontainer" class="'+opt.style+' lightboxitem"></div>') .appendto('body') .append('<div id="tp-lightboxactitem" class="'+opt.style+' lightboxitem"></div>'); you're working 1 object here, can in 1 line. jsfiddle make...

c++ - Does moving an element from an STL container remove it from that container? -

c++ - Does moving an element from an STL container remove it from that container? - i have foobar class sayhello() method outputs "well hello there!". if write next code vector<unique_ptr<foobar>> foolist; foolist.emplace_back(new foobar()); unique_ptr<foobar> myfoo = move(foolist[0]); unique_ptr<foobar> myfoo2 = move(foolist[0]); myfoo->sayhello(); myfoo2->sayhello(); cout << "vector size: " << foolist.size() << endl; the output is: well hello there! hello there! vector size: 1 i'm confused why works. shouldn't foolist[0] become null when first move? why myfoo2 work? here's foobar looks like: class foobar { public: foobar(void) {}; virtual ~foobar(void) {}; void sayhello() const { cout << "well hello there!" << endl; }; }; shouldn't foolist[0] become null when first move? yes. why myfoo2 work? it doesn...

xaml - How to populate WPF Label based on 2 or more WPF TextBoxes? -

xaml - How to populate WPF Label based on 2 or more WPF TextBoxes? - i have 3 wpf textboxes have segments of url. i want have segments merged see total url within wpf label. how can reach xaml? also want update label when user changes textboxes. thank you! use multibinding stringformat. you may want set updatesourcetrigger propertychanged fellow member bindings. create sure combined text gets updated user types text , not after leaves text box. wpf xaml

How to deallocate memory without using free() in c -

How to deallocate memory without using free() in c - int main(void) { int *a = malloc(10); homecoming 0; } how can free memory without using free() ? from manpage: the realloc() function changes size of memory block pointed ptr size bytes. contents unchanged in range start of part minimum of old , new sizes. if new size larger old size, added memory not initialized. if ptr null, phone call equivalent malloc(size), values of size; if size equal zero, , ptr not null, phone call equivalent free(ptr). unless ptr null, must have been returned before phone call malloc(), calloc() or realloc(). if area pointed moved, free(ptr) done. so, need phone call realloc() size 0. realloc(a, 0); c

How can I change the value of a variable while debugging Java code in NetBeans 7.1? -

How can I change the value of a variable while debugging Java code in NetBeans 7.1? - i have set breakpoint allows me see value in field on object. i'd alter value go on execution, seek edit value variables view, value field grayed-out. there way alter variable values while debugging? it possible alter value of primitive variables , strings in-place in value column of variables window. alter values of object variables, can utilize "evaluate expression..." under menu debug alternative (ctrl+f9). java debugging netbeans netbeans-7.1

java - The system has enough memory but "Could not reserve enough space for object heap" -

java - The system has enough memory but "Could not reserve enough space for object heap" - i tryiung start java process requires lot of memory. reason, not work if specify more 19g of ram process. free , top show have 23g of free memory, wonder why error occurs. total used free shared buffers cached mem: 24158 1047 23111 0 16 356 -/+ buffers/cache: 673 23485 swap: 2204 0 2204 starting process these jvm options: -xx:+useconcmarksweepgc -server -d64 -xms4g -xmx22g version: java version "1.7.0_02" java(tm) se runtime environment (build 1.7.0_02-b13) java hotspot(tm) 64-bit server vm (build 22.0-b10, mixed mode) however, if specify 19g xmx works. the java vm allocates memory heap permgen space. can configuration heap space + permgen space exceeds free memory? which value -xx:maxpermsize set to? java memory ram

java - JSON - deserialization of dynamic object using Gson -

java - JSON - deserialization of dynamic object using Gson - let's imagine have java class of type: public class myclass { public string par1; public object par2; } then have this: string json = "{"par1":"val1","par2":{"subpar1":"subval1"}}"; gson gson = new gsonbuilder.create(); myclass mclass = gson.fromjson(json, myclass.class); the par2 json given me other application , don't ever know it's parameter names, since dynamic. my question is, class type should par2 variable on myclass set to, json string variable correctly deserialized class object? thanks check out serializing , deserializing generic types gson user guide: public class myclass<t> { public string par1; public t par2; } to deserialize it: type footype = new typetoken<myclass<foo>>() {}.gettype(); gson.fromjson(json, footype); hope help. java json gson

java - How can a HashMap consist only of one entry/object? -

java - How can a HashMap consist only of one entry/object? - i have hashmap 1 key-value object. i have created next hashmap : hashmap <integer,string>docscollection = new hashmap <integer,string>(); in hashmap have 1 entry/object. key type integer. value type string. e.g. = <1,"foo.txt"> every time find specific word in file to increment counter in key add new file in value e.g. let's i'm searching word "hello" in docscollection , have store every appearance of word "hello" term frequency , concatenate new file previous value. <3,"foo.txt,hello.txt,test.txt"> 3 means i've found word "hello" in 3 files. and value consists of files word found if utilize method put, new entry created in hashmap cause key changes. it's not stable. begins "1" when find word sec time , key increments , set method inserts new entry new key have 1 entry , modify...

Download file from non public html folder with php -

Download file from non public html folder with php - i have number of files stored on server, not in public_html directory. thought users logged in can download files, using $_session variables check if logged in, if else uses computer can not see direct file path in browser history , if outside public html directory not accessible. i know need script this, can't find out how where, appreciated if tell me how this. you can utilize readfile output file in question. eg: $file = '/absolute/path/to/file.ext'; if (file_exists($file)) { header('content-description: file transfer'); header('content-type: application/octet-stream'); header('content-disposition: attachment; filename='.basename($file)); header('content-transfer-encoding: binary'); header('expires: 0'); header('cache-control: must-revalidate, post-check=0, pre-check=0'); header('pragma: public'); header('co...

How to build Java from WSDL that uses existing XSD types -

How to build Java from WSDL that uses existing XSD types - i'm trying create new web service uses existing types. types defined in existing xsd received, along matching jar file, 3rd party. if import xsd wsdl , build java (using wsconsume), existing types built. since have jar contains these java types, don't want generate them again. as fallback alternative can have ant delete these redundant files, i'd rather find way not generate them in first place. any suggestions? my suggestion utilize spring webservices should help such implementation, it: has principle of contract first contract rather xsd wsdl allows write @endpoint class methods annotated e.g. @payloadroot , using parameters of types jar you've got allows generate wsdl <sws:dynamic-wsdl /> if jar you've got has classes jaxb annotations can utilize jaxb directly, if not - can alway utilize other binding technologies. java xsd wsdl

android - can't use Arrays.copyOfRange -

android - can't use Arrays.copyOfRange - i don't seem able access arrays.copyofrange in android project in eclipse indigo 3.7.1 on ubuntu 11.10. my jre java-6-openjdk thought included arrays.copyofrange for example, if have code: int[] debug = new int[5]; int[] x = arrays.copyofrange(debug,0,4); eclipse tells me the method copyofrange(int[], int, int) undefined type arrays i don't understand because android reference arrays includes method arrays. any ideas? the method arrays.copyofrange() wasn't introduced until api level 9 . create sure using minimum sdk. also, indexing incorrectly. in java if have array of size 5 indices range 0->4 change code this: int[] debug = new int[5]; int[] x = arrays.copyofrange(debug,0,4); // utilize 4 instead of 5 android eclipse

c# - TcpClient read OutOfMemoryException -

c# - TcpClient read OutOfMemoryException - i have problem intermittent outofmemoryexception, on line buffer = new byte[metadatasize]; (under //read command's meta data.) does mean seek read finish message while part of has been received? in case, reliable way handle that? btw, need variable length messages, short, while occasional messages large. should attach finish message size in front end of message? still, how can know how much stream contains before trying read it? (as seems read fails when trying read specific length, do) public static command read(networkstream ns) { seek { //read command's type. byte[] buffer = new byte[4]; int readbytes = ns.read(buffer, 0, 4); if (readbytes == 0) homecoming null; commandtype cmdtype = (commandtype)(bitconverter.toint32(buffer, 0)); //read cmdid buffer ...

arrays - More cookie problems, php -

arrays - More cookie problems, php - i'm sorry maintain asking stupid questions, have tried research , couldn't find it. this time, want able check _post against array, before deciding it's ok set cookie. here's snippet. <?php header( 'location: http://www.site.com/ler.php' ) ; ?> <?php setcookie("choice1","true",time()+20); ?> <?php $match_id = strtoupper($_post["arr"]); //var_dump(implode($_post)); $barray = array( "a"=>"1", "b"=>"2", "c"=>"3", "d"=>"4", "etc"=>"5"); i need array , variable set before cookie, because want utilize array_key_exists conditional. tried switching order didn't anything. know it's not header because other code cookies , headers works fine. ideas?? not sure you're asking here, clear code you've presented not going work expect. y...

Grails Resources plugin, modules and to render images? -

Grails Resources plugin, modules and <r:img> to render images? - trying larn resources plugin from understanding, helps define 'resources' such css , javascript files , automatically pull them gsp's when needed. understand how create modules can loaded in using tags etc. the part im not understanding this: http://grails-plugins.github.com/grails-resources/guide/4.%20using%20resources.html#4.2%20linking%20to%20images so ive created module called 'images' in config.groovy follows: grails.resources.modules = { images { resource url:'/images/view.jpg', attrs:[width: 1280, height:720 , alt: 'my view'] resource url:'/images/breakfast.jpg', attrs:[width: 1280, height:720, alt: 'breakfast'] } } the resources included in .gsp page in head section follows: <head> <r:require modules="jquery-ui, blueprint"/> </head> i know resources have been added head section b...

android - How To Read Color Value? -

android - How To Read Color Value? - i want reading color android application. here have developed 1 application, in camera, reading color. want perform action while reading/catching reddish color in camera. please guide me regarding this. one of possible solutions that, can color of individual pixel of bitmap using, bitmap.getpixel(int x, int y) you should have image bitmap object , should specify x , y co-ordinates of pixel want color. bear in mind that, checking pixel-by-pixel time consuming , not effective method. android android-camera

java - Compile time constants and variables -

java - Compile time constants and variables - the java language documentation says "if primitive type or string defined constant , value known @ compile time, compiler replaces constant name everywhere in code value. called compile-time constant." so understanding if have piece of code: private final int x = 10; then, compiler replace every occurrence of 'x' in code literal '10'. suppose constant initialized value @ run-time, private final int x = getx(); // here getx() returns integer value @ run-time. will there performance drop (howsoever negligible) may compared compile-time constant? another question whether below line of code: private int y = 10; // here y not final is treated in same way compile time constant compiler? edit: finally, understand answers are: final static means compile time constant just final means constant initialized @ run-time just static means initialized @ run-time without final variable , wouldn...

ruby - Naming convention for syntactic sugar methods -

ruby - Naming convention for syntactic sugar methods - i'm build library generic reporting, excel(using spreadsheet), , of time i'll writing things out on lastly created worksheet (or active refer it). so i'm wondering if there's naming convention methods sugar normal/unsugared method. for instance saw blog post, scroll downwards composite, while ago author used #method sugared, , #method! when unsugared/manual. said normal way of doing things, or odd implementation? what i'm thinking of doing is: add_row(data) add_row!(sheet, data) this feels fit me, there consensus on how these kinds of methods should named? edit i'm aware ! used "dangerous" methods , ? query/boolean responses. why got curious whether usage in prawn (the blog post) said normal. i think it's fair definitions: add_row(data) add_row!(sheet, data) are going confuse ruby users. there number of naming conventions ruby community considered de-facto ...

android - R.java cannot be generated -

android - R.java cannot be generated - possible duplicate: no generated r.java file in project i trying run project of cyanogenmod / android_packages_apps_gallery i download project here: https://github.com/cyanogenmod/android_packages_apps_gallery unfortunately, cannot run in emulator. problem r.java cannot generated. have tried 'project -> clean' project , delete gen folder, doesn't work. any idea? thanks! look in of res files. if xml file points image, font, or other xml file doesn't exist, r not generated. running clean show error in 1 of xml files, not. java android r.java-file

javascript - How to assign to members of a function? -

javascript - How to assign to members of a function? - since functions first class objects, should possible assign members of them. am right thinking arguments.callee this? are there other ways set these fields? how possible set field in first case? function something1() { arguments.callee.field = 12; } alert(something1.field); // show undefined something1(); alert(something1.filed); // show 12 something2 = function() { arguments.callee.field = 12; }; alert(something2.field); // show undefined something2(); alert(something2.field); // show 12 update 1 i mean how access members within function when runs. you don't need utilize arguments.callee refer function has name; can utilize name. naturally case when declare function using the function name(...) { ... } syntax; in function expression, you're allowed supply temporary name: (function temp_name(...) { ... })(arg); so, if want set properties within function, can write: ...

osx - Why is VPN connection on Mac OS X causing Eclipse to lockup during 'edit launch config' operation? -

osx - Why is VPN connection on Mac OS X causing Eclipse to lockup during 'edit launch config' operation? - i have been using eclipse on mac os x home on vpn develop gwt , perl code in local workspace employer. repeatable , severe lockup began occurring whenever tried edit debug (or run) launch configurations. got spinning beachball of death (sbod) and, if waited long plenty (10-15 minutes) stop , @ to the lowest degree close dialog. i tried numerous things until coworker suggested trying vpn turned off. surprise (and delight) began behaving in above scenario. have been using eclipse in manner year no problems naturally racking brain trying think of recent changes vpn and/or split tunnel script (euphemistically called 'multihome') business relationship abnormal behavior. lockup occurs or without split tunnel. i should point out "initializing java tooling" progress status occurs when starting eclipse , takes min finish vpn connection. normal ...

sql server - sql replace all characters between two strings -

sql server - sql replace all characters between two strings - i trying figure out way update / replace text between 2 strings. for instance need able update field , replace what's in between next script tags leaving text before opening script tag untouched. i want maintain string<script type="text/javascript" language="javascript">********</script> i suppose replace not going work text in between script tags vary. there type of wildcard? update products_joined set techspecs = replace (cast(techspecs nvarchar(max)), '<script type="text/javascript" language="javascript">********</script>', '<script type="text/javascript" language="javascript">new text</script>' ) updated: @parkyprg reply works doesn't replace closing </script> tag. end this. i want maintain string new text</script> how remove closing script tag well? update...

Recursively convert all numeric strings to integers in a Ruby hash -

Recursively convert all numeric strings to integers in a Ruby hash - i have hash of random size, may have values "100" , convert integers. know can using value.to_i if value.to_i.to_s == value , i'm not sure how recursively in hash, considering value can either string, or array (of hashes or of strings), or hash. this pretty straightforward recursive implementation (though having handle both arrays , hashes adds little trickiness). def fixnumify obj if obj.respond_to? :to_i # if can cast fixnum, it. obj.to_i elsif obj.is_a? array # if it's array, utilize enumerable#map recursively phone call method # on each item. obj.map {|item| fixnumify item } elsif obj.is_a? hash # if it's hash, recursively phone call method on each value. obj.merge( obj ) {|k, val| fixnumify val } else # if reason run else, homecoming # unmodified; alternatively throw exception. obj end end and, hey, works: hsh = {...

Deploying ASP.NET MVC 3 Application Under ASP.NET 3.5 Web Site Sub Folder -

Deploying ASP.NET MVC 3 Application Under ASP.NET 3.5 Web Site Sub Folder - i have website in iis 7, asp.net 3.5 works well. have installed .net 4.0 on website server. now, have added virtual directory(yes, converted application) asp.net 4.0 apppool in website. when access virtual directory, get there duplicate 'system.web.extensions/scripting/scriptresourcehandler' section defined why virtual directory application trying utilize root website's web.config? as @bnl said quoting reply this site, step 1 (iis 7 or iis 7.5 only) this step necessary on operating systems run iis 7 or iis 7.5, includes windows vista, windows server 2008, windows 7, , windows server 2008 r2. move configsections definition in web.config file of parent application (the application runs asp.net 2.0 or asp.net 3.5) root web.config file the.net framework 2.0. iis 7 , iis 7.5 native configuration scheme scans configsections element when merges hierarchy of configuration files. ...

javascript - Generating haXe externs for EaselJS -

javascript - Generating haXe externs for EaselJS - being new both javascript , haxe, may have simple answer, i've discovered haxe has externs port on googlecode easeljs, out of date , correspond before version. i've been able prepare errors occur during compile time, i'm still wary didn't grab al new variables , function names. my question is: there simple way generate externs big js library easeljs? you might want take @ joshua granick's work buildjs: http://www.joshuagranick.com/blog/2011/10/14/use-buildjs-to-make-externs-for-haxe-js-automatically/ basically there's tool called jsduck supposed compile documentation javascript libraries, , can output json. he's used output json, combined "buildjs" library build haxe externs. he's used sencha touch, , i've used extjs, both of sencha products , coding style known work jsduck. can give go easeljs, if works buildjs should generate pretty accurate externs. otherwis...

mysql query based on length of string in a column -

mysql query based on length of string in a column - i trying query table in mysql based on length of string in specific column. know mysql has function called length(), returns length of string. want able pull info based on result of length() function. example: select * table length(word) = 6 of course of study not work. read through http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function%5flength not find help me. yes create in php accomplish this, @ query level. any help? try: select * table length(rtrim(word)) = 6 mysql

Steps to implement ANT through eclipse for creating Android Build -

Steps to implement ANT through eclipse for creating Android Build - i checked out many blogs creating ant build script android project. many suggested creating using command line , quite few explained creating using eclipse, solutions don't work me properly. can please help me specifying proper steps implement ant through eclipse creating android build script. there's no eclipse way of doing this, have utilize android update project / android create project . if elaborate parts of command line process failed help that. android ant

css - Can't convert Table layout to DIVs -

css - Can't convert Table layout to DIVs - i have simple form info input. labels inputs. labels localized, don't know how long text different languages be. problem solved table layout: <table> <tr> <td> <label for="text1">short</label> </td> <td> <input id="text1" type="text" /> </td> </tr> <tr> <td> <label for="text1">looooooooong</label> </td> <td> <input id="text2" type="text" /> </td> </tr> </table> no matter how long labels layout nice. many using table tag non tabular info not good. don't how solve problem divs. <div> <div style="float:left; width:50px;"><label for="text3">short</label></div> ...

java - javax.persistence Annotations on field, getter or setter? -

java - javax.persistence Annotations on field, getter or setter? - i learning hibernate , java persistence api. i have @entity class, , need apply annotations various fields. have included in code below 3 places go. should apply them field itself, getter or setter? , semantic difference, if any, between these 3 options. import javax.persistence.entity; import javax.persistence.table; import javax.persistence.id; @entity @table(name = "song") public class song { // annotations should applied 1 of below @id @column(name="id", unique=true, nullable=false) private int id; @id @column(name="id", unique=true, nullable=false) public int getid() { homecoming id; } @id @column(name="id", unique=true, nullable=false) public void setid(int id) { this.id = id; } } you have take between field , getter. annotations on setters not supported. , annotations should on fi...

introspection - Spring validation issue -

introspection - Spring validation issue - we facing issue in ibm rad ide environment (ibm jdk 1.6 runtime jre) while executing test case. same code running fine springsource ide (sun jdk 1.6 runtime jre). issue jdk or spring framework. brief code history : there java bean below class user { final map<integer,string> securityquestions = collections.synchronizedmap(new hashmap<integer,string>(max_security_questions)); final map<integer,string> securityanswers = collections.synchronizedmap(new hashmap<integer,string>(max_security_questions)); public map<integer,string> getsecurityanswers() { homecoming securityanswers; } public void setsecurityanswer(integer answernumber, string answertext) { securityanswers.put(answernumber, answertext); } } when trying validate 'securityanswers' using validationutils.rejectifemptyorwhitespace(errors, "securityanswer...

How do I check if an insert was successful with MySQLdb in Python? -

How do I check if an insert was successful with MySQLdb in Python? - i have code: cursor = conn.cursor() cursor.execute(("insert new_files (videos_id, filename, " "is_processing) values (%s,%s,1)"), (id, filename)) logging.warn("%d", cursor.rowcount) if (cursor.rowcount == 1): logging.info("inserted values %d, %s", id, filename) else: logging.warn("failed insert values %d, %s", id, filename) cursor.close() fun is, cursor.rowcount always one, though updated database create videos_id unique key. is, insert fails because in tests same videos_id going appear (and when check database, nil inserted). whatever reason, rowcount 1 - logging.warn have spits out rowcount of 1. so, question: can utilize rowcount work out if insert went fine? if so, (presumably) doing wrong? otherwise, how check if insert went fine? your code not commit after modifications (your modifications rolled back). should...

Is there a way to make Selenium Grid 2 DesiredCapabilities browser-agnostic? -

Is there a way to make Selenium Grid 2 DesiredCapabilities browser-agnostic? - i'm wondering if there's (preferably built-in) way selenium hubs inquire nodes have browser available. basically, want hub specify "browsername = 'any'", match on node running less instances maxinstances, allow node decide browser run on. the motivation behind want maximize number of tests running in parallel on given node without having multiple instances of 1 browser. don't care browser running given test. as reference, i'm using selenium server 2.17. ack, annoying. i'm sure there's command line parameter let's override specified browsername, can't find it. if memory not way off, parameter allow more or less asking - regardless of browsers node says has, , regardless of hub asks for, 1 particular browser started. note self: start proper list of command line options selenium, , perchance submit team inclusion in wiki. one way acc...

Redirect cout from C++ dll to a textbox in C# -

Redirect cout from C++ dll to a textbox in C# - i'm trying display console output (cout) of method in dll textbox in c# program. every time phone call method, console output displayed in output pane of visual studio. there way redirect content of output pane textbox? the dll written else in c++ , have no command in changing it. dll wrapped using swig can called c# code. after next link suggested david, decided write solution problem more specific case. version allows receive stdout in gui via backgroundworker propertychangedeventhandler phone call back. here's code consoleredirector: public class consoleredirector : idisposable { private static consoleredirector _instance; public static void attach(progresschangedeventhandler handler, bool forceconsoleredirection) { debug.assert(null == _instance); _instance = new consoleredirector(handler, forceconsoleredirection); } public static void detatch() { _ins...

Python Struct module behaves strange -

Python Struct module behaves strange - i'm using struct module, , things aren't going expected. due misunderstanding have module i'm sure. import struct s = struct.struct('q'); print s.size s = struct.struct('h l q'); print s.size s = struct.struct('h q'); print s.size s = struct.struct('h q h'); print s.size the output of is: 8 24 16 18 what missing here? why sec , 3rd different sizes, , why 4th not 16? alignment issue. assuming you're running on 64-bit non-windows platform: q , l 8-byte long, 4-byte, , h 2-byte. and these types must set on location multiple of size best efficiency. therefore, 2nd struct arranged as: hh______ llllllll qqqqqqqq the 3rd struct: hh__iiii qqqqqqqq and 4th struct: hh__iiii qqqqqqqq hh if don't want alignment, , require l have 4 byte (the "standard" size), you'll need utilize = or > or < format, described in http://docs.python.o...

asp.net 2.0 website deployment iis 6 -

asp.net 2.0 website deployment iis 6 - i have developed asp.net 2.0 website (using vs 2008). website uses sqlmembershipprovider , authentication mode = "forms" . when deploy site on iis 6 (windows server 2003 r2) , seek browse .aspx files gives "the webpage cannot found http 404" and when browse .html file in same directory gives "you not authorized view page not have permission view directory or page using credentials supplied." i have given rights every possible user on wwwroot folder , website folder 1. asp.net machine business relationship (full control) 2. iis_wpg (read & execute, list folder contents, read) 3. net invitee business relationship (iusr_machinename) (full control) 4. network service (read & execute, list folder contents, read) 5. scheme (full cotnrol) 6. users (read & execute, list folder contents, read) asp.net v2.0.50727 web service extensions allowed. in directory security(authentication , access...

iphone - NSURLResponse returning null when userName is wrong in url -

iphone - NSURLResponse returning null when userName is wrong in url - hi written simple method restfull service please find below code using -(nsinteger)sendrequesttourl:(nsstring*)url andtype:(nsstring*)type{ nsmutableurlrequest *request=[[[nsmutableurlrequest alloc] initwithurl:[nsurl urlwithstring:url]] autorelease]; [request sethttpmethod:type]; nsurlresponse *response=nil; nserror *error=nil; nsdata *responsedata=[nsurlconnection sendsynchronousrequest:request returningresponse:&response error:&error]; nshttpurlresponse *httpresponce=(nshttpurlresponse*)response; homecoming [httpresponce statuscode]; } when trying nail http://serverip:8082/kitabooadapter/services/kitaboo/login?username=learner&password=olat giving me nshttpurlresponse *httpresponce instance can status code.coming other scenario whenever trying utilize other learner in url httpresponce giving me null getting 0 status code. expected: whenever modify ...

java - Why do the date pickers trigger a JComboBox's actionPerformed unexpectedly? -

java - Why do the date pickers trigger a JComboBox's actionPerformed unexpectedly? - i have 2 date picker components , jcombobox component associated action listeners. problem this: when select date of date pickers, not associated events fired event jcombobox fired. add together surprise, event jcombobox fired first! on other hand, when click on jcombobox component , select value, jcombobox event fired , date picker events not fired, fine. reason of situation described in above paragraph? to clarify further, here's sample output console. first click on first date picker , select date: index: -1 null combo box involved. surprised? fired when datepicker1 involved. (yes, i'm surprised!) click on sec date picker , select date: index: -1 null combo box involved. surprised? fired when datepicker2 involved. (yes, i'm surprised again!) , click on combo box , select item: index: 1 lastly 6 months combo box involved. surprised? no, i'm not...

Is there any need of OAuth(2-legged) on HTTPs -

Is there any need of OAuth(2-legged) on HTTPs - is there need of oauth(2-legged) on https. in 3-legged scenario utilize oauth delegation purpose. purpose of oauth(2-legged) on https. in scenario consumer , user,so no need of authorization , utilize https,https not replayable , secure channel. u should utilize ouath i not talking 3-legged or http according oauth specification, section 11.3, while oauth provides mechanism verifying integrity of requests, provides no guarantee of request confidentiality. unless farther precautions taken, eavesdroppers have total access request content. service providers should consider kinds of info sent part of such requests, , should employ transport-layer security mechanisms protect sensitive resources. it clear if request not have secure info e.g user_id=2&messageid=33, there no need https, in 2-legged scenerio, passing password while getting access token, must have utilize https @ time. in both cases,...

java - About transfer file in hdfs -

java - About transfer file in hdfs - i need transfer files 1 hdfs folder hdfs folder in java code. may inquire there api can phone call transfer files among hdfs paths? also i'd inquire there anyway invoke mapreduce job java code? of course, java not running in hdfs. thank much , have great weekend! may inquire there api can phone call transfer files among hdfs paths? use o.a.h.hdfs.distributedfilesystem#rename method move file 1 folder in hdfs folder. function has been overloaded , 1 of method takes options.rename parameter. fyi .... haven't checked code, think rename involves changes name space , not actual block movements. also i'd inquire there anyway invoke mapreduce job java code? of course, java not running in hdfs. hadoop written in java, there should way :) utilize o.a.h.mapreduce.job#submit , o.a.h.mapreduce.job#waitforcompletion methods. java hadoop mapreduce hdfs

.net - EF Code First entity relationship issue -

.net - EF Code First entity relationship issue - i'm starting out ef cf (coming php/mysql land) , i'm hoping can help me understand i'm doing wrong here. using many great tutorials out there, i've created model classes relationships , db beingness created , updated ok. i'm getting issue cascade delete. from understand, caused when entity can deleted through cascade delete in more way creating orphan records - right? public class jbsentity { [timestamp] public byte[] timestamp { get; set; } //public user createdby { get; set; } //public user updatedby { get; set; } } public class client : jbsentity { public int id { get; set; } public string salutation { get; set; } [required, stringlength(128)] public string firstname { get; set; } [required, stringlength(128)] public string lastname { get; set; } public string billingname { get; set; } [required, stringlength(128)] public string address { get;...

java - Formulating a JPA Criteria 'in' Expression -

java - Formulating a JPA Criteria 'in' Expression - i requesting help in understanding how formulate 'in' status using javax.persistence.criteria package. i creating criteriaquery based search criteria contacts class. contact can belong 0 many contact types. search criteria can include lastly name value, contact type or both. when seek this: expression<contacttype> param = criteriabuilder.parameter(contacttype.class); expression<list<contacttype>> contacttypes = fromcontact.get("contacttypes"); predicate newpredicate = param.in(this.getcontacttype(), contacttypes); i get: org.apache.openjpa.persistence.argumentexception: cannot execute query; declared parameters "parameterexpression<contacttype>" not given values. must supply value each of next parameters, in given order: [parameterexpression<contacttype>] i haven't been able find illustration of how this. assitance , guida...

java - Android bitmaps and capturing screen -

java - Android bitmaps and capturing screen - i have app generates study in tablelayout variable number of tablerows. i utilize next code capture table bitmap: tablelayout tl = (tablelayout)findviewbyid(r.id.csrtablelayout); bitmap csr = bitmap.createbitmap(tl.getwidth(), tl.getheight(), bitmap.config.argb_8888); canvas canvas = new canvas(csr); tl.draw(canvas); after capture screen bitmap, attach email using: //folder exists file file = new file(folder.getabsolutepath()+"/csr"+csrnum+".jpg"); bufferedoutputstream bos = null; fileoutputstream fos = null; seek { fos=new fileoutputstream(file); bos=new bufferedoutputstream(fos); if(bos!=null) { seek { csr.compress(bitmap.compressformat.jpeg, 60, bos); } grab (outofmemoryerror e) { toast.maketext(customerreportactivity.this, "out of memory!", toast.length_short).show(); } { fos.flush(); fos.close(); ...

Simple lexical analysis java program -

Simple lexical analysis java program - my little project lexical analysis programme in have take every word found in arbitrary .java file , list every line appears on in file. need have 1 table dedicated reserved words , additional words found in document. programme like: public class xxxx { int xyz; xyz = 0; } the output should be: reserved words: class: 1 int: 2 public: 1 other words: xxxx: 1 xyz: 2, 3 but there lot of problems current programme , have no thought whats going on, amendments programme or finish rewrite welcome. i'm trying hang of java language hobby help welcome long can understand whats going on. i'm sure there simple solution problem effort didn't work :( help ^^ import java.io.file; import java.io.filenotfoundexception; import java.util.arraylist; import java.util.hashmap; import java.util.iterator; import java.util.list; import java.util.map; import java.util.scanner; public class lexicalanalysis { private s...