Posts

Showing posts from May, 2013

Having issue with inserting a entry into a Table using VB.net/Django/PostgreSQL -

i trying insert entry table server says this column "date" of type date expression of type integer @ character 131 this sql statement can show vb.net horrid mess. insert "inventory_chemicalrecord"("barcode","action","name_id","building","qty","date") values ('ien0001','add',1,'marcus',1,2013-07-10); here string passing mysqlstring = "insert "&chr(34)&"inventory_chemicalrecord"&chr(34)&"("&chr(34)&"barcode"&chr(34)& ","&chr(34)&"action"&chr(34)& ","&chr(34)&"name_id"&chr(34)& ","&chr(34)&"building"&chr(34)& "," &chr(34)&"qty"&chr(34)& ","&chr(34)&"date"&chr(34)& ") values ("& code & "," &chr(

php - preg_replace not replacing with ajax -

i have following code $text = '["{!account__!http://localhost/mf/public/__notactivated}","email"]'; $replcmnt = array( '#{!account__!http:\/\/localhost\/mf/public\/__notactivated}#' => 'text replace' ); $text = preg_replace(array_keys($replcmnt),$replcmnt,$text); i need output '["text replace","email"]' reason replace isn't replacing. find extremely weird works when load page doesn't work if run via ajax request o.o i have note if remove slashes inner part between underscores replace takes place. problem must slashes. ex. $replcmnt = array( '#{!account__!http:-localhost-mf-public-__notactivated}#' => 'text replace' ); the above replaced due lack of slashes, suppose. any appreciated edit : here's data right before replace: $text ["{!account__!http:\/\/localhost\/mf\/public\/__notactivated}","email"] $replcmnt array ( [#{!ac

Is it possible to use the Mocha Framework against a model in Sails.js? -

sails.js uses mvc pattern node.js , wondering if mocha hooked testing models. i know asked awhile ago, searching around myself , there's not out there @ moment. figured i'd drop found answer... i found discussion on sails github , a gist example code. there second discussion more examples.

node.js - REST / Web based authentication-as-a-service a possibility? -

i've developped rest based service using express , started implementing authentication myself. simple username/password authentication passwords encrypted using bcrypt user info + hashed passwords stored in mongodb password verification checks done. authentication tokens (limited ttl) generated / validated i have knowledge on node.js, not sufficient make me feel comfortable rolling out own authentication (login/signup) mechanism. for reason replace in-house mechanism else. something proven, extendable, pluggable , easy use. given amount of secure websites / rest apis out there based on node.js, i'm sure there out-of-the box solutions people / companies have offer can service implementors , running quickly, without having worry security/user aspect. i'm looking even higher level of abstraction of libraries passport or everyauth . provides out-of-the-box functionality, capable of fulfilling requirements including : providing login page / signup pag

java - Android bug with preferences? -

so have app uses various currency symbols , can select whichever via standard preference view , noticed if currency uses same symbol e.g. usd, aud, sgd ($) default last item in list. instance, list below if choose usd or aud default sgd when click again if choose zar, myr, eur, or gbp stick 1 value doesn't repeat. doing wrong here or known issue? <string-array name="currency"> <item name="eur">eur</item> <item name="gbp">gbp</item> <item name="jpy">jpy</item> <item name="usd">usd</item> <item name="zar">zar</item> <item name="myr">myr</item> <item name="cny">cny</item> <item name="aud">aud</item> <item name="sgd">sgd</item>

jsf - Getter called multiple times - selected item not retained in JSP -

i working jsf 1.2 , use little advice. have fmb (planfmb.java) contains array list of select items , single selecteditem. when page loads, getprojects() method correctly called , displays projects expected. strange thing though, getselecteditem() method called 3 times (once of each project). not sure if typical behavior: systemout o getselecteditem = null systemout o getselecteditem = null systemout o getselecteditem = null also, have command link in jsp, when clicked same thing, calls getselecteditem() method 3 times: <h:commandlink action="#{plandocbean.classaction}" id="classactionenlink"> planfmb.java string selecteditem = null; private list<selectitem> selectitems = null; public string getselecteditem() { system.out.println("getselecteditem = " + selecteditem); return selecteditem; } public void setselecteditem(string selecteditem) { this.selecteditem = selecteditem; system.out.println(&qu

In SQL Server, what does it mean to be self-documenting? -

i came across term in reading. here context: "it best practice make t-sql code self-documenting. speaking, view more self-documenting if column names of view specified in select statement , not listed separately in view." i curious means. response appreciated. it same other piece of code. meaningful names: give table names describe contents. give columns names , types describe contents , appropriate them. give views, stored procedures, functions , other database objects descriptive names. the specific quote seems recommend using column names in views - take mean use of select * discouraged (it bad practice various reasons).

c# - Data Driven Website - how to hide specific columns -

we have datadriven website in c# being built in vs 2010. how prevent columns in table being displayed on webpage ? i think should not display table itself, display views . makes better design. you can show or hide columns in views wish.

asp.net mvc - handling large file image upload -

on asp.net mvc 4 site have feature user can upload photo, via standard file uploader. photo gets saved in file table within sql server. i have run in issue users uploading large photos in return means bandwidth being eaten when image being rendered. what best way handle this? can restrict size of file being uploaded? or there way of reducing number of bytes being uploaded while maintaining quality? refer this post maximumrequestlength config setting , way provide more friendly error this question , answer may helpful you can check size of file in javascript before uploading doesn't sent server if big (the code below check bigger 15mb): if( math.floor( file.size / 1024 /1024 ) >= 15 ) { alert( 'file size greater maximum allowed. please make sure file smaller 15 megabytes.' ); return false; } alternatively, on server side can use webimage.resize() resize once file has been uploaded. won't bandwidth during upload, make subsequent do

Aptana PHP Code Analisys Quick Fix -

does aptana 3 have plugin provide code analisys quick fix eclipse on java? i write method or property , have aptana advertise me method/property doesn't exist , provide me automatic creation of this. like this: http://i.stack.imgur.com/qkmck.png

Python Tuple Issue -

i'm learning python tuple, , feeling bit overwhelmed. i'm working tuple 20 times size of i've put below. {u'0usshtry': {u'a': {u'n': u'backups'}, u'h': u'0usshtry', u'k': (16147314, 17885416, 1049370661, 902515467), u'ts': 13734967, u'p': u'5rtygqws', u'u': u'xpz_tb-ydug', u't': 1, 'key': (16147314, 17885516, 10490661, 9015467)}, u'omv32igb': {u'a': {'n': 'rubbish bin'}, u'h': u'omv32igb', u'k': u'', u'ts': 13734735, u'p': u'', u'u': u'xpz_tb-ydug', u't': 4}, u'acltqtaa': {u'a': {u'n': u'test3'}, u'h': u'acltqtaa', u'k': (4031580, 13207606, 20877418,89356117), u'ts': 1373476935, u'p': u'4flnwbtb', u'u': u'xpz_tb-ydug', u't': 1, 'key': (

php - Select and Update in same query -

can select , update in same query? i'm trying count views create top blog posts views sidebar. $sql = mysql_query("select * articles id='$id' limit 1 update pages set views=views+1 id=$id"); no, cannot that, there nothing wrong doing 2 queries. mysql_query("update pages set views=views+1 id=$id"); $sql = mysql_query("select * articles id=$id"); also, if id primary key don't have limit 1 here, id unique, therefore have 1 result matching condition.

java - Play sound when selecting ListPreference -

i have listpreference set up, , has 4 options. wondering if possible play sound after selecting 1 of options? want make make sound ringtone after selecting listpreference, , want sample of sound play after selecting it. don't want sound play clicking button after selecting option listpreference. want play while preferencescreen open, right after selection has been made. perhaps add listener , in callback read sound file classpath play it. hacked example (using java7) show example of playing audio file, helps: import java.io.ioexception; import java.util.logging.level; import java.util.logging.logger; import javax.sound.sampled.audioinputstream; import javax.sound.sampled.audiosystem; import javax.sound.sampled.clip; import javax.sound.sampled.lineunavailableexception; import javax.sound.sampled.unsupportedaudiofileexception; public class main { public static void main(string args[]) { clip clip; try { clip = audiosystem.getclip();

Not able to print correct line numbers for then part of if statement, Clang -

in following code, parsing c-code using clang apis , trying 1)add html header , footer code, can viewed in browser 2)getting line number of part of if statement , printing it. i having trouble in (2). not able make sense of output. following input (with line numbers added), getting (relevant) output line number 6 line number 6 line number 6 line number 6 line number 12 line number 12 line number 12 line number 12 i expect 4 , 8 respectively. can explain wrong? my input follows (please remove line numbers or go http://pastebin.com/hf5ymmaz ) %nl myinput.c 1 #include <stdio.h> 2 int func (int abc, int xyz) { 3 if (abc-1) 4 { 5 printf ("1\n"); 6 } 7 if (abc-2) 8 { 9 printf ("2\n"); 10 } 11 12 return 0; 13 } my code @ following location (only 1 file) http://pastebin.com/txf9bwa4 to compile code, run these commands: clang_install=/usr/installdir/

Getting started with Nutch and Solr: where's Solr's conf/ directory? -

i'm trying started nutch (v 1.7) , solr (v 4.3.1). i'm following tutorial: http://wiki.apache.org/nutch/nutchtutorial i'm confused step 6 i'm told copy nutch schema file 1 of solr's directories. 6. integrate solr nutch we have both nutch , solr installed , setup correctly. , nutch created crawl data seed url(s). below steps delegate searching solr links searchable: cp ${nutch_runtime_home}/conf/schema.xml ${apache_solr_home}/example/solr/conf/ the problem ${apache_solr_home}/example/solr/conf/ doesn't exist. /example/solr/ contains readme.txt bin collection1 solr.xml zoo.cfg does know how proceed? should create ./example/solr/conf directory , copy nutch files that? many help. since on solr 4.x, have conf inside collection1, should able following: cp ${nutch_runtime_home}/conf/schema.xml ${apache_solr_home}/example/solr/collection1/conf/

If statement based on which computer uses a script in R -

how can identify computer in r? i want share script someone, rather having comment out stuff, i'd rather use following: if (currentpc == mypc) print{"stuff"} is there platform independent, way (though suppose information such platform in identifying pc)? preferably using base package. try of: sys.info()[["nodename"]] sys.info()[["login"]] sys.info()[["user"]] or other components of sys.info() (or combination of them).

Launching an install4j installer from within another install4j installer in console mode -

i have installer a. when runs launches installer b using "run executable or batch file" action. in gui mode runs fine. however, on headless ubuntu (or passing -c flag) installation hangs. looking @ log file of installer b looks attempting run "welcome screen" though should run in console mode: [info] com.....install4j.extensions.welcomeformpanelscreen [id welcomescreen]: show screen the log installer shows -c flag passed: [info] com.install4j.runtime.beans.actions.misc.runexecutableaction [id 21125]: execute action property environmentvariables: {} property returncodevariable: property rollbackarguments: null property rollbackexecutable: null property rollbackworkingdirectory: null property stderrfile: null property stderrredirectionmode: no redirection property waitforstreams: false property stderrvariablename: property stdinfile: null property stdinstring: property stdoutfile: null property stdoutred

networking - when ip conflict, how tcp react? -

when 2 computers set same ip address in lan(such 192.168.1.100), both of them may receive incomplete packets. how tcp on them react situation ? ask retransmission ? my understanding tcp reset connections because of sequence number errors. so, connections mysteriously , randomly disconnect, depending on when stack detects sequence number error.

Javascript "Cannot read property 'length' of undefined" when checking a variable's length -

i'm building node scraper uses cheerio parse dom . more or vanilla javascript question though. @ 1 part of scrape, i'm loading content variable, checking variable's length , so: var thehref = $(obj.mainimg_select).attr('href'); if(thehref.length){ // stuff }else{ // other stuff } this works fine, until came across url $(obj.mainimg_select).attr('href') didn't exist. assumed thehref.length check account , skip through else: other stuff statement, instead got: typeerror: cannot read property 'length' of undefined what doing wrong here , how can fix this? you can check thehref defined checking against undefined . if (undefined !== thehref && thehref.length) { // `thehref` not undefined , has truthy property _length_ // stuff } else { // other stuff } if want protect against falsey values null check thehref truthy, little shorter if (thehref &&

Android failing to change view -

so pretty new android , having issue changing views. have simple task list application , want able open "details" view when clicked. here's have: public class viewtask extends activity { protected taskerdbhelper db; private list<task> list; private myadapter adapt; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.view_task); //db variable of type taskerdbhelper db = new taskerdbhelper(this); list = db.getalltasks(); adapt = new myadapter(this, r.layout.list_inner_view , list); listview listtask = (listview)findviewbyid(r.id.listview1); listtask.setadapter(adapt); listtask.setonitemclicklistener(new adapterview.onitemclicklistener() { @override public void onitemclick(adapterview<?> adapterview, view view, int i, long l) { string taskname = (string)((

windows phone 7 - Check if the WrapPanel is overflowed? -

i'm doing pagination things. know if can check whether textblock inside of wrappanel overflowed or not? way ask if know pagination please give me tuts. i'm doing split big sized string pages , display them phone screen. thanks. microsoft.phone.controls.wrappanel wrappanel = new microsoft.phone.controls.wrappanel(); wrappanel.width = calculatedwidth; wrappanel.height = calculatedheight; wrappanel.margin = new thickness(pageformat.leftmargin,pageformat.topmargin,pageformat.rightmargin,pageformat.bottommargin); textblock tbl = new textblock(); tbl.text = " text here ... "; wrappanel.children.add(tbl); since mango sdk, there property call texttrimming . so xaml <textblock text="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" texttrimming="wordellipsis" width="200" /> will produce somehting "aaaaaaa....." so code like: tb1.textwrapping=textwrapping.wordellipsis edit there property called wrap u can set both in x

Using MySQL, return specific user ID's in a table with duplicate ID's using a second column as the criteria -

here's scenario: i have table looks this: table name: user_activities user_id | activity_code ----------------------- 1111 | 013 ----------------------- 1111 | 112 ----------------------- 2222 | 014 ----------------------- 3333 | 028 ----------------------- 3333 | 245 ----------------------- 3333 | 468 ----------------------- 4444 | 079 ----------------------- 4444 | 028 ----------------------- 5555 | 157 ----------------------- 5555 | 523 ----------------------- 6666 | 081 ----------------------- 7777 | 067 ----------------------- 7777 | 624 ----------------------- it's oracle database using mysql, , activity_code char field. need extract user_id's have activity_code starting 0, , have no activity_code's starting other number. so, where activity_code '0%' gives me user_id's have activity_code starting 0, includes user_id's have activity code starting 0 , other activity_code's star

c# - Error Microsoft.Office.Interop.Word.Document -

compiled error running i have problem, running application , build , following error: could not save template not load file or assembly 'microsoft.office.interop.word.document, version = 12.0.0.0, culture = neutral, publickeytoken = 71e9bce111e9429c' or 1 of dependencies. located assembly's manifest definition not match assembly reference. (exception hresult: 0x80131040) i have no sources, need know if server running need office or need dll in compiled

multithreading - Semaphores & threads - what is the point? -

i've been reading semaphores , came across article: www.csc.villanova.edu/~mdamian/threads/posixsem.html so, page states if there 2 threads accessing same data, things can ugly. solution allow 1 thread access data @ same time. this clear , understand solution, why need threads this? point? if threads blocked 1 can execute, why use them @ all? there no advantage. (or maybe dumb example; in such case please point me sensible one) thanks in advance. consider this: void update_shared_variable() { sem_wait( &g_shared_variable_mutex ); g_shared_variable++; sem_post( &g_shared_variable_mutex ); } void thread1() { do_thing_1a(); do_thing_1b(); do_thing_1c(); update_shared_variable(); // may block } void thread2() { do_thing_2a(); do_thing_2b(); do_thing_2c(); update_shared_variable(); // may block } note of do_thing_xx functions still happen simultaneously. semaphore comes play when threads need modi

Rails ActiveAdmin - get current_admin_user in utility navigation? -

the activeadmin docs can override utility navigation this: activeadmin.setup |config| config.namespace :admin |admin| admin.build_menu :utility_navigation |menu| menu.add label: "activeadmin.info", url: "http://www.activeadmin.info", html_options: { target: :blank } admin.add_logout_button_to_menu menu # can pass priority & html_options link_to use end end end it says default display includes current user's email address. how current user's email address? when try replacing menu.add label value current_admin_user error says current_admin_user undefined. how access info signed in user config file? how activeadmin behind scenes? config.namespace :admin |admin| admin.build_menu :utility_navigation |menu| menu.add :label => proc{ display_name current_active_admin_user }, :url => proc{ edit_admin_admin_user_path(current_active_admin_user) } ,#link_to current_active_

php - web based duplicate file remover -

my partner , planning make web based duplicate file remover application.this application delete duplicate files on system. have idea on how implement using hash algorithms question since web based,is possible web server access local? using php , codeigniter frameworks. hope can enlighten our minds. is possible web server access local? no, isn't.

Weblogic Admin Server vs Managed Servers -

what difference between managed server , admin server in weblogic parlance? responsibility of both in standard production environment? p.s: understood docs admin servers' responsibility manage resources in domain(a logical grouping of few managed servers , 1 admin server) not clear few examples of kind of resources responsible managing? weblogic defines roles of admin/managed server follows: admin server can only 1 domain , works central configuration/monitoring controller entire domain runs console , can create new managed servers, define datasources (db connections), jms queues, deploy apps managed servers, etc. managed server additional weblogic server instances you deploy web applications, ejbs, , other resources onto managed servers , use administration server configuration , management purposes only. this run apps. managed servers can grouped clusters . one of examples of managed server server running soa applications, osb or bpel. see e.g

Is Bash expanding the "*" character in my python command line parameter? -

with following command in bash : python myscript.py filename_pattern* i got 2 different sys.argv in 2 linux machines: machine a : sys.argv[1] = filename_pattern* machine b : sys.argv[1] = filename_pattern-2013-06-30 note : filename_pattern-2013-06-30 file in current directory. one of colleague tell me that's evil of bash . check bash in 2 machines of same version, , checked ~/.bashrc , /etc/bashrc , /etc/profile.d/*.sh too. can point out how come 2 same version bash act differently ? it because in 1 of machine, in folder, there in no file match pattern. when happens, * remains. can test 1 computer, , without file match pattern. there reason, shell option nullglob disabled. can read gnu bash reference this.

jquery - using not function with $this and is(":visible") -

i have following html... <button>one</button> <div class="div1"></div> <button>two</button> <div class="div2"></div> <button>three</button> <div class="div3"></div> <button>four</button> <div class="div4"></div> and jquery have used.... $(document).ready(function(){ $("button").click(function(){ $(this).next().slidetoggle(); }); }); i use slidetoggle() function (that hide) again if others open(visible). how use not function $this , is(":visible") while other visible clicked adjacent div shown , others closed? http://jsfiddle.net/vwfv7/ like this? $(document).ready(function(){ $("button").click(function(){ $(this).next().slidetoggle().siblings('[class^=div]').slideup(); }); }); demo you dont need use :visible slideup. slide siblings div particular class pattern. o

actionscript 3 - Simple flash video loop play (played on android) always crash after a few hours -

why flash-based video player on android crash after few hours of play? i'm writing flash-based android app. thing native android part using webview load flash swf. swf acted container module (which written in flash as3). 1 of module simple video module loop play set of video playlist forever. i've considered memory leak, after printing memory usage (using flash's system.totalmemory), result around 12mb 14mb (which seems normal 2 videos). i've test flash using both webview , other third party swf player android (such "swf player" , "smart swf player"), results in crash after few hours. the as3 code simple , can't see possible cause this. here main class: import flash.display.movieclip; import flash.media.video; import flash.net.netconnection; import flash.net.netstream; import flash.events.netstatusevent; public class simplevid extends movieclip { private var video:video; private var nc:netconnection; private var ns

apache - .htaccess Redirecting All Errors to a PHP file with GET variable -

i'm trying figure out how redirect errors pages redirect to /error.php?e={error here} . for example, if user encountered 404 error, directed /error.php?e=404 . is there possible way of doing this? you can use apache error document config. here more info http://httpd.apache.org/docs/2.2/custom-error.html

documentation - A slight Missunderstanding with a UML diagram -

Image
so question surrounding uml diagram program, professor seems switch way diagrams , hasn't been online night , i'm not sure when next, have figured out far, project i'm working on has 2 implementations , left half of diagram seems describe 1 , right half seems describe other, have looked common uml diagram meanings still little foggy pertinence uml. class strictly online allowed ask questions online , seek outside resources, however, simple uml diagram understanding in opinion not misconstrued overreaching territory of "cheating," in class. here know: 1) left 1 implementation right another. 2) left side uses database class used awards ceremony 3) right side has class called baseballawards extends abstractbaseballawards what want know is: 1)what link between awardsceremony , abstractbaseballawards is? 2) professor mean awardsceremoney used both implementations , link between awardsceremony , baseballawards? 3) further explanation lovely :)

c# - How do I instantiate this 'class with generic parameter' in run-time -

this question has answer here: create instance of generic type? 8 answers consider following line of code : classa<classb> c; i want create instance of c during run-time using system.reflection instead. need know type of classa , classb during run-time. i know how type of classb type classbtype = assemblycontaingclassb.gettype("namespace.classb"); q1> how can use classbtype type of classa ? q2> understand create instance in run-time, call following line of code: object c = activator.createinstance(typename); to create instance of c , typename should above code use? type of classa sufficient create instance thanks in advance , apology if question basic. new c#. edit: the problem fixed. p.s.w.g's answer, there problem in getting type of class generic parameter. solution on how type of generic parameter can found here .

backbone.js - wait for backbone template to be appended to the dom -

i trying bind events elements placed appending backbone template: appendedittemplateandsetevents: function() { var associatedcollection = app.helpers.findassociatedcollection(this.allcollections, this.associatedcollectionid); var template = this.setedittemplateforelement(associatedcollection.type); var modalbody = this.$el.find('.modal-body'); modalbody.empty(); var firstmodel = associatedcollection.at(0); if(template.maintemplate !== null) { modalbody.append($('#edit-form-element-frame').html()); //each mode in collection associatedcollection.each(function(model){ if(model.get('positionincontainer') === 1) { firstmodel = model; } console.log(model.attributes); modalbody.find(

security - GPGME: Best practices for automatic decryption in rails server -

i'd able ato implement following behaviour : an admin should asked passphrase gpg production key during rails server startup in production the passphrase should not stored anywhere other ram decryption capabilities should not available in rake tasks or rails console a gpg-agent seems out of question, since process launched same user rails server runs able decrypt content. a passphrase callback gpgme class asking passphrase seems best solution (although tricky implement because of start-stop-daemon wrapper in /etc/init.d/unicorn grabs stdin). am missing ? there security holes such setup ? better solution ? many thanks.

magento - Mage::getModel is returning false -

i trying grips calling , using models in magento. my current task display string held in model calling controller. when trying call simpleoutput.php error message saying non object has been called. have var_dumped see , return false. i have looked @ code , limited understanding of need in magento have correct. i'm missing something. please take , if it's typo tell , if it's more simple spelling mistake explain ive missed , should have done , why? my code below ts/firstmodule/etc/config.xml <?xml version="1.0" encoding="utf-8"?> <config> <modules> <ts_firstmodule> <version>0.1.0</version> </ts_firstmodule> </modules> <models> <firstmodule> <class>ts_firstmodule_model</class> </firstmodule> </models> <frontend> <routers> <firstmodule> <use>standard</use> <a

php - CI, how to make xml code in controller? -

actually coding ajax , want make xml code in controller file. how possible write xml code in controller file? sample of want: in ci controller: class xml extends ci_controller { public function my_function(){ //your xml code here echo $xml_code; //echo output } } and in script might put this: $(function() { $.ajax({ url: '/xml/my_function/', type: 'post', datatype: 'string', success: function(response){ //do want response }); });

c++ - Setting up an asymmetric frustum -

Image
i have program in tracking user's position , setting frustum (setting camera @ user's position) change perspective of scene per user's position. until right now, had 4 corners of display screen @ same z , able set asymmetric frustum , change scene according user's perspective. the current code looks following: usercam::begin(){ saveglobalmatrices(); glmatrixmode(gl_projection); glloadidentity(); glfrustum(_topleftnear.x, _bottomrightnear.x, _bottomrightnear.y, _topleftnear.y, _camznear, _camzfar); glmatrixmode(gl_modelview); glloadidentity(); glulookat(_wcuserhead.x, _wcuserhead.y, _topleftscreen.z, _wcuserhead.x, _wcuserhead.y, _topleftscreen.z-1, 0, 1, 0); } usercam::end(){ loadglobalmatrices(); } usercam::setupcam(){ this->_topleftscreen = _wctopleftscreen - _wcuserhead; //wctopleftscreen, wcbottomrightscreen , wcuserhead in same frame of reference this->_bottomrightscreen = _wcbottomrightscreen - _wcuserhea

api - What does the function VirtualProtect from Kernel32 do? -

im reverse engineering file , came across line of code call dword ptr ds:[3f1010] and ollydbg's comment line is, kernel32.virtualprotect the question function do? did own research bout function in msdn still can't understand clearly. mean memory or virtual page (whatever call it) protects not readable in ollydbg? virtualprotect, changes protection options (i.e. way application allowed access memory) of memory region allocated virtualallocate or other memory functions. there many protection options available - readonly, readwrite, execute, of them etc. check them in msdn. as rule, when memory allocated, has of these protection options assigned. if 1 wants change them later - virtualprotect function need use.

VBA Excel: modify dynamic named range code -

newbie question: have module, originally made roger govier . it uses input cell header , creates dynamic named range non empty cells positioned under header . created named range labeled value of header cell. private sub createnamedrange(header range) dim wb workbook dim ws worksheet dim rstartcell range dim rdata range dim rcol range dim lcol long dim ssheet string dim rowno long ' table location set rstartcell = header set ws = rstartcell.worksheet set wb = ws.parent ssheet = "'" & ws.name & "'" rstartcell rowno = .row set rdata = .currentregion end set rdata = ws.range(rstartcell, ws.cells(rowno, rstartcell.column)) set rcol = rdata.columns lcol = rcol.column wb.names.add name:=replace(rcol.cells(1).value, " ", "_"), _ referstor1c1:="=" & ssheet & "!" & rcol.cells(2).address(referencestyle:=xlr1c1) &

abap - Sap Code Inspector how to use cl_ci_objectset class -

i tried use cl_ci_objectset class reference set of objects run inspection afterwards: data: lr_ci_objectset type ref cl_ci_objectset. call method cl_ci_objectset=>get_ref exporting p_objsnam = 'ztest' receiving p_ref = lr_ci_objectset exceptions ... exception list ... if sy-subrc <> 0. message i005(zsci). * fehler beim ermitteln der objektmenge raise cancel. endif. * prüfen, ob es überhaupt objekte in der sci objektmenge gibt if lr_ci_objectset->iobjlst-objects[] initial. write 'object menge leer'. * in diesem fall kann auch nichts geprüft werden return. endif. write 'object menge nicht leer'. the set 'ztest' exsisting in system public object set. after more testing found solution. if lr_ci_objectset->iobjlst-objects[] initial. is wrong array objset , therefore used. if lr_ci_objectset->objectsinf initial. is functional.

java - Can I set environment variables from code? -

this question has answer here: how set environment variables java? 12 answers i trying install apche tomcat. there arises need set environment variable's , how can set environment variable? i tried using processbuilder doesn't work: processbuilder pb = new processbuilder("cmd.exe", "/c", "set"); // set prints out environment variables pb.redirecterrorstream(true); map<string,string> env = pb.environment(); string path = env.get("catalina_home") + apachepath; env.put("catalina_home", path); process process = null; try { process = pb.start(); } catch (ioexception e) { // todo auto-generated catch block e.printstacktrace(); } example here: import java.io.*; import java.util.*; public class test { public static void main(string[] args) throws exception {

javascript - d3.js - show large numbers on axis in abbreviated form -

is there way abbreviate large numbers on d3.js axis? recall seeing helper method online cannot find again. abbreviate large numbers reduce chart margins , make easier read. i.e. 1,000,000 = 1m etc if can post link d3.js helper class appreciated. check out link https://bl.ocks.org/mbostock/9764126 this worked me d3 v4: function make_y_gridlines() { return d3.axisleft(yscale) .ticks(10,"s") }

vb.net - Serialization Cryptography Error -

i having trouble using encryption serialization when deserializing object. this error: failed deserialize. reason: end of stream encountered before parsing completed here code: imports system.io imports system.security.cryptography imports system.runtime.serialization imports system.runtime.serialization.formatters.binary imports system.text module testmodencryption public sub saveencryptedobjecttofile(filename string, item object) dim fs filestream dim encryptor cryptostream dim formatter new binaryformatter dim password string = "mypassword" dim salt string = "initialvector123" dim aes aesmanaged = new aesmanaged aes.padding = paddingmode.none aes.mode = ciphermode.cbc dim hashalgorithm string = "sha1" 'can sha1 or md5 dim passworditerations integer = 2 dim initialvector string = "initialvector123" 'this should string of 16 ascii characters. dim keysize integer = 256

TFS commands in PowerShell script -

i have powershell script written in version 1.0. in existing old script need facility latest code of project tfs. have tfs client on machine , lets me use tfs command line. have created tfs command line comments latest tfs. these commands run successfuly command propmt. now need include these tfs commands in old poweshell script. need know if doable? if yes how. thanks. one option run tf.exe program necessary arguments within powershell script, other executable: ps> & "$env:programfiles\microsoft visual studio 10.0\common7\ide\tf.exe" @("workspace", "/new", "ws1", "/noprompt", "/login:foo,bar", "/collection:baz/tfs") or use tfs powershell cmdlets included in tfs power tools : ps> add-pssnapin microsoft.teamfoundation.powershell ps> get-tfschangeset -latest -server "http://mytfsserver"

html - Adding a div containing data around a li on mouseover? -

i have normal li element, contains picture. when hover it, should surrounded div example contains descriptions image in li. please check out link http://www.zalando.de/damenschuhe-sandaletten/ , hover shoes. see, adds information around image. i tried several things results not want. ideas how to in way? thanks! something this? <ul> <li> <div class="info">info 1</div> [image 1] </li> <li> <div class="info">info 2</div> [image 2] </li> <li> <div class="info">info 3</div> [image 3] </li> <li> <div class="info">info 4</div> [image 4] </li> </ul> ul{ list-style:none; text-align:center; padding: 0 35px; } li{ display:inline-block; background: #ddd; height:200px; width:200px; margin:10px; paddin

php - Not allowed to load local resource [image upload] -

here snippet ajax server-side script uploads file being submitted. triggers on change of input[type=file] . $('#maglogo').on('change', function(e) { var $input = $(this); var file = e.currenttarget.files[0]; var data = new formdata(); data.append('file', file); $.ajax({ type: "post", data: data, cache: false, contenttype: false, processdata: false, url: 'my/path/to/upload/script.php' }) .done(function(fullpath) { $input .parents('#maglogocont') .css('background-image', "url('"+fullpath+"')"); }); }); on other side, php script returns json string contains temporary directory of uploaded file (which looks file:///c:/wamp/tmp/filename.jpg i'm running on windows). the problem when want put image background of

HTML5 web audio seekTo for buffered source -

Image
i have web application(similar karaoke) user can record voice on instrumental. after recording user plays recording. here play instrumental in <audio> tag , voice using web audio api. sync both audios on play/pause calculate time this pausedat = date.now() - startedat; startedat = date.now() - pausedat; this works fine. issue when user uses slider on audio tag move forward/backward. thinking of solution this use ontimeupdate event, stop voice , use startat(currenttime) currenttime of instrumental playing in audio tag. since there no seekto function in api, have stop , start audio. there better solution this? second issue face seeking on audio tag not smooth. if arbitrarily clicks on progress bar doesn't work. when saw network tab in developer tool window saw shown in image. sends out 600 requests , 86 mb data downloaded whereas file size less 10 mb. you should use web audio api this. never give precise synchronization, , rely on streaming seek -

gruntjs - Compass and Susy require a different version of Sass -

i working on website , want use susy compass. using grunt too. when run grunt task error: denniss-macbook-pro:portfolio dennis$ grunt --trace running "compass:dev" (compass) task gem::loaderror on line ["1990"] of /system/library/frameworks/ruby.framework/versions/2.0/usr/lib/ruby/2.0.0/rubygems/specification.rb: unable activate susy-2.1.1, because sass-3.2.17 conflicts sass (~> 3.3.0) run --trace see full backtrace warning: ↑ use --force continue. aborted due warnings. this grunt file: module.exports = function(grunt) { grunt.initconfig({ pkg: grunt.file.readjson('package.json'), watch: { options: { livereload: true }, css: { files: ['_sass/*.{scss,sass}'], tasks: ['compass:dev'] }, js: { files: ['js/*.js'], tasks: ['uglify'] } }, compass: { options: { require: 'susy' }, dev: { options: { sassdir: ['_sass'], cssdir: ['css'],

android - How do I extend text selection bar? -

Image
how can achieve : when select text want bar show not "copy" ,"select all" , "confirm" "share" icon on screenshot give @ setcustomselectionactionmodecallback(..) then in custom actionmode.callback, can fetch selected text with: int start = mytextview.getselectionstart(); int end = mytextview.getselectionend();

ruby on rails - ActionView::Template::Error (uninitialized constant I18n::RESERVED_KEYS) -

i running rails 3 app ruby 1.9.3. heroku gives me error 500 message in heroku logs: started "/" 90.3.47.58 @ 2014-03-20 08:42:50 +0000 completed 500 internal server error in 176ms <p><%= t('.title_html') %></p> rendered store/index.html.erb within layouts/application (96.3ms) <p id="notice"><%= notice %></p> actionview::template::error (uninitialized constant i18n::reserved_keys): the app works fine locally.the problem arises in production deployment. idea ? looks may have lock i18n gem @ 0.5.0 now: https://github.com/svenfuchs/i18n/issues/233

validation - Rails validates_uniqueness_of, logical AND -

i have 3 paramaters, e.g. site_id_1 , site_id_2. , transport_distance when creating new record, rails should validate site_id_1 , site_id_2. dont exist. (so combination matters) with validates_uniqueness_of(:site_id_1, :site_id_2) says site_id_1 or site_id_2 exist. i've tried: validates_uniqueness_of(:site_id_1 && :site_id_2) doesnt helped me. you should use scope param of validates_uniqueness_of validator: validates_uniqueness_of :site_id_1, scope: :site_id_2

php - Yii - Custom access control criteria -

i developing application using yii framework. in situation want create custom filter. example, normal filters like: array('allow', // allow users perform 'index' , 'view' actions 'actions'=>array('view'), 'users'=>array('*'), ), now, in array index users can put admin , @ or * . wanted know if it's possible customize in way not these 3 parameters used. in system, have set of user roles (which have created in database). there's 1 user called role 'general'. can view pages. there's type of user role of 'business_admin' role can allow him access pages 'general' user's pages. could implemented having: array('allow', 'actions'=>'the_admin_actions', 'users'=>'business_admin', ), please help! that wont work need users either ? * or @ unless have actual use

c# - Multi UI thread in WP8? -

i want control ui elements thread , others different thread in wp8. there way make muulti ui thread this? me. in order update ui multiple threads, can use dispatcher deployment.current.dispatcher.begininvoke(() => { // code modify ui }

javascript - Append HTML element if it doesn't already exist -

<p id="main_class"> <span class="new_class"></span> </p> in following code wanted append <span class="new_class"></span> if doesn't exists in main_class , if exists prevent appending div. i tried following code jquery(".main_class").append('<span class="new_class">hello</span>'); you can use :not , :has selectors together: jquery("#main_class:not(:has(.new_class))").append('<span class="new_class">hello</span>'); note main_class id , select hash ( # ) jsfiddle

android - Handle custom view's different touch states -

i have custom view, extending relativelayout , using list item in listview . it's rectangle funky angle on left. depending on return in ontouchevent , can end in 2 possible states: the list item display pressed state , return unpressed state not send click listview. the list item remain in pressed state (and can't out) send click listview fine. i have never done custom views of type before appreciate advice. assume i'm missing simple, i've spent way time on @ point go on without asking questions! here's code: public class listitembackgroundview extends relativelayout { private final path path = new path(); private final paint brush = new paint(paint.anti_alias_flag); private static int mbackgroundcolor = -1; private static int mpressedbackgroundcolor = -1; private static int mangleoffset = -1; private boolean ispressed; public listitembackgroundview(context context) { super(context); setwillnotdraw(false)

Android and OpenGL: can't call glGetString(..) -

would please explain problem simple code determining opengl extensions : string extensions = javax.microedition.khronos.opengles.gl10.glgetstring(gl10.gl_extensions); if put in code, i'm getting error: "cannot make static reference non-static method glgetstring(int) type gl10" so doesn't compile. i'm using adt 22.6.1 , sdk 22.6.1 . project doesn't create opengl -related classes, gets info. thanks you can data gl10 object, example: http://developer.android.com/reference/android/opengl/glsurfaceview.renderer.html#onsurfacecreated(javax.microedition.khronos.opengles.gl10, javax.microedition.khronos.egl.eglconfig)

android - First fragment to be added to the main activity when application starts up -

suppose creating android application has navigation drawer , set of fragment s. when user clicks on option in navigation drawer corresponding fragment loaded. application has 1 activity ( main activity ) , has no view . when application first started fragment gets loaded main activity ? how application know fragment loaded first without user interaction? how set custom fragment loaded automatically when application starts? thank you you perform same fragmenttransaction use replace fragment on user interaction , in oncreate() method of activity. have check if savedinstancestate null this: @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); if(savedinstancestate == null) { fragmentmanager manager = getfragmentmanager(); fragmenttransaction transaction = manager.begintransaction(); transaction.replace(r.id.flfragmentcontainer, mainfragmen

node.js - Meteor.js - mongodb - Leaflet.js - geo query from client to server - $within $box refresh - stack call size exceeded -

so have meteor.js project 'server' , 'client' folders. in there have leaflet.js map. inside server.js have query show markers within bounding box. works fine. trying update marker when map moved encompass map's bounding box. in ./server/server.js have startup methods: meteor.startup(function () { meteor.methods({ buildcollections: function() { locations = new meteor.collection('locations'); locations._ensureindex({'geometry.coordinates':'2dsphere'}); }, teststub: function(tst) { console.log("test stub"); return tst; }, showboundingbox: function(mapbox) { return locations.find({ 'geometry.coordinates': { $within:{ $box:mapbox } } }); } }); meteor.

sql - MySQL Order of Index Checks -

i running mysql , have simple table below: create table `new_schema`.`test1` ( `id` int not null auto_increment, `unique1` varchar(45) null, `unique2` varchar(45) null, primary key (`id`), unique index `unique1_unique` (`unique1` asc), unique index `unique2_unique` (`unique2` asc)); i add row such: insert `new_schema`.`test1` (`unique1`, `unique2`) values ('x', 'x'); i add row same values in unique unique columns: insert `new_schema`.`test1` (`unique1`, `unique2`) values ('x', 'x'); i error expected: 11:54:06 insert `new_schema`.`test1` (`unique1`, `unique2`) values ('x', 'x') error code: 1062. duplicate entry 'x' key 'unique1_unique' 0.203 sec my question is, how change order in mysql checks unique values entered. so, given example above, provided 2 violations of unique entries (unique1 , unique2), want check unique2 first, error this: 11:54:06 insert `new_schema`.`test1` (`uniqu