Posts

Showing posts from July, 2010

python - can you use pydictionary in google app engine? -

i'm trying use pydictionary in google app engine application error. don't error when use outside google application. i've added third party library (properly) imports without errors don't know why. here's error: searching.py", line 63, in getkey assert isinstance(word.keys, object) attributeerror: 'nonetype' object has no attribute 'keys' and here's code function: def getkey(term): dictionary = pydictionary() word = dictionary.meaning(term) assert isinstance(word.keys, object) results = word.keys() newresults = [] result in results: newresults.append(str(result)) return newresults[0] it works outside app engine project, not inside... you should go , @ exception , try , understand telling you. searching.py", line 63, in getkey assert isinstance(word.keys, object) attributeerror: 'nonetype' object has no attribute 'keys' let's trace through code. fo...

Configuring Coldfusion On IIS -

i have export classic asp/asp.net 2.0 web site uses coldfusion 8, windows server 2003 iis6 windows server 2012 , iis 8. i got working except setting coldfusion work iis. pages using coldfusion have .cfm extension. i tried follow link here did not work http://www.adobe.com/devnet/coldfusion/articles/iis-configuration.html when try add handlers in iis, see warning saying site in classic mode , need manage managed handlers directly in config file. i tried add handlers using appcmd this: appcmd set config /section:handlers /+[name='cfmhandler',path='*.cfm',verb='*',type='c:\coldfusion8\runtime\lib\wsconfig\jrun_iis6.dll',precondition='integratedmode'] then added wildcard script map in iis per link, seems created , entry in web.config of site. <system.webserver> <handlers> <add name="jwildcardhandler" path="*" verb="*" modules="isapimodule" scriptprocessor="c...

image - How to change img to amp-img with jQuery? -

accelerated mobile pages (amp) project original <div class="thumbnail"> <img src="myimage.jpg" alt="an image"/> </div> result <div class="thumbnail"> <amp-img src="myimage.jpg" width="1080" height="610" layout="responsive" alt="an image"></amp-img> </div> how jquery ? use .replacewith() api replace content : $('.thumbnail').find('img').replacewith(function () { return '<amp-img src="'+this.src+'" width="1080" height="610" layout="responsive" alt="'+this.alt+'"></amp-img>' });

sql server - Query to get the accounts shows no movement in February 2016 and the balance is less than $ 2,000.00 -

Image
i try make script query need in sql, try accounts showed no movement in specified month , balance less $ 2000 though try make in group by, not given me idea of how divide customers made movements among did not move accounts, because script this: declare @fechamovimiento varchar(10) set @fechamovimiento = '0000-00-00' if not exists (select * [dbo].[cuentasbancarias] inner join [dbo].[depositos] b on a.cuentaid = b.cuentaid inner join [dbo].[retiros] c on a.cuentaid = c.cuentaid b.fechamovimiento >= @fechamovimiento , b.fechamovimiento >= @fechamovimiento , c.fechamovimiento >= @fechamovimiento , c.fechamovimiento >= @fechamovimiento ) begin raiserror('no existen clientes sin movimientos en el mes') end if exists(select * [dbo].[cuentasbancarias] inner join [dbo].[depositos] b on a.cuentaid = b.cuentaid ...

webpack - How to debug an error in reactjs -

minified code in reactjs using webpack getting error, pull down older branch no changes working before. still getting same error thinking maybe has changed reactjs or webpack. can suggest how debug find error. uncaught error: invariant violation: findcomponentroot(..., .0.0.0.0.0): unable find element. means dom unexpectedly mutated (e.g., browser), due forgetting <tbody> when using tables, nesting tags <form>, <p>, or <a>, or using non-svg elements in <svg> parent. try inspecting child nodes of element react id `` this due browser upgrade, rather react. in cases browser automatically 'fix' problems html, mentioned in warning react. if create react component uses table this: <table> <tr> <td>a</td> <td>1</td> </tr> </table> then browsers try out adding more semantically correct <tbody> tag. <table> <tbody> <tr> <td>a</t...

Dynamically add images to Android WheelView -

i have been working on issue days now. using kankan android wheel example/library, wanting dynamically add images wheel when button pressed. image added depends on button's text. seems easy task, perhaps missing something. tried calling adapter's notifydatachangedevent() after passing , adding selected image adapter's list of cached images. debugging has showed images being added list of images, not showing on wheel. if please me out problem appreciate it! code: public void additem(string text) { for(item c: item.values()){ if(c.getname().equals(text)) { slotmachineadapter.addimage(c.getimage()); break; } } slotmachineadapter.notifydatachangedevent(); } adapter private class slotmachineadapter extends abstractwheeladapter { // image size final int image_width = 700; final int image_height = 150; // slot machine symbols private final int items[] = new int[] { r.mipmap.ic_flipper...

create polymer custom element using paper-listbox with filter -

i create custom elements in polymer using paper-listbox filter (search). started code below. however, thing not correct code. need on <dom-module id="employee-list"> <template > <paper-input on-change="filter" floatinglabel id="searchemployee"></paper-input> <paper-listbox class="dropdown-content"> <template is="dom-repeat" items="[[getactiveemployees]]" flex> <paper-item value="[[item.employeecode]]" class="dropdown-item">[[item.employeename]]</paper-item> </template> </paper-listbox> </template> <script> polymer({ is: 'employee-list', properties: { getactiveemployees: { type: array, value: [], notify: true }, filtervalue: { type: string, notify:tr...

ios - Write ID3 Tags with OBJC -

so need write new id3 tags audio file. try use 2 methods. first . i used core audio, , read tags, -(void)getinformationaudiofile { //get title , artist information audio file //read raw id3tag size uint32 id3datasize = 0; char *rawid3tag = null; audiofilegetpropertyinfo(inputfile, kaudiofilepropertyid3tag, &id3datasize, null); rawid3tag = (char *)malloc(id3datasize); //read raw id3tag audiofilegetproperty(inputfile, kaudiofilepropertyid3tag, &id3datasize, rawid3tag); cfdictionaryref pidict = nil; uint32 pidatasize = sizeof(pidict); //this key returns other dictionary, works in ipod library audioformatgetproperty(kaudioformatproperty_id3tagtodictionary, id3datasize, rawid3tag, &pidatasize, &pidict); free(rawid3tag); nsdictionary...

ios - Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFSet addObject:]: attempt to insert nil' -

i'm trying run loop in app delegate initialize core data crashes after random number of runs without changing of code , it's @ managedcontext.save(). check data it's trying save when crashes , there's nothing should problem. for(var = 0; <= bodycount; i++){ let appdelegate = uiapplication.sharedapplication().delegate as! appdelegate let managedcontext = appdelegate.managedobjectcontext let entity = nsentitydescription.entityforname("bitem", inmanagedobjectcontext:managedcontext) let newitem = nsmanagedobject(entity: entity!, insertintomanagedobjectcontext: managedcontext) newitem.setvalue(itemhref, forkey: "href") newitem.setvalue(itemtitle, forkey: "title") newitem.setvalue(itemurl, forkey: "url") newitem.setvalue(itemindex, forkey: "index") newitem.setvalue(itemsubtitle, forkey: "subtitle") newitem.setvalue(itemimgsrc, forkey: "imgsrc") { ...

Java answer to Top Coder program fails for test case and I cant figure out why -

Image
im trying solve topcoder problem , solution works example inputs excepts 1 im trying run right now, in main. it outputs 48 when should output 92 . know has if (mindefeatable >= bestcase) { return bestcase;} in minimalfatigue function. know because if remove that, gives correct answer particular test case subsequently stops working on others. pulling hair trying figure out, appreciated. problem statement magical girls girls have magical powers. fight against evil protect earth. cosmic enemies have attacked earth, , magical girls going fight them. given magicalgirlstrength describes magical girls: each i, magicalgirlstrength[i] strength of 1 of girls. given enemystrength , enemycount describe enemies: each i, there enemycount[i] enemies each have strength enemystrength[i]. each magical girl fight 1 enemy @ time. magical girl defeat enemy if strength greater or equal strength of enemy. at beginning of fight fatigue of each magical girl 0. each time magical girl defeats en...

swift - How do I move an object back and forth with touch in iOS -

i need move image , forth based on user's finger. want able touch screen , image move towards touch. image should move left right not , down , add limits how far image can go towards 1 side of screen. i know sounds lot have tried many things of have caused problems. first time able click , drag image when clicked somewhere else image appear there wouldn't move there appeared. the second thing tried allowed me drag image when clicked out of image wouldn't move towards finger @ all. @ point i'm frustrated , appreciate help. here code. import uikit class viewcontroller: uiviewcontroller { @iboutlet var person: uiimageview! override func viewdidload() { super.viewdidload() } override func touchesbegan(touches: set<uitouch>, withevent event: uievent?) { touch in (touches ){ let location = touch.locationinview(self.view) if person.frame.contains(location){ person.center = location...

CSS animation lag on Android Cordova app -

position: fixed; top: 0; right: 0; bottom: 0; left: 0; width: 100%; height: 100%; background-color: #fff; overflow: hidden; display: -webkit-flex; display: -ms-flexbox; display: flex; -webkit-flex-direction: column; -ms-flex-direction: column; flex-direction: column; -webkit-animation-delay: 0; animation-delay: 0; -webkit-backface-visibility: hidden; -webkit-transform: translate3d(0, 0, 0); -webkit-transform-style: preserve-3d; -webkit-perspective: 1000; why <div> above css applied experience lag when animated? inside cordova app, animation extremely clean , smooth on ios, lags in android. other elements in app on android animating smooth, element. i'm hardware accelerating, using transforms etc... no luck. here animation being used on elements: @keyframes slideinright { { z-index: 10; transform: translate3d(100%, 0, 0); visibility: visible; } { z-index: 10; transform: translate3d(0, 0, 0); } } did test crosswalk webview engine ?...

ruby - ChefSpec unable to find cookbook -

when run unit test case (written in chefspec) following error: chef::exceptions::cookbooknotfound: cookbook azuredns not found. if you're loading azuredns cook book, make sure configure dependency in metadata following spec file, recipe file , metadata file azuredns/spec/get_azure_token_spec.rb require 'chefspec' require 'rest-client' describe 'azuredns::get_azure_token' let(:chef_run) # step provider runner = chefspec::solorunner.new(step_into: ['azuredns_token']) # read test data json file file_path = file.expand_path('test_data.json', __dir__) file = file.open(file_path) contents = file.read node_attr = json.parse(contents) # load test data node object runner.node.consume_attributes(node_attr) runner.converge(described_recipe) end before(:each) # mock post method of restclient allow(restclient).to receive(:post) .and_return({ access_token: 'i-am-a-token...

postgresql - Multiple connection pool on same PostgresSql -

my application has 2 sections mainly, user interface written in angular uses django python end. heavy map reduce kind of process. both uses postgres up, doubt if use same connection pool both, @ time when map reduce runnning due heavy lookup other application won't work because of no connection available. there work around this.(avoiding postgres in backlog) ps: using pgbouncer pooling simplest approach separating 2 sections. @ least respect connection resources. (whether e.g. memory consumption , gc benefit restructuring not asked for) you may achieve using 1 of following approaches: use 2 separate pools, 1 each section. way, may setup pools according connection requirements per section. change code maintain sufficient "free" resources other section. quite tedious , useful resource requirements need fine grain control depending on internal state of algorithms. usually you'd want go suggestion 1.

ios - UIColor Category Linker Errors -

earlier today tried add unit tests xcode project static framework creating. after adding unit tests target project, able run unit tests template , have tests catch default assertion. then, after importing file wanted test new sentestcase subclass, tried run test uicolor category failed building test due linker errors. text of linker errors follows: undefined symbols architecture i386: "_cgcolorgetcomponents", referenced from: -[uicolor(colorextension) hexvalue] in staticframework(staticframework) "_cgcolorgetnumberofcomponents", referenced from: -[uicolor(colorextension) hexvalue] in staticframework(staticframework) ld: symbol(s) not found architecture i386 clang: error: linker command failed exit code 1 (use -v see invocation) next, found these 2 references in project. both live in category under following function: - (nsstring *)hexvalue { uicolor *color = self; const size_t totalcomponents = cgcolorgetnumberofcomponents(color.cgc...

Android App hang( losing activity context) issue if open from background after long time? -

in android application have issue in if open app background after time (2 or 3 hour) , time app got unresponsive. have checked log cat regarding , came know ever using context of activity (like storing value in shared preference , progress dialog, setting typeface text view) getting error . little sure because loose context of activity . please suggest in situation . how can save context in case of memory leak . or if memory leak occurs how app can detect this? if kill app , open start works normally. in advance .

office 365 onedrive does not support paging -

i have read document of office 365 onedrive. have send 2 http requests: 1)https://graph.microsoft.com/v1.0/me/drive/root/children?$orderby=name&$top=5&$skip=0 2)https://graph.microsoft.com/v1.0/me/drive/root/children?$orderby=name&$top=5&$skip=5 but have received same result,anyone tell me whether office 365 onedrive supports paging? onedrive's paging model little different skip+take. you'll make query like: get https://graph.microsoft.com/v1.0/me/drive/root/children?$top=5 and in response should see usual array of values, along property called @odata.nextlink . you'll want take url use request next page: "@odata.nextlink": "https://graph.microsoft.com/v1.0/me/drive/root/children?$skiptoken=asdgasgsd" get https://graph.microsoft.com/v1.0/me/drive/root/children?$skiptoken=asdgasgsd you keep doing until don't @odata.nextlink returned.

createjs - How to play a MovieClip x times -

the movieclip class in easeljs module has loop property can set true or false, causing movie clip play infinitely or once. http://www.createjs.com/docs/easeljs/classes/movieclip.html i need play movie clip (banner ad) 3 times. how can done? this init function: <script> var canvas, stage, exportroot; function init() { // --- write js code here --- canvas = document.getelementbyid("canvas"); images = images||{}; var loader = new createjs.loadqueue(false); loader.addeventlistener("fileload", handlefileload); loader.addeventlistener("complete", handlecomplete); loader.loadmanifest(lib.properties.manifest); } function handlefileload(evt) { if (evt.item.type == "image") { images[evt.item.id] = evt.result; } } function handlecomplete(evt) { exportroot = new lib.banner_728x90(); stage = new createjs.stage(canvas); stage.addchild(exportroot); stage.update(); stage.enablemouseover(); creat...

java - Returning error list in jersey rest service -

in our project using rest service(jersey). in 1 of requirement return list of missing mandatory parameters client. right using exception mapper can return single error message, public class mandatoryparametermissingexception extends runtimeexception { private static final long serialversionuid = 1l; public mandatoryparametermissingexception(string message) { super(message); } public class mandatoryparammissingexceptionmapper implements exceptionmapper<mandatoryparametermissingexception> { @override public response toresponse(mandatoryparametermissingexception ex) { errormessage errormessage = new errormessage(ex.getmessage(), 404, "document source:todo"); return response.status(status.not_found) .entity(errormessage) .build(); } private string errormessage; private int errorcode; private string documentation; public errormessage() { } public errormessage(s...

java - While loop, can't seem to get it to get the proper data -

write class asks whole number num make sure greater 0 (data validation), , calculates , returns sum of following series of numbers: 1/num + 2/num-1 + 3/num-2 + …. (num-1)/2 + num/1 don't caught in integer division! test method invoking num = 2; expect result 2.5 . public class lengthseries { public static void main (string[] args) { //variable declarations scanner keyboard = new scanner(system.in); int num; int sum = 0; // sum int ctr = 1 ; //counter //accept required data system.out.print ("enter whole number greater 0 : "); num = keyboard.nextint(); //process data in order determine data while ( num <= 0){ system.out.println ("sorry number invalid"); system.out.println ("please write whole number greater 0 : "); num = keyboard.nextint(); } while (num <= 0){ sum +...

How to calculate upload/download 3g speed in android application? -

in application, need show upload/download 3g speed in current time. can please me how solve problem? thank much! use facebook library speed test https://github.com/facebook/network-connection-class

google chrome extension - Entering omnibox-mode programmatically -

i want extension controlled omnibox. chrome.omnibox api lets me register keyword, means lot of clicking or typing extension. example, have ctrl+l select omnibox, type letters extension , space/tab. can "omnibox mode extension" entered programmatically? i.e. there api call can make take user's keyboard focus omnibox in switched mode extension? want replace sequence of clicks/typing single keyboard shortcut allow user interact extension via omnibox. this not possible. see being implemented in 2 ways: 1. suggest, allowing extension enter omnibox programmatically. i'm not sure if that's idea - stealing keyboard focus annoying user, , possible security risk. 2. adding "enter omnibox mode" target commands api . way user can configure keyboard shortcut or disable entirely.

delphi - Infinity loop on Message Queue -

i'm working injected dll inside process. in dll create 1 thread among other things set 2 timers , keyboardhook (setwindowshookex wh_keyboard_ll)... make hook , 2 timers work, needed create 1 message pump procedure. , call message pump last thing on thread, can see in thread.execute: procedure mymainthread.execute; begin while not terminated begin mythread:= self; startkeyboardhook; startup; settimer(0, 0, 60000, @mymainthread.contacthome); settimer(0, 0, 40000, @mymainthread.mapproc); createmessagepump; terminate; end; end; ok, after createmessagepump call, terminate, because believe message pump 1 infinity loop, , if out that, wrong occurs need terminate thread. createmessagepump on this: procedure mymainthread.createmessagepump; var appmsg: tmsg; begin while getmessage(appmsg, 0, 0, 0) begin translatemessage(appmsg); dispatchmessage(appmsg); end; //if needed quit procedure use postquitmessa...

How to capture console output in R language? -

i'm running script of r, , script i'm using function system() delete directory, problem have problem it, , need know specific problem, don't have opened console verify, how can capture of output, message, , exception in console, , may redirect file. i'm trying sink(), , capture.output() don't know why doesn't work me. example: system("rm -r ../dirtodelete") "capture message throwing function" thanks all. see help(system) details setting intern may need: r> txt <- system("date", intern=true) r> txt [1] "tue sep 24 10:08:23 cdt 2013" r> as removing files (and directories), see help(unlink) .

ssl - Compiling C file on Solaris with OpenSSL includes -

i trying compile c file have written has include #include <openssl/evp.h> on solaris 10. system openssl files (including evp.h) located under /usr/local/ssl/include/openssl , can't them picked running following command: gcc -o2 -fpic -shared -static-libgcc -i$java_home/include -i$java_home/include/solaris -m64 -lcrypto -lm -std=c99 -o libencrypt64.so encrypt.c i've tried adding path headers ld_library_path , path still same errors: encrypt.c:54:25: openssl/evp.h: no such file or directory ... , associated type's not found errors. can tell me i'm going wrong please? i've never seen $java_home explicitly put in gcc command before. value of $java_home supposed be? can try adding necessary path directly gcc command? add -i/usr/local/ssl/include

ruby on rails - ActionView::MissingTemplate for create action -

when submit form receive error: missing template letsgos/create, application/create {:locale=>[:en], :formats=>[:html], :handlers=>[:erb, :builder, :raw, :ruby]} . what not understanding why it's looking /create when view create from _form.html.erb . shouldn't need make /create file. missing here? letsgos_controller.rb: before_action :signed_in_user, only: [:create, :destroy] def create @letsgo = current_user.letsgos.build(letsgo_params) if @letsgo.save flash[:success] = "date posted!" redirect_to root_url end def destroy @letsgo.destroy redirect_to root_url end users_controller: def show @user = user.find(params[:id]) @letsgos = @user.letsgos.paginate(page: params[:page]) @letsgo = current_user.letsgos.build if signed_in?' end letsgo.rb: belongs_to :user default_scope -> { order('created_at desc') } validates :content, presence: true, length: { maximum: 360 } validat...

javascript - Google Web Map checkboxes work in Firefox & Chrome, but do not function in IE -

my google map website working in firefox , chrome, checkbox functionality not working in ie. can tell me why, need deploy asap , having issues ie. client uses ie 8. help. <!doctype html> <!-- saved url=(0014)about:internet --> <html> <head> <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no"> <meta name="apple-mobile-web-app-capable" content="yes"> <meta charset="utf-8"> <link rel="stylesheet" href="http://code.jquery.com/mobile/1.1.1/jquery.mobile-1.1.1.min.css" /> <link rel="stylesheet" type="text/css" href="included.css"> <script src="http://code.jquery.com/jquery-1.7.1.min.js"></script> <script src="http://code.jquery.com/mobile/1.1.1/jquery.mobile-1.1.1.min.js"></script> <title>web map too...

64bit - Analyze 64-bit DLL from within T4 template in Visual Studio (32-bit) using Reflection -

i analyse dll within t4 template using reflection, can generate code based on results of reflection analysis. know envdte better option, not possible in case several reasons. the problem reflection dll 64-bit dll , if load within t4 template badimageformatexception because trying load 64-bit dll 32-bit process (visual studio 2012). is there way analyse contents of dll within t4, preferrably using reflection? i have thought writing console application analyses dll, writes results xml file consumed t4 template, not favorite solution... btw: dll managed c++ dll. roslyn no option either because supports c# , vb). a thing worth testing if loading assembly reflection works you. did experiment bit , seems succeeds loading 64bit assembly 32bit process then. can't execute should ok if understood correctly: for full sample at: https://github.com/mrange/codestack/tree/master/q18985529/reflect var assembly = assembly.reflectiononlyload ("x64"); var types = ...

Is there a situation in delphi where a GOTO is the only solution? -

the goto statement taboo @ work. following question born... is there situation possible goto valid solution? originally goto added pascal error handling, including inter procedural forms borland(/embarcadero) never implemented (example: gotoing inner procedure parent), borland never implemented other inner function functionality passing inner functions procedure-typed parameters.(*) in way goto can considered precursor exceptions. there still practical uses: last time checked, jumping out of nested if statement goto still faster in delphi letting code exit nested if naturally. optimizations these used in e.g. compression code, , other complex tree processing code nested loops or conditional statements. such routines still use goto errorhandling, because faster. (exceptions not slow, border conditions inhibit optimizations). one see part of plain pascal level of object pascal, c++ still allows plain c completely. (of course, since optimized compression co...

Groovy Grape "method without body" error -

below code snippet , below error. doing wrong that's obvious? i'm new grapes. @grab('com.microsoft:ms-sql-server-jdbc-dependencies') grabconfig(systemclassloader=true) import groovy.sql.sql println "hello world" org.codehaus.groovy.control.multiplecompilationerrorsexception: startup failed: cfwdupdate.groovy: 1: defined method without body. try adding body, or d eclare abstract. at line: 1 column: 1 you missed @ off @grabconfig(systemclassloader=true)

sql - access query with multiple where clauses -

i trying run query in access carries out 2 stage currency conversion. takes exchange rate exchange rates table in transactional currency , takes exchange rate of region. is there way within 1 query. have attempted below getting syntax errors. update report set report.[conversion rate] = ( ( exchange_rates.rate exchange_rates.code = report.[transaction currency code] ) / ( exchange_rates.rate exchange_rates.code = report.[regional currency code] ) ) you can use access update join syntax join exchange rate table report table: update (report inner join exchange_rates tr on tr.code = report.[transaction currency code]) inner join exchange_rates reg on reg.code = report.[regional currency code] set [conversion rate] = tr.rate / reg.rate; n.b. need join twice both exchange rates another option use dlookup function: update report set [conversion rate] = dlookup("rate", "exchange_rate", ...

ios - Value Expression during Core Data migration causing unusual result -

Image
i have ios app core data model i'm trying migrate new version. there 1 new field (photofilename) in v2 of core data model, , it's value can generated existing entries using v1 field (dateinseconds) , appending '.jpg'. for example version 1 | version 2 field data | field data ========================================|============================== dateinseconds (integer 32) 401760341 | dateinseconds (integer 32) 401760341 | photofilename (string) 401760341.jpg i have created core data mapping model (partially shown below), , database appears migrate. unfortunately, photofilename created not give correct number in front of '.jpg'. example, might return '275263312.jpg' instead of '401760341.jpg' now admittedly, i've never used such mapping before , apple documentation here seems limited. researching elsewhere appe...

Github: is it possible to download master archive via ssh (without the git client) -

i trying connect git repository hosted on github router. the router has wget not support ssl connections; github allows http downloads via ssl. not option update firmware of router enable wget support ssl connections; or update router git client. the router can access github via ssh. for example, ssh git@github.com -i git.key git-receive-pack username/repo.git is possible download either individual files in repository or master archive using similar ssh command? the other alternative can think of setup web proxy on remote server can use wget access repository, adding dependency process. thanks, if create clone using git clone --bare ssh://url/repo.git master archive. theoretically if scp command in open (it not) can copy using scp

c# - Change return value of the method with attribute -

i want have class (pseudocode): public myclass { private bool isvalid; [checkvalid] public int dosomething() { return 1; } } now, want [checkvalid] attribute check isvalid property, , if true, allow dosomething() execute, or, if false, make dosomething() return default(int) (or @ least make code inside dosomething() inaccesible) that not feature of c#: attributes not executed such. there are, however, extension frameworks postsharp would allow - rewrites code @ il level inject functionality, typically based on attributes. requires additional tooling. in c# "out of box", best bet be: public int dosomething() { checkvalid(); // might throw exception return 1; }

javascript - Focus on child div un-focus the parent, how to keep parent focused? -

title says everything... here code: problem generated when focus on toolbar2. keep focused parent div while child has focus on, possible? $(document).ready(function () {     $("#area_testo").focusin(function () {         $(this).css("background-color", "#ffffcc");         $("#toolbar2").fadein(1000);     });     $("#area_testo").focusout(function () {         $(this).css("background-color", "#ffffff");         $("#toolbar2").fadeout();     }); }); and here html: <div id="area_testo" style="display:block; margin-top:40px;"> <div id="contenitore_toolbar2"> <div id="toolbar2">/*hidden div stuff inside*/</div> </div> <div id="textbox" contenteditable="true"> <p>lorem ipsum</p> </div> </div> thank in advance.

actionscript 3 - Adobe Flex Object not "writable" -

strange situation here: object declared public "writable" 1 method , not writable another. here code parts: <s:application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx" xmlns:ns1="*" xmlns:local="*" minwidth="955" minheight="600" width="955" height="600" creationcomplete="init()" currentstate="login" minheight.pocetakpartije="1200" minwidth.pocetakpartije="1000"> ... <fx:script> <![cdata[ import flash.display.sprite; import flash.events.event; im...

java - How do I change the IntelliJ IDEA default JDK? -

Image
i use intellij idea development environment, , maven dependency management. build project structure (directories, poms, etc) outside of idea , import project idea using import project external model . works great, except in poms specify maven-compiler-plugin should use jdk 1.6, , when import, idea informs me language level changed , language level changes take effect on project reload , , prompts reload project. annoying because use same jdk version. how change default jdk intellij idea uses, don't have reload project every time import new project? this setting changed in "default project structure..." dialog. navigate "file" -> "other settings" -> "default project structure...". next, modify "project language level" setting desired language level. intellij idea 12 had setting in "template project structure..." instead of "default project structure..."

ruby on rails - No route matches /signout when i disable javascript -

to signing out user have link : link_to "sign out", signout_path, method: "delete" this link work fine , have route /signout in routes file, when disable javascript , click link says : no route matches [get] "/signout" , what's problem here ? without scripting, browsers can send non-get request submitting form -- clicking link get. when specify different method link_to , adds javascript hook link dynamically creates , submits form appropriate method. if scripting disabled, browser submits request would. this explained in docs here (look under options ). if app needs support users scripting disabled, can use button_to instead of link_to , , style button link.

javascript - Should I use transform instead of redraw? -

i have several charts redraw everytime zoom/pann using d3 brushes. but, when have tons of rendered elements, redrawing starts little bit slow. instead of redrawing elements everytime move brush, wondering whether or not it's feasible transform (translate) drawn elements, , redraw whenever need update data. i think increase visualization performance lot whenever panning right/left, wouldn't ? any insights ? in general, less touch dom better performance be. details browser , platform specific, in general pecking order of performance @ high level (ordered expensive least): creating , removing dom elements. modifying properties of existing dom elements. in memory javascript (that is, not involving dom @ all... e.g. array iteration). so if can result want modifying targeted subset of existing elements transform attribute, guess better off. of course, it's impossible certainty without seeing actual code , use case.

c# - Passing dynamic parameters with ExpandoObject -

i have function prototype looks kind of this: public void dothings(string sql, dynamic dparams); it kind of sql querying parameters. didn't write have use it. works fine when this: dothings("select * sometable myval1=@v1 , myval2=@v2", new { v1 = new dapper.dbstring() { value = "yay", isansi = true, length = 50 }, v2 = new dapper.dbstring() { value = "really", isansi = true, length = 32 } }); but not when first put dynamic params expandoobject: dynamic dynparams = new expandoobject(); dynparams.v1 = new dapper.dbstring() { value = "yay", isansi = true, length = 50 } dothings("query here", dynparams); the query returns no results. don't want call dothings() , write new block ten times ten dif...

creating element in javascript not working? -

<!doctype html public "-//w3c//dtd html 4.01 transitional//en"> <html> <head> <script language="javascript" type="text/javascript"> function mail_login(url) { alert(url); var form=getelementbyid('autologin'); var input1=document.createelement('input'); input1.id='autologin_name'; input1.type='text'; input1.name='username'; form.appendchild(input1); var input2=document.createelement('input'); input2.id='autologin_password'; input2.type='text'; input2.name='password'; form.appendchild(input2); document.getelementbyid('autologin').action=url; document.forms[0].username.value = 'xxx'; document.forms[0].password.value = 'xxx'; document.forms[0].submit(); } </script> </head> <body> <form id='autologin' method="post" target...

Making a function according to a formula (Python) -

Image
i having trouble question see on included image. little knowledge have in python struggling find out begin problem. in particular, how make function according formula? user must able enter values x_i , x_(i-1). answers appreciated. don't expect full answer, idea of how can begin this... let's break down. first, how 1 create function pathlength ? this: def pathlength(x, y): return 42 # length 42 miles as can see, accepts x,y parameters specified in problem. rather compute answer, returns made-up answer. more on how find answer in minute. the way user might invoke function so: length = pathlength([0, 7, 9, 5, 2, 0], [0, 1, 3, 2, 2, 0]) as can see, i've passed list of x values , list of y values. now know how declare function, , how invoke function, left math. problem says need sum terms of series. our first step create terms in convenient manner. series runs 1 n-1 (that is, summation has 1 fewer steps our data has. to represent values, ...

javascript - setTimout on loading animation after clicking submit -

i have animation funciton show 2 seconds once submit button clicked. not sure how put using settimeout function $(window).ready(function () { "use strict"; var countdown = 2000; settimeout(function()){ var startanimation = function () {//this need animate 2 seconds $(".normal-actions").hide(); $(".execute-actions").show(); }; $("form").attr("action", "url"); $(".btn-submit").on("click", function () { $("form").submit; }); }); } current code (could not put in comments) page stays in loading , not redirect: $(window).ready(function () { "use strict"; var countdown = 2000; settimeout(function(){ $(".normal-actions").hide(); $(".execute-actions").show(); }, countdown); $("form").attr("action", "url"); $(".btn-submit").on("click", function () { $(...

php - codeigniter - what if I don't have any model? -

it's first time i'm using php framework , have question regarding design pattern. let's i'm trying build php app has contact page (which ask name, email address comment etc , once submitted use mail function send email admin). know view gonna be, use controller render view, should model? i'm not going load database or save database. in case should skip model? the gritty details go in model. simple contact form has lots of gritty specific details: names of fields, specific validation rules, etc. the controller boss - validate form! it not how validate it, , doesn't need details of each field in form. if form validates - controller calls next view. if not validate - controller shows form again , maybe passes specific error messages. the validation details contact form - put in model. the emailing of form: content of email, taking form values , putting email, email goes to, details of sending email - work model. what gain us? when client c...

windows - Did gfortran drop svml support on Cygwin? -

i having trouble compiling fortran code on brand-new cygwin installation, can trace undefined references functions in intel svml (short vector math library) library. specifically, getting errors of form import_gamess.o:import_gamess.f90:(.text+0xb58b): undefined reference `vmldpow2' and function vmldpow2 part of svml library, shown here , pass option gfortran in makefile as f90 = gfortran -m64 -msse2 -o3 -march=native -mtune=native -fopenmp \ -ffast-math -fassociative-math -freciprocal-math -ffinite-math-only \ -fno-signed-zeros -fno-trapping-math -msahf -mmovbe -mrecip \ -mveclibabi=svml -ftree-vectorize -fexternal-blas -fblas-matmul-limit=50 -static (i using libraries lapack , lblas .) the file compiled fine on laptop, running cygwin 1.7.17 on windows 7. (this installed circa 2013-04-18; gfortran version there 4.5.3.) trying replicate installation on new desktop, running windows 7, , have installed cygwin 1.7.25. getting above errors on both 32-bit...

asp.net - Unable to fit data into the GridView cell with in fixed width -

i have column has has long text have scroll end see it. can out fitting content in fixed width cell ui: <asp:gridview id="gridview1" runat="server" onpageindexchanging="pageindexchanging_click" style="height: 166px; width: 217px; z-index: 1; left: 16px; top: 252px; position: absolute" emptydatatext="no records within time frame" > <pagersettings lastpagetext="last" /> </asp:gridview> //code behind: private void getdata() { string fromdata = txt_fromdate.text;//" '2013-09-23 11:06:00.077'"; string todate = txt_todata.text;//" '2013-09-23 11:28:25.163' "; string querstring = "select * gt_transaction_log logtimestamp between" +"'"+ fromdata +"'"+ " , " +"'"+ todate + "...

java - Eclipse quicktip wont show "import" suggestions in Linux Ubuntu and Centos -

Image
although i've seen question asked on multiple sites, have not found working solution. issue: when eclipse tooltips pops up, suggested “import” fields remain blank. what i've tried: have changed ubuntu font suggested https://bugs.eclipse.org/bugs/show_bug.cgi?id=412021 have change foreground/background colors suggested https://askubuntu.com/questions/45001/how-to-fix-black-tooltips-in-eclipse , https://plus.google.com/100162564505001485828/posts/whbrbeywpzk i have tested on centos same issue. have tried different versions of adt , eclipse i running ubuntu 13.04 adt eclipse version 4.2.1 this bug identifies problem https://bugs.eclipse.org/bugs/show_bug.cgi?id=412021 to fix, open preferences, go general->appearence->colors , fonts. change font basic -> dialog font "ubuntu". choose droid sans , problem went away.

scala - Oracle trace logs show unexpected sql with invalid table name (upper case) but application not executing -

is possible? have our apps set use table "videos" lower case. don't see query coming oracle trace shows error in trace. select * "videos" gives ora-00942 in application, appears coming insert though. is there i'm not aware of happening here? don't see toupper or select in caps anywhere. maybe in jdbc land somewhere or oracle internal? hid sys operations when processing traces. data store update failure (ora-00942: table or view not exist edit: suspect there bug in keyedentity trait or autoincrement oracle. not found before because nobody uses lowercase table names :) you it's lower case in codebase, enclosed in double-quotes? i.e., select * videos; is not same as select * "videos";

d3.js - Problems with creating a y axis in d3 -

i'm having significant difficulties getting y axis appear on graph. you'll have forgive me because i'm relative beginner @ this, , code not par standards. of challenge of helping me out this. i've gotten x axis work out fine xscale, , when append see @ bottom. y axis not working though, , can't life of me figure out how y axis appear. doing wrong? xscale , yscale 2 first scales, , try append axes @ bottom. in advance this. <!doctype html> <html> <head> <title> digital humanities latin graph</title> <script type="text/javascript" src="http://mbostock.github.com/d3/d3.js"></script> </head> <body> <div id="graph"> </div> <script type="text/javascript"> var romandataset= [ {"year": 1800, "freq": 10.45 }, {"year": 1850, "freq": 9.49 }, {"year...