Posts

Showing posts from January, 2012

c# - Howto someFunction(List list) { /*reflection stuff*/ } -

c# - Howto someFunction(List<acceptDifferentTypesHere> list) { /*reflection stuff*/ } - i want generate datatables out of lists. so f.e. got 2 lists list<typea> lista = new list<typea>(); list<typeb> listb = new list<typeb>(); how can function accepting both (or more theese) lists different element type? private void somefunction(list<acceptdifferenttypeshere> list) { /*elementwise reflection stuff*/ } any help nice, harry private void somefunction<t>(list<t> list) { /*elementwise reflection stuff*/ } used follows somefunction<typea>(lista); somefunction<typeb>(listb); c# asp.net function collections

lua - Should I use ipairs or a for loop -

lua - Should I use ipairs or a for loop - i have read utilize of ipairs slow compared loop, should alter programming habit? i'll using lua 5.2 1 day, 5.1. my arrays approximately 1000 items @ most. local mytbl = { 'a','b','c','e'} i,v in ipairs(mytbl) print(i,v) end i=1,#mytbl print(i,mytbl[i]) end http://springrts.com/wiki/lua_performance#test_9:_for-loops pairs: 3.078 (217%) ipairs: 3.344 (236%) i=1,x do: 1.422 (100%) i=1,#atable 1.422 (100%) i=1,atable_length do: 1.562 (110%) note, however, using numerical for loop works if you're iterating on tables sequential numeric indices - if you're using hash keys tables, or sparse tables, you'll need utilize form of pairs() . lua

Changing colors of a Python for-loop in Vim -

Changing colors of a Python for-loop in Vim - i've started learning python , i'm using macvim editor jellybeans color scheme. when write for-loop in python 'for' colored blue(ish) while 'in' not. see in other themes both colored same. how edit jellybeans theme that? here's image showing mean: vim's python syntax file defines in part of pythonoperator syntax group. pythonoperator grouping linked to built-in operator group, (by default) linked in turn statement . jellybeans instead links operator normal uncolored symbolic operators ( + , * , etc) without changing statement . adding special case link straight pythonoperator statement restores coloring. tl;dr i fixed it. grab new re-create github repo. python vim colors

Is it possible to send a file from java applet to php without mysql? -

Is it possible to send a file from java applet to php without mysql? - is possible send image or file java applet php script produce pdf. until java applet has chance can save screenshot of applet in users chosen directory , user can save test results in form of pdf. want t combine 1 file , avoid work database. yes, wouldn't create sense utilize database (unless source of test results). upload screenshot/results 1 post request , generate pdf php. java php applet data-transfer

Mavenising an Eclipse Java project without the wizard -

Mavenising an Eclipse Java project without the wizard - this basic question here here goes: i'm building java project using maven in eclipse @ moment. have pom.xml file working fine, need able organise source files 'src/main/java' , resources 'src/main/resources' etc. other maven projects i've looked @ structured , build goes success without picking source files, since "skips non existent resourcedirectory src/main/resources" , others. i have source folder 'src', , eclipse won't allow me add together more source folders 'src' in name. any guidance whatsoever appreciated. try right-clicking on project , selecting maven->update project configuration context menu. refresh project. if pom close right, should represent project in eclipse way want. java eclipse maven

asp.net - Server.TransferRequest for IIS 6 -

asp.net - Server.TransferRequest for IIS 6 - is there way false behavior of transferrequest in iis 6? ability re-process whole pipeline without client having create new request? i'm trying handle 404 error application_error, magic see if url changed (in case utilize response.redirect redirect new url) if there 404 want serve pretty looking 404 page has deal showing content part of users session. the problem if utilize server.transfer, request context null @ point 404 page crashes. don't want utilize request.redirect because want browser url still on missing url 404 status code gets interpreted missing resource. on iis 7 can utilize transferrequest want. browser retains missing url , session context available 404 page code. there way similar iis 6? (transferrequest available in iis 7 in pipeline mode , our production servers still on iis 6) one possible solution create redirect flag, , create rewritepath on beginrequest. for example, place code on glo...

Is there a service or way to get the same information as the Facebook Object Debugger page? -

Is there a service or way to get the same information as the Facebook Object Debugger page? - we creating project have list of urls , display info each page facebook when add together link post. is there service or api phone call returns me json of graph properties 1 generated @ bottom of facebook object debugger ? (ex: http://graph.facebook.com/421751811580 ) the reading graph api states can pass in url id. however, urls doesn't homecoming info debug tool. (ex: https://graph.facebook.com/?ids=http://www.terra.com.br) my other thought phone call object debugger url , parse page. i´m not sure if safe or allowed facebook. (ex: http://developers.facebook.com/tools/debug/og/object?q=http%3a%2f%2fwww.terra.com.br) this post led me ?ids= information update [nov 6, 2014]: sadly, adding format=json has no effect current version of facebook og debugger. add &format=json call. i'd wary making lot of calls this, because not part of official api. http:/...

visual studio - Add external files to XAP (deploy extra files to WP7) -

visual studio - Add external files to XAP (deploy extra files to WP7) - using xna 4.0's tilestorage.openstream() can access files located in application's binary folder, deployed application. you can add together files visual studio project , set them "copy output directory", , these deployed phone, , can viewed on pc looking @ "bin\windows phone\debug" folder however, if re-create files straight "bin\windows phone\debug" folder, these not deployed phone (fyi deployed xbox if doing xbox development) how can deploy additional files phone, without adding them visual studio? wish utilize postbuild script content file share, , deploy + index file (generated in postbuild) phone. is there tool, or easy solution problem? a xap file zip file different extension. can utilize post-build event edit xap before deployment, using command-line-aware zip extractor. for instance, 7zip: "c:\program files (x86)\7-zip\7z.exe"...

ssl - https for facebook applications -

ssl - https for facebook applications - read lot new guidelines facebook developer, got know real reply this: do realy need https-website app running? anyone got running via ssl-proxy? thx sven not stackoverflow.com question, nor (1) not covered facebook (see http://developers.facebook.com/blog/post/497/). in short, yes, must have ssl-ready server. as (2) stackoverflow.com not platform meant advertise products. reply http://godaddy.com (personally not using godaddy.com services , not recommend them other reason price). there lot of alternatives, e.g. http://networksolutions.com, http://rapidssl.com (see http://www.cheapssls.com/ more offers). ssl facebook

tcp - how can i understand that all message is sent using Actionscript? -

tcp - how can i understand that all message is sent using Actionscript? - using tcp protocol. client flash. server java (on linux). is there anyway understand if message sent target server in client (actionscript 3) ? i guess using socket class this, broadcast events. create sure info sent succesfully, have server send confirmation data. socket class broadcast progressevent.socket_data event can hear for. refer socket manpage actionscript-3 tcp network-programming

Creating an element once inside of a php while loop -

Creating an element once inside of a php while loop - i trying set slideshow within of wordpress loop. so, want have 1 section of slide content, , 1 section navigation. here code: <div id="upcoming_shows"> <?php if ( $shows->have_posts() ) : ?> <?php /* start loop */ ?> <?php while ( $shows->have_posts() ) : $shows->the_post(); ?> <?php //get rid of auto drafts , trash posts $p_status = get_post_status( $post ); if ($p_status != 'trash' , $p_status != 'auto-draft') : ?> <!--i want containing div here created once--> <div id="slides"> <div class="slide" id="slide-<?php echo $post->id; ?>"> <?php the_post_thumbnail(); ?> <p class="show_date...

image processing - Setting the value of each element with minimum value in the row to 1 and others to 0 in matlab? -

image processing - Setting the value of each element with minimum value in the row to 1 and others to 0 in matlab? - this trying in matlab can't seem around achieving it for each row in filtered image, assign value of 1 pixels have minimum value in row , other pixels zero here's solution: img = imread('http://i.stack.imgur.com/ty3ye.jpg'); img = rgb2gray(img); %# transform jpeg color image grayscale minvalue = min(img,[],2); %# set pixels equal minimum value 1 bw = bsxfun(@eq,img,minvalue); when run on image linked, get which shows there plenty of border effects median filtering. removing border 10 pixels, i.e. with img = img(10:end-9,10:end-9); and running code again, find which makes quite bit more sense. matlab image-processing

django - ExtJs 4 Add records to the grid from JSON -

django - ExtJs 4 Add records to the grid from JSON - i'm new extjs user, , have next problem. i'm trying load info extjs grid, serialized json on server (i utilize django serialize() method), i'm getting empty grid. problem seems in callback function, loads info grid, can't solve it. here code: controller-function renderstudentlist:function(){ var ul = this.getstore('users'); ul.load({ scope :this, callback : function(records, operation, success){ for(i in records){ /* here, think, should code assigns values json grid records */ console.log(records[i].get('fields').name, records[i].get('fields').email); } } }); } json-data, server {success:true, "students":[{"pk": 1, "model": "poll.stude...

exception handling - Android: Is it possible to stay in "caller" activity after a crash? -

exception handling - Android: Is it possible to stay in "caller" activity after a crash? - imagine scenario: activity_1: activity_2 started startactivityforresult; activity_2: activity_3 started startactivityforresult; activity_3: crash in someplace, , activities closed (but not first 1 "ativitity_1"). is possible remain in "caller" activity after crash caused uncaught exception ?. i can "do" starting next activity startactivity, not startactivityforresult. but, need utilize startactivityforresult. ps: uncaught exceptions been logged , reported me fixed. want user's life easier, because he's in "10th deep" activity, , lose work because of it. while not same question bit related. might consider doing coupled info persistance model: android: how auto-restart application after it's been "force closed"? android exception-handling crash android-activity

User privileges with mysql database and php -

User privileges with mysql database and php - i'm making login page i've finished login how go having web page display diffren't things based on users privileges , how set privileges in mysql database? , utilize them in php code? i create field in users table called admin or in case maybe privilege_level , in php, define values of field correspond levels of privilege. edit (example): // start session on every page using $_session array session_start(); session_name("your site name"); header("cache-control: private"); // in login file: $q = mysql_query("select uid, privilege_level users pw = 'escaped_and_preferrably_hashed_password' , username = 'escaped_username' limit 0,1"); // if row found: if($q && mysql_num_rows($q) > 0){ // associative array $array = mysql_fetch_assoc($q); // set session vars $_session['privilege_level'] = $array['privilege_level']; } t...

Trying to run a pack of selenium tests written in java using Jenkins -

Trying to run a pack of selenium tests written in java using Jenkins - after reading posts suggests under "questions similar titles" (i go on reading after sending post) , reading centripetal.ca/blog/2011/02/07/getting-started-with-selenium-and-jenkins/ oliverpolden.com/content/setting-automated-selenium-testing-jenkinshudson and other posts (i note these 2 because think may useful someone) haven't found reply need. , that: i'm working in company uses jenkins ci , maven. have 3 types of tests ran sotware: junit, cactus , selenium. jenkins has job run junit tests. they've decided run other 2 types of tests (cactus , selenium) using jenkins. , that's task. cactus question i'll inquire later (have been banging head 1 long right now). selenium tests written in java , there's java file has tests follows: package com.mycompany.test.dailysanity; import org.junit.runner.runwith; import org.junit.runners.suite; @runwith(suite.class...

java - Parameterized Lists in method signature -

java - Parameterized Lists in method signature - something next not give me compile-time or runtime error , i'm drawing blank why. there way enforce compile error on phone call cls.add? why isn't definition of t in class definition beingness carried on phone call methods inside? understand didn't instantiate class way, definition of class states t must number. public class newclass<t extends number> { private list<t> id = new arraylist<t>(); public void add(list<t> elem) { id.addall(elem); } public static void main(string[] args) { newclass cls = new newclass(); cls.add(new arraylist<string>()); } } you using raw type. type info ignored in case, , warning. if provide type parameter, fail: newclass<integer> cls = new newclass<integer>(); cls.add(new arraylist<string>()); //error java generics

MYSQL query (with joins and virtual values) -

MYSQL query (with joins and virtual values) - i have 3 innodb tables: emails, websites , subscriptions. emails table has id , email columns. websites table has id , address columns. subscriptions table has id , email_id , website_id columns. what i'm tring supply email , homecoming table columns address , subscribed . former list of addresses in websites table , latter gets value 1 if supplied email address has occurence in subscriptions table website_id set website, or 0 otherwise. i'm willing retain websites if user not found. the point i'm stuck should alter value of virtual column subscribed 0 1 when email has record. here's query far. know how this? select `address`, "0" `subscribed` /* 0 becomes 1 websites email has subscribed */ `websites` left bring together ( select s.`website_id` `subscriptions` s right bring together ( select `id` `email_id` `emails` `email`='someone@mail.com' limit 1)...

php - Inserting output into page after document has been executed -

php - Inserting output into page after document has been executed - in php have situation need page executed, have item inserted output page. i think output buffering may of help, can't work out how implement in situation. my code looks this: //this document part of global functions file function pageheader (){ //i'm using $globals here because works, rather improve method if possible $globals['error_handler'] = new errorhandler(); //errorhandler class sets function set_error_handler, gets array of errors executed page require_once($_server['document_root'].'/sales/global/_header.php'); //i unordered list ->displayerrornotice() displayed here, if list empty because list output before rest of document executed } function pagefooter (){ $globals['error_handler'] ->displayerrornotice(); //this function displays errors html unordered list include($_server['document_root']."/sales/global/_...

jboss - startup class (extends ServiceMBean) vs load-on-startup servlet -

jboss - startup class (extends ServiceMBean) vs load-on-startup servlet - i new jboss , know differences between servicembean , load-on-startup servlet tag in web.xml? also, know 1 loaded first or loaded @ same time? in situation, should utilize mbean , when should utilize startup servlet or doesn't matter? i need write a class/servlet validate if required scheme properties (e.g -dinstall_dir=blah ) set. if not, stop right there. else proceed , start application. thanks in advance -a servicembean jmx, part of jvm. load-on-startup servlet tag in web.xml part of j2ee application. jmx part of j2se starting jdk 1.5. so, can have 1 servicembean per jvm. not per application. jmx used mostely monitoring , managing jvm. provides access info such as: number of classes loaded , threads running, memory consumption, garbage collection statistics, on-demand deadlock detection, , others. mutual use, refresh cache. jmx allow instrument application , control/monitor...

process - How to run bat file with required permissions in C# -

process - How to run bat file with required permissions in C# - i have bat file copies files 1 location another. set src=%1 set dest=%2 xcopy /y/i %src%\*.txt %dest%\temp echo done! i'm trying run file via c# program var psi = new processstartinfo(filetorun); psi.arguments = args; psi.redirectstandardoutput = true; psi.redirectstandarderror = true; psi.windowstyle = processwindowstyle.hidden; psi.useshellexecute = false; psi.createnowindow = true; process cmdproc = process.start(psi); streamreader output = cmdproc.standardoutput; streamreader errors = cmdproc.standarderror; cmdproc.waitforexit(); bat-file executed, can see 'done!' message in output, files not copied. the way works is psi.useshellexecute = true; psi.redirectstandardoutput = false; psi.redirectstandarderror = false; but in case have disable output/error redirection , need them. doesn't work me. i have tried set administrator's username/password psi.username = usernam...

html - Not sure if jquery working on - items because of firebug -

html - Not sure if jquery working on <li> items because of firebug - would mind checking site in firebug? looks jquery hide/show working don't know why not highlighting if showing in firebug. i'm looking @ mousing on "design" block. reason want show (not in lite grey, indicating might not beingness working) want able css position text in link. http://freespiriteurodesign.com.b1.bloomsite.net/ thanks help!! i found nil may add together code snippet avoid error "event.layerx , event.layery broken , deprecated in webkit. removed engine in near future". $(document).ready(function(){ (function(){ // remove layerx , layery var = $.event.props, len = all.length, res = []; while (len--) { var el = all[len]; if (el != 'layerx' && el != 'layery') res.push(el); } $.event.props = res; }()); }); or may upgrade jquery newer version. jquery html css

unit testing - How to do algorithm visualization? -

unit testing - How to do algorithm visualization? - i looking algorithm visualization library/tool documented , can phone call source code. took @ jhave - example of usage. , liked it, seems has documentation not trust future. found article algorithm explorer has nice idea. implemented c++ api cannot find anywere. main thought want unit tests brain. build various exercises , in future when want test knowledge redo them. found images stick longer me, why want visualize algorithms in states. ( might remember improve tricky case happens when info sorted in reverse , utilize quick sort if view it.) ideal tool: 1. has integrate language. 2. has documented growing comunity , examples. 3. implemented on top of capable rendering engine(ogre, xna). here place need visit: the algorithm visualization portal! algorithm unit-testing visualization

java - How to write multiple line property value using PropertiesConfiguration? -

java - How to write multiple line property value using PropertiesConfiguration? - i have properties file property list value (comma separated), how write property in multi-line ? (backslash after comma)? i can't find or @ to the lowest degree escaping comma comma , backslash any help appreciated. will happy hear alternative frameworks. thanks if mean following; relies on backslash + end-of-line. found documented in: http://docs.oracle.com/javase/6/docs/api/java/util/properties.html primes = 2,\ 3,\ 5,\ 7,\ 11 java properties apache-commons-config

android - defining a view based upon a int -

android - defining a view based upon a int - is there anyway alter view editing based upon value of int? without using if statement? for example: int counter = 1; public void attach(){ final sharedpreferences sp = preferencemanager.getdefaultsharedpreferences(this); textview text1 = (textview) findviewbyid(r.id.text1) textview text2 = (textview) findviewbyid(r.id.text2) textview text3 = (textview) findviewbyid(r.id.text3) textview text4 = (textview) findviewbyid(r.id.text4) if (counter < 5){ if (sp.getint("test" + counter , 0) == counter){ text + counter .settext("test" + counter); }else{counter = counter + 1; attach();}} } simplest way define array of possible view ids. int[] viewids = new int[] { r.id.text1, r.id.text2, r.id.text3, r.id.text4 } //some code int = /*whatever*/; textview tv = (textview)findviewbyid(viewids[i]); tv.settext("test"+i); android view

ios - duplicate plist in xcode causes all values to be strings? -

ios - duplicate plist in xcode causes all values to be strings? - i using plists store preset settings ios app. i've created default plist re-create , utilize template of presets. however, when duplicate plist in xcode, of types become strings! ideas why happens or how prepare this? as example, default.plist looks in xcode -mono boolean no -name string default -portamento number 0.001 and after duplicate new file: -mono string no -name string default -portamento string 0.001 thanks!! //////thanks michael dautermann reply this. when created .plist file in xcode, had appended .plist manually. resulted in file looked great in xcode, wasn't .xml file. result, datatypes not included in source code. so, create .plist file (and don't append .plist) , well. ios xcode plist

Cannot understand shift operator behavior in C code -

Cannot understand shift operator behavior in C code - look @ sample c code (extracted test case example): main() { unsigned long a, b; int c; c = 32; = 0xffffffff << 32; b = 0xffffffff << c; printf ("a=%x, b=%x\n", a, b); } prints: a=0, b=ffffffff i cannot understand why b not zero, a. tested on microsoft c , gcc. update: fixed stupid typo (should have been << c , not << b of course). question still stands, e.g. result still same. in c undefined behavior left shift more width of promoted operand. (c99, 6.5.7p3) "if value of right operand negative or greater or equal width of promoted left operand, behavior undefined." the c rules types of integer constant different between c89 , c99. i assume in examples below int , unsigned int types 32-bit. in c99 the type of unsuffixed hexadecimal integer constant first in corresponding list in value can represented: int , unsigned int , long , unsigned lo...

xml - Zend_Navigation and Zend_Translation France accent -

xml - Zend_Navigation and Zend_Translation France accent - i have setup net application multi languages. the navigation set navigation.xml, zend translation files .php files. going cant create utilize accents french republic language in navigation. when set illustration 'è' in navigation xml label straight works suppose when add together in fr.php (translation array) , set here in xml file nothing. what have create work? thanks nick problem seems fixed, create custom route navigation section. xml zend-framework zend-navigation zend-translate

silverlight - Apply style to Windows Phone TextBox when it doesn't contain text -

silverlight - Apply style to Windows Phone TextBox when it doesn't contain text - i'm trying find out way apply style textbox element when not contain text. want textbox have different background color (for instance) when or not contain text. as triggers not can utilize in silverlight (afaik), there way this? preferrably without writing custom implementation of textbox behavior. thanks. i ended using default behavior (conditionbehavior): <i:interaction.triggers> <i:eventtrigger eventname="textchanged"> <i:interaction.behaviors> <ec:conditionbehavior> <ec:conditionalexpression> <ec:comparisoncondition leftoperand="{binding text, elementname=textbox}" rightoperand="" operator="notequal"/> </ec:conditionalexpression> </ec:conditionbehavior> </i:interaction.behaviors> <...

python - what design pattern for pre-do in class function -

python - what design pattern for pre-do in class function - my class function alway need before (python): class x: def f1(): #### if check() == false: return; set_a() #### f1_do_something def f2(): #### if check() == false: return; set_a() #### f2_do_something and want : class x: def f1(): # auto check-return-set_a() f1_do_something def f2(): # auto check-return-set_a() f2_do_something i've read design patterns , not know how apply design patterns in case. if there no suitable design patterns, there other solution problem? you utilize decorator: #!/usr/bin/env python def check(f, *args, **kwargs): def inner(*args, **kwargs): print 'checking...' homecoming f(*args, **kwargs) homecoming inner class example(object): @check def hello(self): print 'inside hello' @check def hi(self): print 'inside hi' if __name__ == '__main__...

c# - Using a .Net DLL in Microsoft Access VBA -

c# - Using a .Net DLL in Microsoft Access VBA - ok have assembly, written in c#, using visual studio 2010. this assembly contains 1 class, contains 1 method returns word result, code below: using system.runtime.interopservices; namespace testdll { public class class1 { [comvisible(true)] public string testmethod() { homecoming "result"; } } } the output section in build tab on properties window looks so: when click on build, dll file , tlb file. can add together tlb file microsoft access browsing it. now, in access have button , label. want create caption property of label equal result of testmethod. i'm thinking need similar below i'm not sure, help much appreciated: private sub btnmain_click() dim tm testdll dim foo string foo = tm.testmethod lblbarr.caption = foo end sub thankyou maybe next work: private sub btnmain_click() dim tm testdll.class1...

android listview row name refered to class name , how to change it -

android listview row name refered to class name , how to change it - my listview row appears 1 word name. want alter 2 words. can't because list name refered class name. can't include space in class name don't know how solve this. illustration ( day1) want alter (day one), appreciate help,thanks (menu.class) public class menu extends listactivity { string classes[] = { "introduction", "day1", "day2", "day3", "day4", "day5", "day6", "day7", "day8", "day9", "day10", "day11", "day12", "day13", "day14", "day15", "day16", "day17", "day18", "day19", "day20", "day21", "day22", "day23", "conclusion"}; @override protected void oncreate(bundle savedinstancestate) { ...

c++ cli - Where is this managed object stored? -

c++ cli - Where is this managed object stored? - value class valbase { public: int a; }; ref class refbase { public: int a; }; int main(array<system::string ^> ^args) { refbase^ refbase1 = gcnew refbase; //legal. ref type managed obj created on clr heap. valbase^ valbase1 = gcnew valbase; //legal. value type managed obj created on clr heap. refbase* refbase2 = new refbase; //illegal: new cannot used on managed ref class valbase* valbase2 = new valbase; //this compiles okay "managed object" stored ? clr heap or native heap ? } in lastly assignment managed object stored ? totally new c++ cli. also, true value types should utilize stack semantics create code efficient ? i.e instead of valbase^ valbase1 = gcnew valbase, should utilize valbase valbase1; just add together fellow member of reference type value type: value class valbase { public: string^ s; int a; }; ... valbase* = new valbase; and compiler tells s...

php post remote wildcard filename -

php post remote wildcard filename - i need php script on remote http server (i'm assuming via fopen) , needs find unique filename if exists. if exist, need display. remote filename changing on time , needs limited first 1 finds in case there multiple remote files on accident. ie filename this: domain.com/filename-1.zip or this domain.com/filename-2.zip how post dynamic, remote filename in local script , limit 1? ie domain.com/filename-*.zip the remote server have cooperate , tell filenames available. means script explicitly tells (or serves up) file matching parameters, or allows directory browsing allowing parse out filenames , find whatever want. php wildcard fopen file-exists

Java: Easiest way to compare two xmls -

Java: Easiest way to compare two xmls - i have 2 xmls: first.xml <text>this text</text> <output>this output</output> second.xml <text>this not text</text> <output>this output</output> i want compare these 2 xmls , output should this <text>this <inserted>not</inserted> text</text> <output>this output</output> means, want add together new tag suppose <inserted> newly added text. how compare these xmls , create new 1 ? thanks ur time :) take @ diffxml. java xml

java SE. How to send post request with binary file? -

java SE. How to send post request with binary file? - i working on java app, upload images on yfrog.com. can post on api page but without binary files string parameters. method utilize only take "string". urlconnection conn = url.openconnection(); conn.setdooutput(true); outputstreamwriter wr = new outputstreamwriter(conn.getoutputstream()); wr.write(data); wr.flush(); wr.write(data); take string only. i tried set image path doesn't work. do favor , take @ apache httpcomponents. java post upload binary request

optimization - LLVM insertvalue bad optimized? -

optimization - LLVM insertvalue bad optimized? - should avoid using 'insertvalue' instruction combined load , store when emit llvm code? bad optimized native code when utilize it. @ next example: ; moduleid = 'mod' target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64" target triple = "x86_64-pc-linux-gnu" %a = type { i64, i64, i64, i64, i64, i64, i64, i64 } @aa = external global %a* define void @func() { entry: %a1 = load %a** @aa %a2 = load %a* %a1 %a3 = insertvalue %a %a2, i64 3, 3 store %a %a3, %a* %a1 ret void } when run "llc -o - -o3 mod.ll", horrible code: func: # @func .ltmp0: .cfi_startproc # bb#0: # %entry movq aa(%rip), %rax movq (%rax), %r8 movq 8(%rax), %r9 movq 16(%rax), %r10 ...

php - Avoid flash upload 30 seconds timeout when doing imagemagic convert? -

php - Avoid flash upload 30 seconds timeout when doing imagemagic convert? - i have web app uses flash uploader (swfuploader) , user pointed bug happens when script hangs more 30 seconds. i know flash documentation mentions after 30 seconds of no response timeout, know need send info browser before convert function ends. as of script uploads file, convert it, , if multipage pdf save reference children pngs db, works fine on big , little files, problem happens after 30 pages hang more 30 seconds. thanks in advance i think should build whole thing asynch , dont have worry that... right? php flash imagemagick

iphone - how to combine two UITableview in single UITableview's section? -

iphone - how to combine two UITableview in single UITableview's section? - i want set 2 different uitableview in single uitableview's particular section. possible?? to exactly asking not possible. think did not phrase want correctly. you want show info 2 different table views in 1 section. know each tableview has info source. all got in order show info 2 tables manipulate info source homecoming info expecting, i.e. joining 2 info source content section together. iphone xcode4.2

pci - Linux Zero Copy -

pci - Linux Zero Copy - i have pci device needs read , write userspace. i'm trying utilize 0 copy; there way allocate, pin, , physical address of userspace address within userspace or need have kernel module that, say, calls virt_to_phys or get_user_pages? device's memory mapped userspace memory via mmio can pass info that's needed. thanks. it total hack, limited linux range of memory , used mmio allocate memory device kernel unaware of. linux pci zero-copy

xml - Android SAXParser : Not well-formed document ... That *do* is well-formed -

xml - Android SAXParser : Not well-formed document ... That *do* is well-formed - so, have launcher activity, user selects file (in fact, directory, containing .xml , .wav). when clic on file wants open, start new activity works selected files. display files user launcher_activity : onclick : other_activity.path_dir = file.getabsolutepath(); startactivity(other_activity_intent); other_activity : file_source = new inputsource(new stringreader( path_dir + "/xml.xml" )); parser.parse(file_source) parseexception : @ line 1, column0: not well-formed (invalid token) it's xml file empty ... but, know path_dir right one, , xml file @ right place also i know well-formed because using before. in previous version of app, .xml , .wav "in-app" using file_source = new inputsource(getresources().openrawresource(r.raw.xml)); using raw resource working. i'm trying set resource outside of app , xml document no longer recognized ... <...

java - What should I be using instead of com.google.appengine.repackaged*? -

java - What should I be using instead of com.google.appengine.repackaged*? - just updated 1.6.1 , getting warnings should not using com.google.appengine.repackaged what should using instead? affected classes are: com.google.appengine.repackaged.org.json.jsonexception; com.google.appengine.repackaged.org.json.jsonobject; com.google.appengine.repackaged.com.google.common.util.base64; com.google.appengine.repackaged.com.google.common.util.base64decoderexception; for org.json.* can utilize java json library found @ http://json.org/ (though there other, improve json libraries java) for classes in com.google.common.* can find of them (though not base64 , etc., apparently) in google's guava libraries. java google-app-engine

iphone - Customizing UITableViewCell in Interface Builder -

iphone - Customizing UITableViewCell in Interface Builder - in 2 classes, i've subclassed uitableviewcell in order major customization. i'd utilize xib file maintain amount of ui layout code minimum. i'm coming across odd exception: if (!cell) { if (indexpath.row == 0) { cell = [[[searchcelltop alloc] initwithstyle:uitableviewcellstyledefault reuseidentifier:cellidentifier] autorelease]; nsarray* objects = [[nsbundle mainbundle] loadnibnamed:@"searchcelltop" owner:cell options:nil]; cell = (searchcelltop*)[objects objectatindex:0]; } else { cell = [[[searchcell alloc] initwithstyle:uitableviewcellstyledefault reuseidentifier:cellidentifier] autorelease]; nsarray* objects = [[nsbundle mainbundle] loadnibnamed:@"searchcell" owner:cell options:nil]; cell = (searchcell*)[objects objectatindex:0]; } } this seems work loading xibs. seek doing such as: if (indexpath.row < [self ...

.net 3.5 - Named string formatting in C# -

.net 3.5 - Named string formatting in C# - is there way format string name rather position in c#? in python, can illustration (shamelessly stolen here): >>> print '%(language)s has %(#)03d quote types.' % \ {'language': "python", "#": 2} python has 002 quote types. is there way in c#? instance: string.format("{some_variable}: {some_other_variable}", ...); being able using variable name nice, dictionary acceptable too. update: ended doing this post, it's not pretty. i'll seek out john sheehan's approach, if has other suggestions in meantime, sense free add together them. :) update 2: john sheehan's approach works pretty well. accepting it. there no built-in method handling this. here's 1 method string mystring = "{foo} {bar} , {yadi} {yada}".inject(o); here's another status.text = "{username} lastly logged in @ {lastlogindate}".form...

c# - How to unit test method which uses static classes, without Moles or Isolator? -

c# - How to unit test method which uses static classes, without Moles or Isolator? - i have method public int gethighestprioritypricerecordindex(searchandextractreply_2 priceinforeply) { int index = 0; var priceexposablecolumn = getpricecolumn(priceinforeply, "lpcispriceexposable"); var pricingsourceidcolumn = getpricecolumn(priceinforeply, "lpcpricingsourceid"); var priceexposablepriority = new dictionary<string, int> { { "y", 2 }, { "n", 1 } }; var pricingsourcepriority = new dictionary<string, int> { { "usa", 5 }, { "eme", 4 }, { "asi", 3 }, { "der", 2 }, { "nus", 1 } }; if (priceexposablecolumn.value != null) (int = 1; < priceexposablecolumn.value.length; i++) if (priceexposablepriority[priceexposablecolumn.value[i]] > priceexposablepriority[priceexposablecolumn.value[index]] ...

How to get selected value from Dropdown list in javascript -

How to get selected value from Dropdown list in javascript - how can selected value drop downwards list using javascript? have tried next not work. var sel = document.getelementbyid('select1'); var sv = sel.options[sel.selectedindex].value; alert(sv); it working fine me. i have next html: <div> <select id="select1"> <option value="1">test1</option> <option value="2" selected="selected">test2</option> <option value="3">test3</option> </select> <br/> <button onclick="getselecteditem('select1');">get selected item</button> </div> and next javascript: function getselecteditem(el) { var e = document.getelementbyid(el); var strsel = "the value is: " + e.options[e.selectedindex].value + " , text is: " + e.options[e.selectedindex]....

mysql - Selecting and ordering by two fields -

mysql - Selecting and ordering by two fields - i have query: "select * bookmarks id=? order title asc", which works great. i've added in field tag need order both tag , title. application wise having bookmarks grouped tags (which alphabetical), , in each tag alphabetized individually. i'm working on code to need sql give me info in order. if had guess: "select * bookmarks id=? order title asc , order tag asc", thanks you separate ordering columns comma (check select clause documentation): select * bookmarks id=? order tag, title; asc not needed - it's default sort order. mysql

ruby - Rails - is writing tests for testing CRUD operations worth it, if so integration or unit? -

ruby - Rails - is writing tests for testing CRUD operations worth it, if so integration or unit? - i have lengthy simple form allows users update products, nil fancy, displays fields come in text values & updates corresponding database table. is regular practice write tests crud operations such this? of import form works used everyday - there not much go wrong. have time this, don't want wasting time either or create future maintenance of test suite overly difficult. if cover tests, should utilize integration (cucumber) or unit (rspec) tests? thanks advice! in theory believe supposed utilize both: rspec test each layer in isolation, cucumber test whole stack. if think piece of app straight-forward warrent slavish adherence principles, recommend stick integration tests. it's of import know if isn't working right, , imo cucumber lone should suffient purpose. of course of study more complex areas of app, want utilize mixture of each. ru...

using foursquare api v2 to get herenow of a venue -

using foursquare api v2 to get herenow of a venue - on documentation page, https://developer.foursquare.com/overview/venues, says that the venues platform lets developers utilize foursquare location layer. applications can search our database , find info including tips, photos, check-in counts, , here now. searches can done near point or through whole city, , can restricted trending or recommended places. platform offers of without requiring end user authentication , available @ high rate limits. however, when send request like: https://api.foursquare.com/v2/venues/4ad7a112f964a520050d21e3/herenow?client_id=myclientid&client_secret=myclientsecret&v=20120119 i got this: {"meta":{"code":200},"response":{"herenow":{"count":16,"items":[]}}} is there need do, such register venue platform developer, list of people here? thanks! you cannot users info without authenticating [ :( ] c...

Android Webview using Fragments to Retain text data across orientation changes -

Android Webview using Fragments to Retain text data across orientation changes - i need create webview fragment, info in webview (text in forms) not lost when orientation changes. like in illustration fragmentretaininstance.java want create webview setretaininstance(true) work. i using android compatibility bundle fragments, please help me illustration accomplish above. in advance. had similar problem had create couple of additions work various version (including ics). in main app activity added different version of "a fair player" offered. <activity android:name=".mymainactivity" android:configchanges="orientation|keyboardhidden|screensize" android:label="@string/app_name" > i had working on pre-honeycomb with: <activity .... android:configchanges="orientation|keyboardhidden" .... > with fragments , honeycomb, need "screensize" alternative on android:conf...

oauth 2.0 - Can I get Google's OAuth2 to display a mobile friendly approval page? -

oauth 2.0 - Can I get Google's OAuth2 to display a mobile friendly approval page? - i working on mobile app nail google apis, authenticating using oauth2. it's working pretty when navigate approval uri, google returning looks total blown desktop app approval page. doesn't bad i'd prefer stripped downwards mobile version inquire google's oauth 1 display. (from http://code.google.com/apis/accounts/docs/oauth_ref.html) btmpl (optional) forces mobile version of approval page. accepted value "mobile". google-specific parameter. i've tried adding oauth2 approval uri no joy. if i'm using google installed application auth flow, there options indicating request coming little screen device? the oauth endpoint using: https://accounts.google.com/o/oauth2/auth?response_type=code&redirect_uri=http://localhost&scope=https://www.googleapis.com/auth/userinfo.profile&client_id=xxxxxxx.apps.googleusercontent.com the oaut...

java - Store a Map object inside another Map -

java - Store a Map object inside another Map - i have instance map: map<string, integer> map = new hashmap<string,integer>(); than set values: map.put("a", 2); map.put("b", 3); than have class serialize object: public class mapobject implements serializable { private static final long serialversionuid = 1l; map<string, integer> map = new hashmap<string, integer>(); public mapobject(map<string, integer> map) { this.map = map; } } i because i'm working sockets , want pass map object client server using objectinputstream , objectoutputstream. now want inquire if can store map object in server, instance mapobject mo; is possible store object in map? regards you mixing 2 questions together. don't know asking: can transport hierarchical map thro objectoutputstream? how map map map? if asking question 2, should not mention mention question 1 because confuses question. or asking bo...

javascript - How to open a Popup window, so that it's height is from the top of the screen to the buttom? -

javascript - How to open a Popup window, so that it's height is from the top of the screen to the buttom? - i trying open popup window, height top of screen "applications" bar of windows. code: function windowopener(windowheight, windowwidth, windowname, windowuri) { var windowheight = window.innerheight ? window.innerheight : document.documentelement.clientheight ? document.documentelement.clientheight : document.body.clientheight; var centerwidth = (window.screen.width - windowwidth) / 2; var centerheight = (window.screen.height - windowheight) / 2; newwindow = window.open(windowuri, windowname, 'resizable=0,scrollbars=1,width=' + windowwidth + ',height=' + windowheight + ',left=' + centerwidth); newwindow.focus(); homecoming newwindow.name; } why doesnt work in ie? (works in chrome) thanks i think need screen.width , screen.height. don't prepend them window. edit: apparently ie requires "fullscreen...

graphics - Algorithm for comparing pictures/shapes for uniqueness -

graphics - Algorithm for comparing pictures/shapes for uniqueness - say have grid users draw pictures/shapes clicking , coloring boxes. can suggest algorithm compare these drawings according originality ? thinking comparing them according boxes occupy not sure if best way. hope clear. thanks. imho, best selection utilize mutual info metric. since still abstract problem not sure details of calculating it. let me elaborate on why mutual info measure. allow assume image made of colors a,b,c , 4 (exactly 4 colors). , image same, except replaced e, b->f, c->g , d->h. if utilize other metrics (correlation example), these 2 images seem dissimilar, mutual info show these 2 images share exact same info (only coded differently). how calculate mutual information: first, need align images (which tough problem, can reasonable solution transforming image in offsets, scaling , rotation). 1 time images aligned, have pixel-to-pixel relation. can assume each pixel indep...

ruby - Starting EventMachine from another file -

ruby - Starting EventMachine from another file - i wrote simple eventmachine server one: eventmachine.run eventmachine::websocket.start(:host => host, :port => port) |ws| # snip... end end now, trigger file in directory. if eventmachine simple ruby class add together run (or something) class method , like: #!/usr/bin/env ruby $load_path << "./lib" require "my_event_machine" myeventmachine.run any thought how this? thanks! you had solution: my_app.rb: class myapp def run em.run em::websocket.start(:host => host, :port => port) |ws| # snip... end end end end run.rb: #!/usr/bin/env ruby $load_path << "./lib" require "my_app" myapp.new.run ruby eventmachine

web services - ASP.NET webservice responds with Internal Server Error (500) to post and get requests -

web services - ASP.NET webservice responds with Internal Server Error (500) to post and get requests - the webservice code simple: [webmethod] [scriptmethod(responseformat = responseformat.json)] public void receiveorder(string json) { context.response.write("ok"); } and jquery calling webservice follows: $.ajax({ type: "post", contenttype: "application/json; charset=utf-8", url: 'http://localhost:50730/gingerweb.asmx/receiveorder', data: 'test', //json.stringify(weborder), datatype: "text", success: function(data){ if(data === "ok") orderplaced(); } }); and yet chrome console reads in provocative red: 500 (internal server error) the problem asmx web-service need find all input parameters in request. if @ to the lowest degree 1 input parameter not found in request server web service failed status code 500 (internal server error). the...

android - Alternate chat bubble widths -

android - Alternate chat bubble widths - i developing chat type application. using 2 different 9 patches chat bubble main message , responses. problem facing automatically wrapping widths of bubbles according message length. next main layout: <relativelayout android:orientation="vertical" android:layout_width="wrap_content" android:layout_height="0dp" android:layout_weight="1" > <listview android:id="@+id/list" android:layout_width="wrap_content" android:layout_height="fill_parent" android:stackfrombottom="true" android:transcriptmode="alwaysscroll" android:cachecolorhint="#00000000" android:listselector="@android:color/transparent" android:divider="@null" /> </relativelayout> <linearlayout android:id="@+id/footer" android:layout_width="fill_parent" androi...

c++ - Why is a VTABLE required when the derived class doesn't override the virtual function? -

c++ - Why is a VTABLE required when the derived class doesn't override the virtual function? - class base of operations { public: void virtual fn(int i) { cout << "base" << endl; } }; class der : public base{ public: void fn(char i) { cout << "der" << endl; } }; int main() { base* p = new der; char = 5; p->fn(i); cout << sizeof(base); homecoming 0; } here signature of function fn defined in base class different signature of function fn() defined in der class though function name same. therefore, function defined in der class hides base class function fn() . class der version of fn cannot called p->fn(i) call; fine. my point why sizeof class base or der 4 if there no utilize of vtable? requirement of vtable here? note highly implementation dependent & might vary each compiler. the requirement presence of vtable base of oper...

Retrieve a list of services running on a server vb.net -

Retrieve a list of services running on a server vb.net - i'm looking way details of name , status of services running on service. did utilize next code: public sub getservices() dim localservices servicecontroller() = servicecontroller.getservices() each service servicecontroller in localservices if not string.isnullorempty(service.displayname) dictservice(service.displayname) = new service(service.displayname, service.servicename, service.status.tostring) end if next end sub however, since have packaged project wcf service, system.serviceprocess namespace used cannot used: is there other way can retrieve same details? perchance through wmi? all message saying that, when trying import namespace, either there nil in it, or wasn't found. usually case of missing reference, sure you've added reference system.serviceprocess in project? vb.net windows-services wmi wmi-query