Posts

Showing posts from February, 2013

.net - Correct this LINQ instruction syntax -

i list files of directory , sort file extension: dim files list(of io.fileinfo) = get_files(directory, true, validextensions).orderby(function(x) x.extension).tolist how can add in same instruction parameter sort name content this?: x.name.tolower.contains("word") i've tried separate comma (yes, stupid): dim files list(of io.fileinfo) = get_files(directory, true, validextensions).orderby(function(x) x.extension, x.name.tolower.contains("word")).tolist update i've tried use @p.s.w.g solution not return desired result. but if make 2 lists separate desired sort in second list: dim files list(of io.fileinfo) = _ get_files(directory, true, validextensions).orderby(function(x) x.extension).tolist dim files2 list(of io.fileinfo) = _ files.orderby(function(x) x.name.tolower.contains("word")).tolist but want improve doing in first list. use thenby method: dim files list(of io.fileinfo) = _ get_files(directory, tru

mongodb - Node.js - App will only load one user on Heroku -

i have app works on dev, when try on heroku, load 1 user. doesn't matter logs in, "guestuser" signed in, , therefore whoever logs in gets see 'guestusers' data. first go @ real node app. here code: /** * module dependencies */ var express = require('express'), routes = require('./routes'), api = require('./routes/api'), http = require('http'), path = require('path'), mongoose = require('mongoose'), passport = require('passport'), localstrategy = require('passport-local').strategy; var app = module.exports = express(); var uristring = process.env.mongolab_uri || process.env.mongohq_url || 'mongodb://localhost/hellomongoose'; mongoose.connect(uristring, function (err, res) { if (err) { console.log ('error connecting to: ' + uristring + '. ' + err); } else { console.log ('succeeded connected to: ' + uristring); } });

php - twitter api 1.1 statuses/user_timeline -

i had written original code 1.1 using abrhams twitteroauth , oauth.php in late 2012 , code using /1/ endpoint. worked fine in connect, authorized, long term token, updates , tweet... no problems. when 1.0 sunsetted functionality broke (duh!) , took long time end on desk. first thing did change api /1/ /1.1/ , we're working... mostly... there problems: problem 1: i'm authorizing, getting token etc. can login test account (@test1) , manually tweet, tweet picked via statuses/update , processed according our needs. if tweet directed specific user (@test2) statuses/update on test2 never detects incoming tweet although seen on twitter @ tab "interaction". $twitter = new twitteroauth(consumer_key, consumer_secret, $access_token['oauth_token'], $access_token['oauth_token_secret']); $params = array('screen_name' => $tw_name, 'include_entities' => "true",

r - Split text string in a data.table columns -

i have script reads in data csv file data.table , splits text in 1 column several new columns. using lapply , strsplit functions this. here's example: library("data.table") df = data.table(prefix = c("a_b","a_c","a_d","b_a","b_c","b_d"), value = 1:6) dt = as.data.table(df) # split prefix new columns dt$px = as.character(lapply(strsplit(as.character(dt$prefix), split="_"), "[", 1)) dt$py = as.character(lapply(strsplit(as.character(dt$prefix), split="_"), "[", 2)) dt # prefix value px py # 1: a_b 1 b # 2: a_c 2 c # 3: a_d 3 d # 4: b_a 4 b # 5: b_c 5 b c # 6: b_d 6 b d in example above column prefix split 2 new columns px , py on "_" character. even though works fine, wondering if there better (more efficient) way using data.table . real datasets have >=10m+ rows, time/m

c# - Remove duplicate items in the ListBox -

i need delete items in wpf listbox, use code : while (listbox.selecteditems.count > 0) { listbox.items.remove(listbox.selecteditem); } but problem listbox contains several same items, example : chocolate milk orange milk banana apple milk if select 2nd occurence of milk @ 4th position , try delete given code, remove first occurence of milk @ 2nd position (not selected) , selected 2nd occurence of milk @ 4th position. i have tried : while (listbox.selecteditems.count > 0) { listbox.items.removeat(listbox.items.indexof(listbox.selecteditem)); } but result same. could give me clue on ? try this if (listbox.selecteditem != null) { listbox.items.removeat(listbox.selectedindex); }

ember.js - RestAdaptor and API Structure -

Image
i'm newbie ember data , i've done date fixture data today i'm trying graduate real deal , realising don't know enough how connect model , api's call signature. specifically i'd able call endpoint get /activities/[:user_id]/[date] . load array of "activity" objects given date. know can offset api's directory with: ds.restadapter.reopen({ namespace: 'api' }); in case api prefix appropriate. think should able date component solved setting route this: this.resource('activities', { path: '/activities' }, function() { this.route('by_date', {path: '/:target_date'}); }); the above educated guess because i'm @ loss on how user_id component url signature. can help? there tutorials or examples of basic ember data use cases? also, because know i'm going run next ... how 1 add parameters url string (aka, /foobar?something=value) versus parameters url (like above)? -=-=-=-=-=-=-=-=-=-=-

postgresql - Get repeated values -

Image
i have table this: i need numbers, wich repeated in different citys , these citys quantity each number. that table, need result: number | repeated citys quantity ---------- 222 | 2 because number 222 repeated in 2 different city. i have solution: 1) greate function returns unique values array, example array_unique() 2) , then: select number, array_length(uniq_city_list, 1) ( select number, array_unique(array_agg(city)) uniq_city_list mytable group number ) t array_length(uniq_city_list, 1) > 1 but, may there better solution doing this? think not optimal query... select number, count(*) ( select number, city t group number, city ) s group number having count(*) > 1 order number

Java - what is a a prototype? -

Image
in lecture on java, computer science professor states java interfaces of class prototypes public methods, plus descriptions of behaviors. (source https://www.youtube.com/watch?v=-c4i3gfye3w @8:47) and @ 8:13 in video says go discussion section teaching assistants learn means prototype. what "prototype" mean in java in above context? i think use of word prototype in context unfortunate, languages javascript use called prototypical inheritance totally different being discussed in lecture. think word 'contract' more appropriate. java interface language feature allows author of class declare concrete implementations of class provide implementations of methods declared in interfaces implement. it used allow java classes form several is-a relationships without resorting multiple inheritance (not allowed in java). have car class inherits vehicle class implements product interface, therefor car both vehicle , product.

extjs - Cloning filefiled in change function -

Image
i have form include filefield like; is possible? filefile can clone (with file attached) in change function ( if possible, can change attribute textfield,..?) here filefile http://jsfiddle.net/23tjk/ items: [{ xtype: 'filefield', name: 'file', fieldlabel: 'upload', labelwidth: 50, msgtarget: 'side', allowblank: false, anchor: '100%', listeners:{ 'change': function(f, value){ form.add([f]); // nothing run } } }], you can create field variable: var ffield = { xtype: 'filefield', fieldlabel: 'upload', name: 'file[]', //<-------- labelwidth: 50, msgtarget: 'side', allowblank: false, anchor: '100%', listeners:{ 'change': { fn: function(f, value) { form.add(ffield); }, single:

python - Passing variables between two WxPython windows -

so im writing program , need list main gui window pop window action selected options main window the problem cant pass variable when call class new window when create instance want pass list act = action(none, "action") but lets me pass name of window , if try create new parameter error: traceback (most recent call last): file "c:\documents , settings\user\desktop\invent manager.py", line 274, in auction act = action(none, "action", "item") file "c:\documents , settings\user\desktop\invent manager.py", line 352, in __init__ self.initui() file "c:\documents , settings\user\desktop\invent manager.py", line 357, in initui main = gui() typeerror: __init__() takes 4 arguments (1 given) here init of pop window: def __init__(self, parent, title, item_id): super(action, self).__init__(parent, title=title, size=(200, 200)) self.initui() self.centre()

php - Join two tables with one table has multiple rows matching -

trying figure out if possible create query join tables, table 1 smaller table two, table 2 has multiple references matching table 1 entries, query output joining table 1 length preserved add more columns. not sure if makes sense here example of after table 1 table 2 +-----------------------------+ +-----------------------------+ | id | english | definition | | id | word_id | sentence | +-----------------------------+ +-----------------------------+ |1 | a1 | blah | |1 | 1 | blahblah1 | |2 | b4 | blah2 | |2 | 1 | blahblah2 | +-----------------------------+ |3 | 1 | blahblah3 | |4 | 2 | blahblah4 | |5 | 2 | blahblah5 | +-----------------------------+ ********* query should retu

sql - Trigger after update not working -

i'm struggling 'after update' trigger work properly. as seen simple query, sum of production_work matches sum of order elements. # select ident,ud,dp,swrv,sh,jmsw,sw,prrv,mhsw,bmsw,mp,pr,st,completed orders; ident | ud | dp | swrv | sh | jmsw | sw | prrv | mhsw | bmsw | mp | pr | st | completed -------+----+----+------+----+------+----+------+------+------+----+----+----+----------- 2 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | f (1 row) # select * production_work; ident | order_id | producer_id | day | ud | dp | swrv | sh | jmsw | sw | prrv | mhsw | bmsw | mp | pr | st -------+----------+-------------+------------+----+----+------+----+------+----+------+------+------+----+----+---- 5 | 2 | 1 | 2013-08-09 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 6 | 2 | 2 | 2013-08-09 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 (2 rows) i

Error using module in angularJS -

i new angular.js , have problem. please me resolve it. have created simple screen using controller , module in example. doesnt work. have presented example follows : my html file :- <!doctype html> <html ng-app="ayan"> <head> <script type="text/javascript" src="hotel_listing_angular.js"></script> <script type="text/javascript" src="http://code.angularjs.org/1.0.6/angular.min.js"></script> <title>insert title here</title> </head> <body> <div ng-controller="mycontroller"> <ul> <li ng-repeat="contact in htllist"> {{ contact.name }} </li> </ul> </div> </body> </html> and js file follows :- var ayan=angular.module('ayan',[]); ayan.controller('mycontroller',function ($scope) { $scope.htllist = [ {name:"picard&qu

android - Blank Screen during facebook login -

Image
i using facebook login in application , working fine, problem when click login button, shows blank screen moment, want use own asynctask instead of facebook. here code. ublic class sdloginactivity extends activity { private static final string tag = sdloginactivity.class.getsimplename(); private imagebutton imgbtnfacebooklogin; private textview tvuserdetails; private int counter = 0; private session.statuscallback statuscallback = new sessionstatuscallback(); // --------------------------------------------------------------------- @override public void onactivityresult(int requestcode, int resultcode, intent data) { super.onactivityresult(requestcode, resultcode, data); utilities.showtoast(sdloginactivity.this, "data == " + data); session.getactivesession().onactivityresult(this, requestcode, resultcode, data); } // --------------------------------------------------------------------- @override protected void oncreate(bundle savedinstancestate) {

c++ - Calling Windows shell menu (same as right-click in Explorer) for multiple files programmatically -

i'm trying display shell context menu file (same when right-click file in explorer) programmatically. i've managed single file / folder, code below. now, how can call context menu list of files, if have selected couple in explorer , clicked them? bool openshellcontextmenuforobject(const std::wstring &path, int xpos, int ypos, void * parentwindow) { assert (parentwindow); itemidlist * id = 0; std::wstring windowspath = path; std::replace(windowspath.begin(), windowspath.end(), '/', '\\'); hresult result = shparsedisplayname(windowspath.c_str(), 0, &id, 0, 0); if (!succeeded(result) || !id) return false; citemidlistreleaser idreleaser (id); ishellfolder * ifolder = 0; lpcitemidlist idchild = 0; result = shbindtoparent(id, iid_ishellfolder, (void**)&ifolder, &idchild); if (!succeeded(result) || !ifolder) return false; ccominterfacereleaser ifolderreleaser (ifolder); icontex

java - Not sure how to reference stringArray in main thread -

as can see i've been chopping , altering snippets of code i've found on place, , it's taken ages! i'm stuck on context menu isn't capturing touch selection when item selected, , eclipse showing error i'm not sure how correct. i'm not sure how reference array list in main thread, know how if it's array string, not on main thread. the line * 1 gives error. just wondering if take peek @ it? import java.util.arraylist; import android.app.listactivity; import android.media.mediaplayer; import android.os.bundle; import android.view.contextmenu; import android.view.contextmenu.contextmenuinfo; import android.view.menuinflater; import android.view.menuitem; import android.view.view; import android.widget.adapterview.adaptercontextmenuinfo; import android.widget.listview; import android.widget.toast; public class mainactivity extends listactivity { private arraylist<sound> msounds = null; private soundadapter madapter = null; static mediaplay

actionscript 3 - as3 Error type was not found but already import -

i have problems when want compile code. there errors type not found or not compile-time constant: sliderevent but have import it. import fl.events.sliderevent; when right click , gotodeclaration . notice files not include in project. should do? think fl library should include project.

c++ - How do I `std::bind` a non-static class member to a Win32 callback function `WNDPROC`? -

i'm trying bind non-static class member standard wndproc function. know can making class member static. but, c++11 stl learner, i'm interested in doing using tools under <functional> header. my code follows. class mainwindow { public: void create() { wndclassexw windowclass; windowclass.cbsize = sizeof(wndclassex); windowclass.style = m_classstyles; windowclass.lpfnwndproc = std::function<lresult(hwnd, uint, wparam, lparam)> ( std::bind(&mainwindow::windowproc, *this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4)); windowcla

How to port an Android app in Blackberry With Push Notification? -

i android developer , and want port android app in blackberry 10. in android app have promotion feature in use push notification show current promotion. , when user click on it, opens browser show promotion. ok working of app. want ask how port app in blackberry push notification feature. possible. tutorial or example this. have read how convert/port android app in blackberry on blackberry's developers site. possible push notification feature? regards as turns out, can. check creating push-enabled android apps . can't use android c2dm, can same using bb10 push service.

html - media queries : limit some css styles according to the screen size -

when write style in layout.css applies in every screen size , in /* #media queries section, have these sections: /* smaller standard 960 (devices , browsers) */ /* tablet portrait size standard 960 (devices , browsers) */ /* mobile sizes (devices , browser) */ /* mobile portrait size mobile landscape size (devices , browsers) */ so none of these want. where should write large screen specific css codes? suppose have div <div claas="example"> </div> now write css .example applied screen larger range mentioned in media query .example{ /*..for larger screen style goes here....*/ } @media screen , (max-width: 1400px) { .example { /*...now give style screen less 1400px...*/ } } @media screen , (max-width: 1300px) { .example { /*...now give style screen less 1300px...*/ } } in above code mention 3 different styles >1400px screen size for 1300 1400px screen size <1300px screen size edit:: "/* larger st

models - Preparing for Magento Developer Certification - Study Guide -

i'm preparing mcd exam , i'm stuck on chapter 4 work database stuff. allready answers of questions, these ones no documentation. here questions can not explain, don't know refer to, , need should able give responses: ** 1.describe load-and-save process of regular entity 2.describe group save operations 3.describe collection interface (filtering/sorting/grouping) 4.describe hierarchy of database-related classes in magento 5.describe role , hierarchy of setup objects in magento ** thanks in advance , sorry bad english. edit munjals link magento's varien data collections quite basic understanding how models collections works. however, article not give right information answer questions ask. again munjal. therefore, question of me remains. grateful more , tips my understanding of questions: 1.describe load-and-save process of regular entity i think here load , save actions in different classes used in process. there lot spread on sy

java - Is it possible to make dynamic tests in testNG? -

is possible make test sets in testng execute based on condition. for example, let's have captured 100 odd web-elements , have 6 common tests run on each of element based on type of element. have stored elements in list. if element of type text box run test1, test2 , test3. otherwise, if element of type combo box run test4,5 , 6. i have seen there option of test grouping in testng, how can test grouping can used in above context?

cocos2d x - Program bash is not found in path? -

i have tried many times set cocos2dx in eclipse, haven't been able work. getting error: bash not found in path i have tried kinds of stuff available on stackoverflow have not found solution fixes error in system. using window 7 32 bit. install cygwin(if not installed).make sure install make module. set path of bin folder in environment variables c:/cygwin/bin .name path . should work. you can refer link also

canvas - performance of layered canvases vs manual drawImage() -

i've written small graphics engine game has multiple canvases in tree(these represent layers.) whenever in layer changes, engine marks affected layers "soiled" , in render code lowest affected layer copied parent via drawimage(), copied parent , on root layer(the onscreen canvas.) can result in multiple drawimage() calls per frame prevents rerendering below affected layer. however, in frames nothing changes no rendering or drawimage() calls take place, , in frames foreground objects move, rendering , drawimage() calls minimal. i'd compare using multiple onscreen canvases layers, described in article: http://www.ibm.com/developerworks/library/wa-canvashtml5layering/ in onscreen canvas approach, handle rendering on per-layer basis , let browser handle displaying layers on screen properly. research i've done , i've read, seems accepted more efficient handling manually drawimage(). question is, can browser determine needs re-rendered more efficiently can

eclipse - Is there a way to enter greek letters in Wolfram Workbench 2.0? -

is there way enter , use greek letters in .m file in wolfram workbench 2.0? as far can tell, there no way use greek symbols inside of wolfram workbench 2.0. the best solution 1 recommended simon (use [alpha], [epsilon], etc.) when code workench pasted mathematica (as check), symbols rendered greek. it nice have ability see greek symbols in wolfram workbench. improve readability of code.

c# - How can I transvers two collections to find out what objects are in one and not the other? -

this question has answer here: can use linq compare missing, added or updated between 2 collections 3 answers i have following class: public objectivedetail() public int objectivedetailid { get; set; } public int number { get; set; } public string text { get; set; } public override bool equals(object obj) { return this.equals(obj objectivedetail); } public bool equals(objectivedetail other) { if (other == null) return false; return this.number.equals(other.number) && ( this.text == other.text || this.text != null && this.text.equals(other.text) ); } } i have 2 icollection collections: icollection<objectivedetail> _obj1; // reference icollection<objectivedetail> _obj2; // may have more, les

ruby - syntax error, unexpected '=', expecting keyword_end -

i have code: class tvshow attr_accessor :name attr_accessor :tvdbid def initialize(showname) :name = showname end end and gives me error: syntax error, unexpected '=', expecting keyword_end :name = showname what i'm wanting have public variable can use across entire class, that's i'm trying :name , :tvdbid. i'm new ruby, let me know if i'm doing wrong. change: def initialize(showname) :name = showname end to def initialize(showname) @name = showname end you can this: attr_accessor :name, :tvdbid some examples: class dog def initialize(name) @name = name end def show puts "i dog named: " + @name end def add_last_name(last_name) @name = @name + " " + last_name end end d = dog.new "fred" d.show d.add_last_name("rover") d.show --output:-- dog named: fred dog named: fred rover so instance variables freely accessibl

html - CSS Text Vertical Alignment -

as can see in index page of blog http://www.lowcoupling.com , each post has box on left in number of comments depicted. i'd have text aligned vertically. problem height of row depends on width of browser , on number of characters in post. there way that? try adding .commentbox { margin-top: 10px; } due amount of lines in heading varying difficult center can adjust height top of liking

android - blank screen after re-starting launcher activity (failed binder transaction) -

i have weird problem app shows black screen when try re-launch it. happens , can't find solution after digging code weeks! this how happens: open app, stuff , return home screen. after several hours, relaunch app , opens blank screen (no anr or whatsoever thrown!). i've put log messages oncreate() , onresume() method, never show up. logcat shows me lot of "failed binder transaction" errors when happens. other various other threads, not passing images or large objects through intent. "transactiontoolargeexception" not being thrown either. so how data/anr/traces.txt looks (unfortunately, app not being "traced"): http://www.xup.in/dl,19638443/traces.txt . and dumpsys.txt: http://www.xup.in/dl,10520097/dumpsys.txt . my testdevice happens: samsung galaxy s1 (android 2.3.6) the blank screen doesn't seem occur on ics phone (lg optimus g) any ideas? do use admob sdk in application? solved issue downgrading version 6.4.1 6.2

VM - reducing number of instructions for different types? -

i developing experimental vm, , right have separate instruction datatype operations each , every type, safe. e.g. have add instruction 8, 16, 32 , 64 bit signed , unsigned integers, float, double , long double. that's 11 instructions 1 operation. true operations support types, so, end lot of instructions , little head room. so wondering if instructions can operate regardless of underneath type, can cut number , make room more instructions i'll in desperate need of in future, since don't want exceed byte instruction. instead of having add , sub , etc.. every data type why not have them operate on "registers" , have mov instruction datatypes 0 out/sign extend rest (if any) of register. this of course assuming have things in vm. might want add more information question.

Markup for Sphinx formatting of argparse -

i using sphinx/restructuredtext create html , pdf docs project , including output of argparse command line tools. @ moment pasting output in manually plan @ point switch autogenerated output. the problem while formatting fine named parameters (like -x or --xray) doesn't work on positional parameters. looks absence of leading '-' on parameter name confusing it. output looks normal text without neat indentation etc. so question is, there exist markup force formatting positional parameters if had leading '-' characters? if not, suggest in docs or code should start looking put myself? you may use sphinx-argparse extension. not use output of argparse help, instead introspects argparse parser , provides proper sphinx markup both positional arguments , options, formatting them definition list proper labels. sub-commands handled. http://sphinx-argparse.readthedocs.org/en/latest/ it cover needs in: plan @ point switch autogenerated output

unit testing - How to specify properties of wx.MouseEvent? -

i trying write pyunit unit test 1 of wxpython classes, receives mouse wheel events. unit test spawns mouse event event = wx.mouseevent(mousetype=wx.wxevt_mousewheel) unfortunately, spawns mouse wheel event wheelrotation = 0 . mouseevent class prevents me manually setting nonzero wheel rotation in turn prevents me testing nontrivial cases of event handler. is there way synthetically generate mouse wheel events nonzero rotations (which can used in unit tests)? not 100% sure valid way but: >>> import wx >>> event = wx.mouseevent(mousetype=wx.wxevt_mousewheel) >>> event.wheelrotation = 22 traceback (most recent call last): file "<stdin>", line 1, in <module> attributeerror: can't set attribute >>> event.m_wheelrotation = 22 >>> event.wheelrotation 22 >>> event.m_wheelrotation = 25 >>> event.wheelrotatio

.net - Entity Framework: custom primary key -

how can create custom primary key auto increment in entity framework? primary key format: [month][year][index] the [index] value reset every month. example: month: primary key start 082013001, until 082013999 next month: 092013001, until 092013999 if ef can't have custom primary key, best way me achieve this?

swap - stop emacs swapping windows when setting breakpoints -

context: gnu emacs 23.2.1 (x86_64-pc-linux-gnu, gtk+ version 2.20.1) running on debian 6.0.7. when running pdb (m-x pdb), emacs switches buffer in window when set breakpoint. i've searched internet , here, , haven't yet found way stop this. here's scenario: i'm using wide window split hoirizontally side-by-side working. once i've started pdb (m-x pdb) python file, have 1 window has debug session (indicating gud-pathfile.py). other window has pathfile.py source file. each time click on line in source , click on red "set breakpoint" button, windows swap (if .py file in right window, it's in left, etc.). thank time , help. blessings, doug here's standard solution. makes easy restore previous window configuration. (winner-mode) (global-set-key (kbd "<f7>") 'winner-undo) (global-set-key (kbd "c-<f7>") 'winner-redo)

Rebuild SQLite database when app updates, Android -

i need rebuild sqlite database in app when users upgrade previous version have changed content of database, app checks if first run builds database save time on subsequent launches of app. when update app none of new info in database displays. there way check if app being updated instead of being installed first time? here code inserting data database: boolean firstrun = getsharedpreferences("preference", mode_private).getboolean("firstrun", true); if (firstrun){ new alertdialog.builder(this) .settitle("welcome!") //set title text .setmessage(...) .setneutralbutton("ok", null).show(); //sets button type thread workthread=new thread(new runnable(){ public void run() { dbhelper.deleteallspeakers(); // clear database dbhelper.insertsomespeakers(); //add data runonuithread(new runnable(){ @override pu

windows - Prerequisites for learning MFC programming -

i know bit of c++ , c , project working whole lot of mfc programming. can experienced tell me prerequisites learning mfc. also, best sources learn ? any particular book or video series? i know question general answers might me(or else digging mfc) lot thanks! +1 question! tl;dr : learn win32 - in order. by far important prerequisite mfc solid understanding of windows api (also referred win32 api ). need familiar few key concepts of c++ , intimate tools. proposed list of prerequisites be: get solid background in windows api development. familiarize relevant concepts of c++. learn tools. the following rundown of these steps, links additional information. 1. windows api: the windows api exposes services through c interface. consequence resource management tedious boiler plate code. , visible in source code (sometimes incredible bonus when reading code). mfc - large extent - automated resource management wrapper (and utility library) around windows ap

Give full permission to particular Java Swing application -

i working on 1 java swing web start application , need test online. think need fix permission issues before deploying on server. can make exception application, because right development in progress testing deploying again , again? so avoid every time signing jar. can make exception in browser/system? can run full permissions without error. <?xml version="1.0" encoding="utf-8" standalone="no"?> <jnlp codebase="http://searchengine.crazy-minds.com" href="launch.jnlp" spec="1.0+"> <information> <title>logsearchengine</title> <vendor>shilpi jain</vendor> <homepage href=""/> <description>logsearchengine</description> <description kind="short">logsearchengine</description> <offline-allowed/> </information> <update check="background"/> <res

java - How to UUEncode in android -

using libraries, can uuencode binary in android java? couldn't find uuencoder api available in java android. does know such api? the libraries i'm aware of uuencoding oracle's, ships java sdk (and not replicated in android sdk), , 1 in ant. i'm guessing you're not going want include ant library in android application. i did find source sun/oracle's uuencoder @ http://www.docjar.com/html/api/sun/misc/uuencoder.java.html it's gpl2 licensed, if feel software can meet demands of license, copy source 1 class application. failing that, implement algorithm yourself. see, example, http://www.herongyang.com/encoding/uuencode-algorithm.html

Assigning Integer Value to String. Android/Java -

i'm new both java , android , working on program has 2 edittext's in row. first edittext want string , second integer assigned string. to make more specific, user inputs homework , 15 , want number saved such in future when user inputs assignment homework value, value multiplies 15. <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="horizontal"> <edittext android:id="@+id/register_assign_edit" android:layout_width="fill_parent" android:layout_height="wrap_content" android:gravity="center_horizontal" android:hint="@string/example_assign" android:singleline="true" android:inputtype="textcapwords" android:layout_weight=&

Efficiently creating pairs of random array items in PHP that meet certain criteria -

i have 3 arrays: $a 5 elements, , $b & c 4 elements. each member of $a has paired randomly 3 times member $b or $c . however, each element $b , $c has paired randomly five elements other 2 arrays. each of these pairings must unique, , element can't paired itself. eg: $a = array('a1', 'a2', 'a3', 'a4', 'a5'); $b = array('b1', 'b2', 'b3', 'b4'); $c = array('c1', 'c2', 'c3', 'c4'); the pairings a1 like: 'a1', 'b3' 'a1', 'b4' 'a1', 'c2' and pairings c3 like 'c3', 'a2' 'c3', 'b3' 'c3', 'a4' so again, i'm trying make random pairings that: an element must matched elements other arrays (and can't match themselves). can in number either one. each matching must unique elements in $a must matched 3 times, elements in $b or $c must matched 5 ti

How make a variable public final in Ruby -

i create class during initialization of object of class assign provided value 1 of variables, in such way can't changed. example: person = person.new("tom") person.name #=> tom person.name = "bob" this should raise error or: person.name #=> tom -> still class person def initialize name @name = name end attr_reader :name end person = person.new("tom") person.name #=> tom begin person.name = "bob" rescue puts $!.message # => undefined method error end person.name #=> tom

node.js - Query value gets quoted automatically before sending it to MongoDB? -

the following confusing me lot. have been spending quite bit of time trying understand why collection.find() doesn't work regex passed object. regex match coming on http wrapped in body of post request. try gather query (in string format) , perform query. problem seems unless regex written inside node without quotes, won't work. is, must literal without quotes. for example, following works fine: var query1 = { company: { '$regex': /goog/ } }; collection.find(query1, {}).toarray(function (err, docs) { // got results back. awesome. }); however, if data comes wrapped in object, doesn't return anything. suspect it's because value gets quoted behind scenes (i.e. "/goog/"): // assume var query2 = { company: { '$regex': query.company } }; collection.find(query2, {}).toarray(function (err, docs) { // got nothing back. }); i have tested mongo shell , can confirm following: // returns 5 results db.getco

assembly - Reading Hex as String -

im not in coding in assembly, need write in assembly anyways here trying do. (i'm using masm32) .data msg db 31h, 00h, 32h, 00h, 33h ;convert string "123" .code start: invoke messagebox, 0, addr msg, 0, 0 call exitprocess end start as can see each character or byte separated null byte, can show 1 byte, "1" instead of "123" if can concatenate each readable byte until reaches end of string. mov ebx, offset msg mov ecx, ebx add ebx, 2 invoke lstrcat, ebx, ecx maybe add loop also, don't know better way code or if have better solution can share. in order work on string, need know length of string. done using null terminate string. functions not take string length argument, 00h, , print string it, messagebox doing, printing "1" , seeing next character 00h, stops printing. in case, there no null terminator @ end of string, can string length @ assembly time symbol "$&qu