Posts

Showing posts from July, 2013

c# - Unhandled exception thrown by PhotoChooserTask -

i've got code , i'm using show button allows user choose image library , use background app. so create photochoosertask , set show camera , bind method has executed when task completed. button start task showing photochoosertask . action on complete quite easy, i've got set boolean value , update image source. photochoosertask pct_edit = new photochoosertask(); pct_edit.showcamera = true; pct_edit.completed += pct_edit_completed; button changeimagebutton = new button { content = "change image" }; changeimagebutton.tap += (s, e) => { pct_edit.show(); }; void pct_edit_completed(object sender, photoresult e) { if (e.taskresult == taskresult.ok) { bi.setsource(e.chosenphoto); isrebuildneeded = true; } } the problem won't show photochoosertask give me exception, taking me private void application_unhandledexception(object sender, applicationunhandledexceptioneventargs e) { if

ios - ARC Not Release View Controller Variable -

i got following variable in view controller's @private section, arc seam release want stay , not collected.. how? nsmutablearray* carpictures; thanks there's not enough information answer question. try declaring strong property ie @property (nonatomic,strong) nsmutablearray *carpictures; and set variable self.carpictures = [nsmutablearray array];

javascript - TinyMCE 4 - get caret position -

i want caret position in tiny mce 4, don't want row/column number - want position in pixels (x & y dimmension). can relative anything. last thing - want without creating additional tags in content, bookmarks. tinymce have method that? or there option bookmark position in pixels, , after removing it? thanks replies ok, found it. first have instance of tinymce.editor class var editor = new tinymce.editor(); //or way, tinymce.activeeditor next jquery position of tinymce widgets: var tinymceposition = $(editor.getcontainer()).position(); var toolbarposition = $(editor.getcontainer()).find(".mce-toolbar").first(); now position of html node, you're edit: var nodeposition = $(editor.selection.getnode()).position(); var textareatop = 0; var textarealeft = 0; we have y-axis position (via nodeposition.top ), it's time x: if (editor.selection.getrng().getclientrects().length > 0) { textareatop = editor.selection.getrng().getclientrects

java - How to handle Mazovia encoded text -

im using java edit text files containing records. files handled old systems probably use mazovia ( wiki ) encoding. cant find way handle files , it's beginning give me headache. when edit text files java code, systems find additional characters in them, breaking entire record structure (character position matters). how edit files without introducing additional characters/breaking encoding? proper display of characters great, if it's not possible, i'll make not breaking record structure. if use example iso-8859-1 when reading , writing not break file since every byte maps character , every character maps single byte. (any encoding these characteristics do.) you won't correct unicode characters when reading (for have implement custom charset , i'm not sure how work is), @ least won't break file.

escaping - Unescape apostrophe (') in JavaScript? -

i'm trying unescape html-escaped apostrophe ( "'" ) in javascript, following doesn't seem work on devtools console line: unescape('''); the output simply: "'" it doesn't work in underscore's unescape either: _.unescape(''') what doing wrong? unescape has nothing html character entities. it's old, deprecated function decoding text encoded escape , old, deprecated function encoding text in way unlikely useful in modern world. :-) if need turn html plain text, easiest way via element: var div = document.createelement('div'); div.innerhtml = "'"; alert(div.firstchild.nodevalue); live example | live source note above relies on fact there no elements defined in html text, knows there 1 child node of div , text node. for more complicated use cases, might use div.innertext (if has one) or div.textcontent : var div = document.createelement(

visual studio 2012 - Debugging Smart Card Minidriver -

i'm working on cng smart card minidriver. to test functionality i'd use makecert import private key smart card. unfortunately every change make have copy minidriver.dll system32 directory. once called makecert first time, minidriver.dll in use, , can't overwrite unless reboot pc (which takes time..) is there way overwrite without rebooting? my second attempt debug using visual studio , starting makecert visual studio. prompted with: the breakpoint not hit. no symbols have been loaded document. is there way debug minidriver.dll within visual studio using makecert.exe ? thanks help.

c# - How use font forge to generate a font in cmd -

prompt please how convert ttf svg in utility fontforge command line windows, or how use api in .net, creating script these 2 function calls : open($1,1) generate($2) and running this: fontforge -script script.pe input.ttf output.svg should want.

8 digit web color in xml -

i found color definition in xml file looks #8867d1fd . wanted check in e.g. photoshop color picker keeps cutting 2 last digits. kind of notation it? colors defined 6 digits (red , green , blue components of color) , 2 digits alpha degree of transparency. useful if want show content , background well. 0 alpha means transparent, ff means solid , background not shown. number in between means semi-transparent or semi-solid. so format is: argb ( alpha , red , green , blue ) to check color use #67d1fd check color without alpha.

Ext: how can I use data from an ajax request to modify an existing Javascript element? -

for days i've been searching explanation on how right. tried find decent tutorial either js or ajax, one's found rather basic , didn't go deep enough. when want solve problem python, go python.org, php use php.net, haven't found decent ressource js , ajax yet. tips appreciated. so i'll try explain did. have rather simple page, has div on left , div on right. within left one, tree rendered, representing registry, within right one, values displayed , edited. the tree stored in global variable. have read warnings using global variables, think it's justified in case. whenever page accessed, tree displayed. var tree; ... function inittree(treerootconfig) { return new ext.tree.treepanel({ renderto : 'tree' ,width : 500 ,height : 498 ,autoscroll : true ,resizable : true ,usearrows : false ,animate : true ,loader : { dataurl : urls.urlloadtree,

error handling - In C++, how can I get the current thread's call stack? -

i'm writing error handler code i'm working in, in c++. able make sort of reference whatever have on stack, without being explicitly passed me. specifically, let's want print names of functions on call stack, in order. trivial in managed runtime environments jvm, not trivial 'simple' compiled code. can this? notes: assume simplicity compile code debugging information , no optimization. i want write either platform-independent or multi-platform. prefer former. if think i'm trying reinvent wheel, link source of relevant wheel , i'll there. update: i can't believe how need bend on backwards this... makes me pine language shall not mentioned. there way back-trace in c++, though not portable. cannot speak windows, on unix-like systems there backtrace api consists of following functions: int backtrace(void** array, int size); char** backtrace_symbols(void* const* array, int size); void backtrace_symbols_fd(void* const* array, int

Email Notification System Using PHP MySQL -

i working on project requires sending email notifications users. way works, users follow catergories of posts/group, whenever there new post or comment under post category/group email message notifying them snippet of post itself. i expecting send upwards of 5000 emails daily. effective use cron job fetch users , send emails @ intervals or there better means push email while avoiding blacklisting on ip email providers. below table structure first table notification id // autoincrement message // message sent users createdate // date created second table user_notification id // auto increment userid // id of users notification_id // id of notification first table status // 0 or 1 so whenever post added, insert notification in first table (notification) , fetch followers of group table (following) store userids , group ids. insert each user in second table (user_notification). my cron job fetchs 20 records user_notification table , fetch notification message notifica

Returning Rows from Search in Excel -

Image
i have hard time explaining things apologize in advance if things, or everything, doesn't make sense. okay, here's dilemma. have spreadsheet couple columns (shown here separated "|"): time | user | bytes sent | server id the data in sheet collected @ irregular intervals. script gets data samples cumulative amount of bytes sent "user" "server id" , puts in time sampled, goes next row. the values sorted according time. need calculate average bitrate based on time sample received , number of bytes sent. difficult part calculation should done on rows match "id" , "server" user searches for. on top of that, has automated because i'm making tech support people who, me, have limited knowledge in excel. what thinking doing searching through sheet , putting rows have matches different sheet, simple calculation on sheet average bitrate. question is, how extract rows? ok here how in excel 2007/2010. i did in tabl

report - ODS EXCEL.TAGSET title statement -

i print text before show result of proc report. ods excel.tagset. title statement. title statement limited 10 titles (title1 title2,...). need more 10 textlines @ output. how can this? have sas9.2. edit: here code example: ods tagsets.excelxp style=sasdocprinter file=_webout options(embedded_titles='yes' embedded_footnotes='yes'); title1 'title text row1'; title2 'title text row2'; ... title10 "title text &macro_var."; footnote1 'footnote text'; proc report data=lib.a; ... run; given using proc report , easiest way around may have proc report handle lines of text. in proc report , have option of doing compute before _page_ , execute prior each time page begun - suspiciously title. proc report nowd data=sashelp.class; columns sex name age height; define sex/group; define name/display; define age /display; define height/display; compute before _page_; line "title row 11"; line "title row 1

html - CSS table affecting my Navigation bar which is also a table -

my problem i'm trying create table in css without affecting navigation bar has been created table in fireworks. i've tried targeting table using id , class selectors didn't work. this table want create in css : .cart table { border-collapse: collapse; color: #999; font: 80%/1.2 'arvo', serif, sans-serif, georgia, "times new roman", times,serif; font-weight: normal; } .cart table th, td { border-right: 1px solid #fff; border-bottom: 1px solid #999; padding: .5em; } .cart table tr { background: #b0c4d7; } .cart table thead th { background: #fff; color: #fff; } .cart table th { font-weight: normal; background: #fff; } .cart table tr.alternate { background: #fff; } .cart table tr.alternate th { background: #fff; } the html code: <div class="cart"> <table> ............ info here etc............. </table> </div> the navigation bar css is:

Multiple Global Variables in Javascript -

this isn't specific problem, more theoretical question. there ever reason expose multiple global variables for single javascript application ? i can see using, , use myself, single global variable name object or class containing app can recalled multiple times (example below), can't think of case when additional global variables couldn't replaced object properties. example exposed variable makes life easier (using closure, couldn't recalled): var myglobalapp = { init: function (args) {...}, methodone: function () {...}, methodtwo: function () {...}, propertyone: 'string example' }; myglobalapp.init(arg1); myglobalapp.init(arg2); does know of instance case multiple global variables necessary? i don't think it's ever strictly necessary have multiple globals - javascript objects can arbitrarily nested, , can used namespaces. window.awesomemodule = { app: { ... }, util: { ... } }; in

java - Which thread runs all the AWT/swing event handling code? -

i new java , there interview question graduate role didn't understand, can tell me thread , purpose please. swing ui toolkit single threaded (in sense unsafe call of swing libraries other thread). ui events, both rendering , dispatching them done edt thread . so on clicking @ button on desktop. os gives notification edt receives event , triggers callback function registered button click. code, when action (for ex: repaint screen or draw image). edt delivers change os , rendered on screen. hence 2-way interaction. because mentioned swing ui toolkit single-threaded. hence advisable call of swing libraries edt usign system.invokelater. more info here .

java - Mongodb / Jongo sorting then limit, vs, limit then sorting -

are these 2 guaranteed same: collection.limit(10).sort("{score: -1}") vs collection.sort("{score: -1}").limit(10) the second 1 global sort, , returns top 10. first 1 guaranteed same, or may return 10 sorted records? thanks in normal queries, sort processed first, skip , , limit , no matter in order add them cursor object. the aggregation framework execute $sort , $skip , limit operators in order of appearance in pipeline.

C# variables, methods, reference exercise -

i have made exercise on c#, here is: class program { static double funk(int a, ref int b) { double c = + b; = 5; b = * 3; return c; } static void main(string[] args) { int = 1, b = 2; console.writeline(funk(a, ref b)); console.writeline(a); console.writeline(b); console.readline(); } so, result pretty clear when run code, gives me: 3 1 15 my question is, did 15 , 3 came from? the 3 came from: double c = + b; //... return c; this gets printed out console via first writeline . the 15 comes from: double c = + b; // c == 3 = 5; b = * 3; // b == 5 * 3 == 15 since pass in b ref , you're changing actual value of caller variable ( b in main ), gets set 15, printed out third writeline .

javascript - How to assign a variable type to variables in an object -

this question has answer here: unexpected output in javascript 5 answers here code var m = new object(); m.p1 = 37.7; m.p2 = 37.7; ... function addsubtract(pn){ switch (pn) { case 1: var amt = prompt("enter value"); if (amt != null) { m.p1 += amt; } break; } } basically when enter 1, value of m.p1 becomes 37.71 instead of 38.7 then enter 1.0 , shows 37.711.0. figured out doing concatenation rather addition. tried find way declare type can't figure out how use in variable in object. i more of c++ person , there obvious i'm missing here. can't find on google. so have assign type or there way force arithmetic addition? the result of prompt() string. if add number string, number converted string , concatenation performed. to convert string float use 1 of following: var am

c# - asp.net stored procedure insert multiple pairs of data into the DB -

i have method accepts int[] (userids) , int (groupid) parameters. runs stored procedure , insert data db for example: if userids=[1,2,3] , groupid=4, want following data inserted db userid groupid 1 4 2 4 3 4 i have 2 solutions problem. first 1 write stored procedure insert single record db. in method(), loop through int[] , call stored procedures n times method() (int =0; i< userid.length; i++){ // call stored procedure insert single record } the second solution pass int[] , int parameters stored procedures , looping in stored procedure. which way better solution? ( if 2nd solution better, can provide guidance on handling int[] in stored procedure ) is there reason why don't want use o/r mapper? example looks server / code-behind , can use entity framework (or other) insert new values. if can't use them use ( 2nd in posting) approach. it's dangerous, because not within transaction. you can start entit

configure maven site plugin for multi generational projects -

i have company pom, aggregator parent pom, , children. company pom has distributionmanagement url allows deploy site. however, when aggregator , children inherit it, creating incorrect paths. example: api-docs/company-pom/1.4-snapshot/../../procject-webservice/2.0/procject-parent/procject-webservice what right way configure company pom, , aggregator, end this: api-docs/company-pom/1.4-snapshot/ api-docs/procject-parent/2.0/ api-docs/procject-webservice/2.0/ (no, company pom not deploying @ same time project)

haskell - Typeably casting GADTs -

let's i'm writing dsl , want have support both phantom type support , badly typed expressions. value types might be {-# language gadts, datakinds #-} data ty = num | bool deriving (typeable) data val vnum :: int -> val num vbool :: bool -> val bool and can work phantom erased version {-# language existentialquantification #-} data valunk = forall . valunk (v' a) now, can operate on values of valunk case ing out both vnum , vbool , reestablish phantom types in way getnum :: valunk -> maybe (val num) getnum (valunk n@(vnum _)) = n getnum _ = nothing but feels i'm reimplementing typeable machinery. unfortunately, ghc won't let me derive typeable val src/types/core.hs:97:13: can't make derived instance of `typeable (val a)': val must have arguments of kind `*' in data declaration val is there way around restriction? i'd love write getit :: typeable => valunk -> maybe (val

asp.net - asp:treeView hiding the /- button? -

i have treeview in app i'm making. changed parent nodes expand when clicked using selectaction propery, i'd remove +/- expansion button. tried setting navtree.showexpandcollapse = false; disabled expansion ability of parent nodes. does how remove +/- button without messing node's select action event? thanks here's cs protected void page_load(object sender, eventargs e) { service1 myservice = new service1(); // //populate site menu gridview sites = new gridview(); sites.datasource = myservice.getallsites(); sites.databind(); foreach (gridviewrow siterow in sites.rows) { treenode parentnode = new treenode(siterow.cells[1].text); parentnode.selectaction = treenodeselectaction.expand; parentnode.collapse(); navtree.nodes.add(parentnode); treenode childnode = new treenode(siterow.cells[2].text); childnode.navigateurl = "http:

php - Save Indexed Array -

i trying figure out how save indexed array field in database. said, know array can't saved database, can serialize or implode , save. im not sure 1 should using though. don't want collection of items saved in 1 cell. need list of items saved 1 one in column. question need using serialize method, implode or else? here glimpse of code , array trying save. public function findpolicyids($coverageid = null) { $policyid = $this->policy->find('all', array( 'recursive' => -1, 'conditions' => array('policy.coverage_id' => $coverageid), 'fields' => array('policy.id'))); foreach($policyid $id) { $all[] = $id['policy']['id']; } return $all; } array ( [0] => 5202834f-111c-4a76-8b33-1ed8ae78509d [1] => 5202834f-2ba8-4957-91db-1ed8ae78509d [2] => 5202834f-356c-49a1-beeb-1ed8ae78509d [3] => 5202834f-3b40-453f-a491-1ed8ae785

sqlite - What is the "best practice" way to keep a database reference in an Android app? -

i'm using common database of app (which consists of multiple activities , multiple fragments). imagine pretty standard, i'm asking more general question. "best" way (and why) keep track of database? i planning on using static variable in helper class (as limited understanding of activity lifecycle means main activity can nuked later, that's not safe place leave it). option use asynctask database reference "fresh" every time need (which how i'm doing first time). don't think can send using extras , don't know of tricks make serializeable. are there other options i'm missing? i've seen references using application, i'm not familiar those. i planning on using static variable in helper class that, or contentprovider wrapper around database, 2 typical approaches. as limited understanding of activity lifecycle means main activity can nuked later, that's not safe place leave it moreover, since ha

apache - Parse CSS file as PHP -

so, moved new host. using code in htaccess parse css files php. in new host, didn't work. googled , googled , tried every code find. single of them didn't work. here's of codes i've tried: addhandler application/x-httpd-php .css addhandler application/x-httpd-php5 .css addhandler application/x-httpd-php53 .css addtype application/x-httpd-php .css my php version 5.3.22 , webhost using linux. didn't work. please help. from parse js/css php file using htaccess you should need add htaccess <filesmatch "\.css$"> sethandler application/x-httpd-php header set content-type "text/css" </filesmatch> if you're getting 500 internal server error header line, make sure have mod_headers enabled in apache config, if mod_headers not installed , provider not install/enable it, need rename css file .php , add new php file header("content-type: text/css");

linux - c++ timer implemetation - Assigning a member function to signal callback function pointer -

hi have been tryng implement timer using posix timer libs, making mistake in implemetation, using example web , tryng encapsulating in class but, compiler doesnt it, tryng asign callback function int sigev.sigev_notify_function = timer0_irqhandler; cannot result. here goes code: the class definition: #include <sys/time.h> #include <pthread.h> #include <signal.h> #include <time.h> #include <stdlib.h> #include <stdio.h> //se agrego para eliminar el siguiente warning del compilador //warning: incompatible implicit declaration of built-in function 'memset' #include <string.h> /* memset */ #include <unistd.h> /* close */ #define timeval_max 0xffffffff #define timeval unsigned int // timer incrementing every 4 us. //#define ms_to_timeval(ms) (ms * 250) //#define us_to_timeval(us) (us>>2) // timer incrementing every 8 us. #define ms_to_timeval(ms) ((ms) * 125) #define us_to_timeval(us) ((us)>>3) class timer { pu

Android SQLite Create Multiple Tables Error -

im having weird crash when creating multiple sqlite tables... the code works fine if comment out line execute create_movements_table. the first table created without problem, if try create both, app crashes. the weird thing is: if test app on phone without creating second table, works fine, ... if test again (with app installed), 2 sql statements, (creating both tables), app works... problem occurs when app not present @ in phone import android.content.contentvalues; import android.content.context; import android.database.cursor; import android.database.sqlite.sqlitedatabase; import android.database.sqlite.sqliteopenhelper; import java.util.arraylist; import java.util.list; public class databasehandler extends sqliteopenhelper { private static final int database_version = 1; private static final string database_name = "clientsmanager"; private static final string clients_table = "clients"; private static final string movements_table

is the notion of a Table required at all in Azure Table service? -

i working azure table services. ask whether azure internals care notion of table @ all? making things fast largely depend on partition key , row key. tables not containers or grouping of entities because there no limit on number of tables can create. total storage size tied storage account. so table notion people transition rdbms land or serve purpose internally? can applications single table design without worrying performance? after all, if table tag may include part of partition key. edit to give example, table partition keys cassandra rows , table rows cassandra columns. okay treat storage big bucket of key(rowkey)-value pairs. partition keys sharding mechanism. table comes across "labeling" notion. you can have entities in single azure table storage , optimum performance thoughtfully choosing right partition key , row key combination, imho time better have related entities each in separate table easy manageable ( developer perspective) . know part o

c - K&R 2-8 rightrotate (length of integer in bits) -

write function rightrot(x,n) returns value of integer x rotated right n operations i can't see how can bits , put them in right position without requiring length of x(the amount of bits). am thinking wrong or need length of x somehow? if so, how go getting length of x? the code below wrong probaply way, put length_x in demonstrate problem. i hope can point me in right direction. #include <stdio.h> unsigned rightrot(unsigned x, int n); main() { unsigned x = 75; int p, n, y; p = 5; n = 3; y = 45; printf("%u\n",rightrot(x,n)); } unsigned rightrot(unsigned x, int n) { oldn = (x & ~(~0 << n)) << length_x; x = x >> n | oldn; return x; } try: unsigned int rrot(unsigned int x, int n) { int len; (len=31;len>=0 && !((1 << len) & x);len--); len++; return ((x >> n) | (x << (len - n)) & ((1 << len) - 1); } the loop sho

Formatting numerals and dates in other locales in C#/.NET -

in application i'm writing want display current date , time, in english, in other locales. for example russian, arabic , chinese. // datetime.tolongdatestring doesn't support iformatprovider parameter datetime.now.tostring("dddd, d mmmm, yyyy", new cultureinfo("en-us")); // "wednesday, 7 august, 2013" datetime.now.tostring("dddd, d mmmm, yyyy 'r.'", new cultureinfo("ru-ru")); // "среда, 7 августа, 2013 r." works fine... datetime.now.tostring("dddd٫ d mmm٫ yyyy", new cultureinfo("ar")); // "الأربعاء٬ 30 رمضان٬ 1434" seems work fine. however... i'd show numerals (eastern) arabic numerals, not latin/arabic numerals. though of course solved doing simple substitution ('٠‎' '0', 1 '١' etc). but there's chinese: datetime.now.tostring("yyyy年m月d日dddd", new cultureinfo("zh-cn")) // "2013年8月7日星期三" chinese nu

c++ - Reducing QListView to the common elements in the list? -

is there methode or simple approach this? given list with: d b b c d d i want list reduced to: a b c d otherwise write process in background. it depends on how data storen , passed view. generally, simpliest way remove duplicates list of element converting set: qstringlist values; //... qset<qstring> set = values.toset(); after can convert set list using tolist or iterate on set using usual foreach loop. note qset unordered. if want sort strings, convert set list , sort list using qsort .

403 forbidden on wordpress index with nginx, the rest of the pages work fine -

i'm setting blog on new ec2 instance because 1 of sites on server that's hosting being ddosed. i'm having trouble nginx, because can either see pages fine 403 on index, or see index 404 on pages (depending on config i'm using) here's nginx config: server { listen 80; server_name www.test.com; server_name test.com; root /www/blog; include conf.d/wordpress/simple.conf; } and simple.conf: location = /favicon.ico { log_not_found off; access_log off; } location = /robots.txt { allow all; log_not_found off; access_log off; } location / { # cool because no php touched static content. # include "?$args" part non-default permalinks doesn't break when using query string try_files $uri $uri/ /index.php?$args; } location ~ \.php$ { #note: should have "cgi.fix_pathinfo = 0;" in p

c - When uses unsigned data type? -

this question has answer here: signed versus unsigned integers 15 answers when need use unsigned data type , when signed data type in c? , want know why , how decide 1 need. use signed data types when need variable hold negative values. careful overflows, signed integer overflows result in undefined behavior. use unsigned data types when know variable holds non-negative values, or bit patterns. generally, can hold higher maximum value signed data type of equal size. unsigned integer overflows wraparound.

Updated zurb-foundation gem from 4.2.3 to 4.3.1 - Orbit no longer works -

i updated zurb-foundation gem 4.2.3 4.3.1 - orbit no longer works. the dots show , cycle, no images displayed. i need either new version working, or revert previous version worked. <div id="featured"><ul data-orbit> <li><img src="http://placehold.it/1200x500&text=slide image 1" alt="slide image"> <div class="orbit-caption">caption 1</div> </li> <li><img src="http://placehold.it/1200x500&text=slide image 2" alt="slide image"> <div class="orbit-caption">caption 2</div> </li> <li><img src="http://placehold.it/1200x500&text=slide image 3" alt="slide image"> <div class="orbit-caption">caption 3</div> </li> </ul></div> is html code. i'm using default css styl

angularjs - Why is the datepicker opening automatically? -

Image
with below code, datepicker open , don't see input area: html: <td ng-controller="notificationmodalcontroller"> <span><strong>end date</strong></span> <input type="text" name="notification.text" ng-model="notification.text" datepicker=""> </td> js: app.directive('datepicker', function () { return { require: 'ngmodel', link: function (scope, el, attr, ngmodel) { $(el).datepicker({ autoclose:true, onselect: function (datetext) { scope.$apply(function () { ngmodel.$setviewvalue(datetext); }); } }); } }; }); i'm using theme in case matters: http://wrapbootstrap.com/preview/wb0t41tx4 why datepicker open? i'd behave 1 in theme sample closest i've gotten: the bootstraper datepicker dont provide method onselect. try inst

How to deploy in a gwt-maven project -

first of all, i'm not sure folders , files have deploy in gwt-maven project i've got: .gwt .settings bin src/main/java target war pom.xml i'm pretty sure, i've deploy pom.xml somehow , target folder. target folder doesn't contain pom.xml need deploying on jetty server second: i've installed maven on webserver, apart embedding jetty-maven-plugin in pom.xml (by org.eclipse.jetty jetty-maven-plugin ) have absolutely no clue how project running on jetty server. http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 siedlervoncatanc siedlervoncatanc war src/main/java src/main/java * / .java maven-compiler-plugin 3.1 1.7 1.7 </pl

python - Using pygame2exe and having font issue with sysfont/.ttf -

i tried py2exe, cx_freeze , got using site, made progress pygame2exe. read 2 or 3 other posts dealing this, despite having setup file same instructed, , putting in freesansbold.ttf still 'has requested runtime terminate in unusual way' error. i go details, strange if set text standard thing "arial" suggested here ( pygame distribution - runtime error ) , app creates work, problem game rpg, , if text not freesanbold spills everywhere , unreadable, basicly have have text. here how had font code initially: font=pygame.font.sysfont(none, 48) changed to: font=pygame.font.sysfont("freesansbold.ttf", 48) , included .ttf in folder, no avail. again if change 'arial' pygame2exe creates working file, need freesanbold because of text issues. here pygame2exe code, copied wiki: def issystemdll(pathname): # checks if freetype , ogg dll files being included if os.path.basename(pathname).lower() in ("libfreetype-6.dll", "libogg-0.dl

c# - Ignore duplicate key insert with Entity Framework -

i'm using asp.net mvc4 entity framework code first. have table called "users", primary key "userid". table may have 200,000+ entries. i need insert 50 users. might like foreach(user user in newusers){ context.add(user); } dbcontext.savechanges(); the problem is, 1 or more of new users might exist in db. if add them , try save, throws error , none of valid ones added. modify code this: foreach(user user in newusers){ if(dbcontext.users.firstordefault(u => u.userid) == null) { dbcontext.users.add(user); } } dbcontext.savechanges(); which work. problem is, has run query 50 times on 200,000+ entry table. question is, performance efficient method of inserting these users, ignoring duplicates? you can this: var newuserids = newusers.select(u => u.userid).distinct().toarray(); var usersindb = dbcontext.users.where(u => newuserids.contains(u.userid)) .select(u => u.userid).toarr

jquery - Adding images to random divs each time -

i asked question made long , not specific enough here again. i creating game fun found instructions how online. there 12 cards images facedown click on 2 cards , if images match stay faced , win 2 points untill find matches. what need add each image random location, twice! need generate random locations each image , add images correct corresponding location in page. can think of game board 4 x 3 grid. each empty in "row" gets 1 image.the problem having 1 image being choosen @ random , not 6 choosen twice @ random here jsfiddle: http://jsfiddle.net/26pda/1/ here images : http://efreeman.userworld.com/jquery/images/cheese.gif http://efreeman.userworld.com/jquery/images/eggs.gif http://efreeman.userworld.com/jquery/images/kitchen_blender.gif http://efreeman.userworld.com/jquery/images/tea.gif http://efreeman.userworld.com/jquery/images/kitchen_collander.gif http://efreeman.userworld.com/jquery/images/kitchen_teapot.gif here html: <!doctype html> <html&

javascript - Literal dollar sign in a regular expression -

i working canada (fr-ca) locale , trying following: var str = "<dataset >{1}</dataset>"; var temp = "<set cost x = '1,8m $' />"; str = str.replace(/\{1\}/g, temp); output: "<dataset ><set cost x = '1,8m </dataset>" /></dataset>" desired output: "<dataset ><set cost x = '1,8m $'" /></dataset>" replace function misunderstanding $ ' '1,8m $' expression , hence repeating in output. ideas/workaround? thank time. $' has special meaning in replacement string when using js regular expressions: inserts portion of string follows matched substring. literal dollar sign in replacement string, use $$ . see https://developer.mozilla.org/en-us/docs/web/javascript/reference/global_objects/string/replace .

excel vba - VBA using Rows() -

i need syntax on one. have created integer variable called totaldata hold # of rows data. want format rows, using rows("5:totaldata").select cannot use "totaldata" in rows function. can please me figure out way can select of these rows can format them correct size , font. thanks. rows("5:" & totaldata).select note totaldata must > 0 note added note because stackoverflow said answer short.

html - How can I "simulate" directories on a server? -

say go example.com/testing/1/2/3. don't want request directory "/testing/1/2/3", want pass part of url script (presumably example.com/index.php). i don't know if works described, reason ask because in wordpress, in "permalink settings", have option change url scheme http://example.com/2013/08/sample-post/ , when navigate url shows post. however, doesn't create of directories, or directories matter. i'm wondering how works because i'd use in other places. seems commonplace (i doubt url shorteners have hundreds of thousands of directories @ root of domain , use instead), i'm not sure called or how find more information , hoping point me in right direction. thanks.

python - os.urandom or ssl.RAND_bytes? -

os.urandom or ssl.rand_bytes : when generating random bytes cryptographic purposes, more recommended? if neither 1 better, tradeoffs , expected each in terms of differences? note ssl.rand_bytes exists in python 3. ssl.rand_bytes needs seeded before can used. cannot rely on ssl.rand_bytes alone. both os.urandom , `ssl.rand_bytes pseudo random number generators. prng's deterministic; when seeded same data, return same stream of pseudo random number bytes. these bytes should indistinguishable true random if observer not know seed value. os.urandom (re-)seeded using source of entropy within operating system. using os.urandom should therefore preferred on ssl.rand_bytes . first of all, seeded (and reseeded operating system). furthermore, not require additional dependency on ssl library. drawback performance. faster use ssl.rand_bytes seeded big enough value os.urandom os.urandom requires system call time retrieve data.

html - javascript disable a single radio button -

i have should problem simple solution, , i'm sure i'm missing something. i have 2 columns of radio buttons, , when radio button column clicked, need disable corresponding radio button opposite column, can't selected. if button selected, re-enable previous button , disable new opposite selection. i have given radio buttons unique id. first1, first2, etc. column one, , second1, second2 etc. column two. the way headed towards won't work after re-thinking this, , after searching online hour, haven't found non-jquery way of doing it. possible javascript? what had far, , know i'm way off base, i'm burnt out different problems i've had page: function disableform(theform, theradio) { //this start does't save valid disabled fields //it enables if (document.all || document.getelementbyid) { (i = 0; < theform.length; i++) { var formelement = theform.elements[i]; if (true) { formelement.dis

Will installing Visual Studio 2013 Preview mess up 2012? -

i’m developing visual studio 2012, , wondering – environment messed installing visual studio 2013 preview? the known issues visual studio 2013 preview imply installing safe . 1 of issues “the remaining visual studio application broken after uninstall visual studio 2013 preview or visual studio 2012” : symptoms consider following scenario: [basically, have installed vs 2013 preview] in scenario, when uninstall visual studio 2012 or visual studio 2013 preview, application not uninstalled broken. workaround to work around issue, repair visual studio application remains on computer. it says application broken when uninstall other one. implies before that, when both installed, unbroken , working fine. that issue nothing worry about, long remember repair remaining visual studio application after uninstalling another.

xml - Parsing RSS CDATA text outside of tags with PHP -

i know versions of question has been asked before, i've got specific problem in version. i'm attempting pull text inside rss feed thats imbedded inside cdata, outside xml tags. here's rss file: <?xml version="1.0"?> <?xml-stylesheet type="text/xsl" href="/rss/ndbcrss.xsl"?> <rss version="2.0" xmlns:georss="http://www.georss.org/georss" xmlns:dc="http://purl.org/dc/elements/1.1/"> <channel> <title>ndbc - station 46042 - monterey - 27nm wnw of monterey, ca observations</title> <description><![cdata[this feed shows recent marine weather observations station 46042.]]></description> <link>http://www.ndbc.noaa.gov/</link> <pubdate>wed, 07 aug 2013 21:06:45 ut</pubdate> <lastbuilddate>wed, 07 aug 2013 21:06:45 ut</lastbuilddate> <ttl>30</ttl> <language>en-us</language>

multithreading - C# Timer.Interval Pattern with 40ms? -

i'd use 3 or 4 c# timers interval 40ms (to work image data 1000/25 = 40). according msdn seems pattern perform task every 40ms. default interval 100ms. in real life, i'd know if 40ms still ok ? or if should use thread design pattern ? wakeup/sleep behavior near cpu free ? there no special relevance 100 msec default, can change needed. you need pick values if want interval that's consistent 1 machine another. accuracy of timer class affected default operating system clock interrupt rate. on windows machines, interrupt occurs 64 times per second. equal 15.625 milliseconds. there machines have higher rate, go low 1 msec. side-effect of other programs changing interrupt rate. timebeginperiod() winapi function , has global effect. so best intervals pick ones multiple of 15.625 , stay below that. chosen interval repeats on machine. makes choices: 15 31 46 62 etc. your best bet aiming near 40 msec therefore 46. accurate 1.4% on machine. p

Associating responses with specific requests using Loopj Android Asynchronous Http Client -

i'm using loopj android asynchronous http client send multiple http requests asynchronously. i'm using static asynchttpclient suggested , sending multiple http posts , receiving responses on anonymous class. problem when request comes don't know how tie original request. for instance, in caching situation, when send post , receive 200 ok need able know request response can mark sent. try this: public class myasynchttpresponsehandler extends asynchttpresponsehandler { private string requestid; public asynchttpresponsehandler(string requestid) { this.requestid = requestid; } @override public void onsuccess(string arg0) { super.onsuccess(arg0); // use requestid here } } sending request: client.get(url, new myasynchttpresponsehandler(requestid))

html5 - Why is .ico preferred over .png for favicons? -

i noticed inadvertently saved favicon png. , nothing bad happened. what gained saving .ico . way done ( i've looked @ many favicon links in other web-apps ), i'm trying understand @ deeper level. i'm saving @ 32px 32px. here boiler plate. <link id='file_icon' rel='icon' href = 'foo/foo.png'> compared to: <link id='file_icon' rel='icon' href = 'foo/foo.ico'> mainly because .gif , .png files don't work favicons in internet explorer. also, .ico format allows store customized versions @ different resolutions, i.e. 16x16, 32x32, 64x64 pixels, , various color depths (16, 24 or 32 bits), insuring best possible available icon, regardless of size or color depth available in browser. http://www.photoshopsupport.com/tutorials/jennifer/favicon.html

ios - How to quickly print out all the properties in a NSObject and its derivatives? -

say, have object of uicolor, can print out debug information of property information? i need print properties red, blue, green components. if log uicolor object so: uicolor *color = [uicolor redcolor]; nslog(@"%@",color); it output uidevicergbcolorspace 1 0 0 1 represents rgba value of color object. these numbers range 0 1.

vim - moving text to next line in vi -

there line in shell script f) screen = true and want make it f) screen = true i cannot in vi. in normal text editor enter command can shift text after f) next line. best way in vi? press l move cursor right , j move cursor down cursor s. press i "insert" , hit enter create new line. hit esc stop inserting , :wq save , quit. there lots of basic vi command lists on internet might help.

PHP String Function, How can I isolate what is in the last set of parens? -

i have write string function takes whatever in last parens , put new variable, without parens. in case, ups next day air. $oldvar = 'united parcel service (1 pkg x 4.00 lbs total) (ups next day air)'; $newvar = 'ups next day air'; thanks!, the following code sets $newvar correct string if there matching parens in $oldvar , false otherwise. $oldvar = 'united parcel service (1 pkg x 4.00 lbs total) (ups next day air)'; $poslastopeningparenthesis = strrpos($oldvar, '('); if ($poslastopeningparenthesis === false) { $newvar = false; } else { $poslastopeningparenthesis++; // move position behind opening parenthesis $poslastclosingparenthesis = strpos($oldvar, ')', $poslastopeningparenthesis); if ($poslastclosingparenthesis === false) { $newvar = false; } else { $newvar = substr($oldvar, $poslastopeningparenthesis, $poslastclosingparenthesis - $poslastopeningparenthesis); } }

Adapter pattern without the use of interfaces -

i'm trying understand if adapter pattern implementation dependent on interface realizations. read, should use adapter when need convert interface of class interface clients expect. i have been told classic example of 3 pronged plug using adapter connect 2 pronged plug... so, understand, if method in class has method specific paramater signature, , want wrap logic require more (or less) paramaters, should implement adapter pattern. from examples iv'e seen, proper way create adapter class realizes interface desired method signature, , hold adoptee member in adapter class. then, can call adpotee method through realized interface method , input logic. the question is, if need use 1 adoptee class, why use interface? not simpler drop interface bit , hold adoptee member , implement desired logic in "stand alone" method? is required realize interface method here adapter pattern valid? public class poststatusadapter { public interface ipoststatus {

java - Searching LinkedHashMap, faster method than sequential? -

i wondering if there more efficient method getting objects out of linkedhashmap timestamps greater specified time. i.e. better following: iterator<foo> = foo_map.values().iterator(); foo foo; while(it.hasnext()){ foo = it.next(); if(foo.get_timestamp() < minstamp) continue; break; } in implementation, each of objects has 3 values: "id," "timestamp," , "data." objects insterted in order of timestamps, when call iterator on set, ordered results (as required linked hashmap contract). map keyed object's id, can lookup them id. when them timestamp condition, however, iterator sorted results. improvement on generic hashmap, still need iterate sequentially on of range until find next entry higher timestamp specified one. since results sorted, there algorithm can pass iterator (or collection to), can search faster sequential? if went treemap alternative, offer overall speed advantages, or doi

php - how to get the '0' entry in object -

i have following object: stdclass object ( [0] => stdclass object ( [img_id] => 56 [img_name] => 5c9eeb51930ebe222ab26895dab7c348.png ) ) it being dumped variable called $image_names. trying entry [0]. i have tried: $image_names->0 error: syntax error, unexpected t_lnumber i tried $image_names[0]. realize should not work, thought give try. not return error. but, not return data. in object structure, how object associated key [0]? same always. $image_names->{'0'}

asp.net - Delay of loading of cached WebResource.axd -

Image
i seeing strange behavior not make sense me. have web page takes around 1.5seconds load. however, 0.5 seconds of time there delay before webresource.axd file loaded. contains few styles related telerik rad editor. curious if know why there 0.5 second delay before webresource.axd loaded. can see retrieving browser cache.

.htaccess rewrite rule to prevent image url rewrites -

i new htaccess rewrite rules. need rewrite url myurl.com/1000/samsung-123 myurl.com/user/product.php?id=1000 . have used following rewrite rule in .htaccess file. rewriteengine on rewritebase / rewriterule ([0-9]+)/(.*)$ user/product.php?id=$1 [pt,l] the rule works fine. rewrites images url myurl.com/img/_product/1000/1000a.jpg . how can prevent one? there way skip rule if extension (as .jpg , .png , .php ) entered in url? rewriteengine on rewritebase / rewritecond img/_product/$1/$1a.jpg !-f rewriterule ([0-9]+)/(.*)$ user/product.php?id=$1 [pt,l] perhaps help. fixed.