Posts

Showing posts from May, 2010

ipad - Testing IOS create folder -

found problem bnr ios programming book , archiving data, directory did not exist. easy enough fix, using createdirectoryatpath , seems ok - how test again? how can delete directory , re-run? easy enough on simulator, delete in finder, on ipad or iphone? you found createdirectoryatpath in nsfilemanager docs. if keep searching page, you'll find more info on removeitematurl:error: , removeitematpath:error: .

asp.net mvc - AspNet Identity 2.0 Email and UserName duplication -

my current asp.net mvc 5 project mandates email address username . want upgrade aspnet identity v1.0 v2.0 leverage new features ( see here ). however, aspnet identity v2.0 adds email separate column users table , adds corresponding property identityuser class. i don't want duplicate username new email column. how can map email property of identityuser use existing username column & property? possible ignore email property , skip adding column in users table? has tried this? please share. update this identity 2.0 limitation. cannot ignore email property or leave null. of identity functionality not work. :( you can try 1 of these: try ignore either overriding email property in user class , unmapping or using fluent api. public class applicationuser : identityuser { // .... [notmapped] public override string email { get; set; } } or protected override void onmodelcreating(dbmodelbuilder modelbuilder) { modelbuilder.entity<a...

How to open a file location in my PC using javascript for Apps for office 2013? -

i have created task pane app office 2013 in excel. has few buttons , labels. want open file location on pc on clicking of button. please tell me code i'm new java-script. as far know, there no existing openfile api in javascript office, can use ajax call wcf string existing document , use document.setselecteddataasync method write got string document.

locking - Java inter-process mutex -

i need implement kind of inter-process mutex in java. i'm considering using filelock api recommended in thread . i'll using dummy file , locking in each process. is best approach? or built in standard api (i can't find it). for more details see below: i have written application reads input files , updates database tables according finds in them (it's more complex, business logic irrelevant here). i need ensure mutual exclusion between multiple database updates. tried implement lock table, unsupported engine i'm using. so, want implement locking support in application code. i went filelock api approach , implemented simple mutex based on: filechannel.lock filelock.release all processes use same dummy file acquiring locks.

symfony - How to use if else for a controller variable on twig -

what im trying compare imageowner (variable returned controller) current user <!-- image remove button --> {% if {{ imageowner }} == {{ app.user.username }} %} //line 5 <p>you owner of image</p> <button onclick="deletestuff()">deleted</button> {% endif %} but throws error a hash key must quoted string, number, name, or expression enclosed in parentheses (unexpected token "punctuation" of value "{" inlayoutbundle:frontpage:content-bubble.html.twig @ line 5 the {{ imageowner }} , {{ app.user.username }} return right values, think syntax or logical error use {% if imageowner == app.user.username %} //line 5 <p>you owner of image</p> <button onclick="deletestuff()">deleted</button> {% endif %} {{ imageowner }} slimier echo $imageowner in php. not need wrap variable {{}} when don't want print it.

CSS - Select row table without first column -

i want select row in css without first column. tried this, not working: #testtable tbody tr:not(td:first-child):hover{ /*code*/ } does know answer problem? #testtable tbody tr:hover td:not(:first-child) { /* ... */ } or — if need support older browser, ie8 , ie7 — may write #testtable tbody tr:hover td + td { /* ... */ } this select columns inside tbody except first 1 of each row (when hover row) example: http://codepen.io/anon/pen/aitbr/

c# - Creating RSA public/private key pair with Bouncy Castle or .Net RSACryptoServiceProvider -

so i've messed around bit .net's rsacryptoserviceprovider , bouncy castle able create rsa key pairs , later on x509 certificates. i'm curious if knows if there's difference between these 2 codeblocks, think same thing, pure bouncy castle version takes longer finish. .net bouncy castle: private const int rsakeysize = 4096; public static asymmetriccipherkeypair getkeypairwithdotnet() { using (rsacryptoserviceprovider rsaprovider = new rsacryptoserviceprovider(rsakeysize)) { rsaparameters rsakeyinfo = rsaprovider.exportparameters(true); return dotnetutilities.getrsakeypair(rsakeyinfo); } } pure bouncy castle: private const int rsakeysize = 4096; public static asymmetriccipherkeypair getkeypair() { cryptoapirandomgenerator randomgenerator = new cryptoapirandomgenerator(); securerandom securerandom = new securerandom(randomgenerator); var keygenerationparameters = new keygenerationparameters(securerandom, rsakeysize); var keypa...

Jquery count specific character in div -

i have php code generates <a> tags , final output looks like: <div id='link1'> <a style="font-size:10pt; color: #008056" href="somelink">name</a> <b>;</b> </div> my question how can count of semicolons in div jquery? to including in style attribute,try this: alert($('#link1').html().split(";").length - 1); and without 1 there in attributes: alert($('#link1').html().replace(/(<([^>]+)>)/ig,"").split(";").length - 1); working demo update: find 1 occurence of ; in , remove it: $('#link1 a').each(function(){ if($(this).html().split(";").length==2){ $(this).html($(this).html().replace(";","")) }}); working demo

sql server - TSQL Try / Catch within Transaction or vice versa? -

i'm writing script delete records number of tables, before deletes must return count user confirm before committing. this summary of script. begin transaction scheduledelete begin try delete -- delete commands full sql cut out delete -- delete commands full sql cut out delete -- delete commands full sql cut out print 'x rows deleted. please commit or rollback.' --calculation cut out. end try begin catch select error_number() errornumber, error_severity() errorseverity, error_state() errorstate, error_procedure() errorprocedure, error_line() errorline, error_message() errormessage rollback transaction scheduledelete print 'error detected, changes reversed.' end catch --commit transaction scheduledelete --run if count correct. --rollback transaction scheduledelete --run if there doubt whatsoever. th...

recursion - Python Recursive Function to Check if Palindrome -

this question has answer here: how test 1 variable against multiple values? 16 answers i need define recursive function check if string palindrome. below's code: def palindrome_recur(string): if len(string)==0 or 1: return true else: if string[0] == string[-1]: return palindrome_recur(string[1:-2]) else: return false it passes few test cases, doesn't work string "chipmunks" . can tell me might have overlooked? the problem this: if len(string)==0 or 1: that checks whether either of len(string) == 0 , or 1 true. since 1 true, whole expression true , function returns true. you should use if len(string) <= 1: instead. then, you'll find out problem indexing -2 other answers mention.

c# - Async await in Controller Action: Error: Can not await 'void' -

i using async controller action returns jsonresult. , send notification methods returns void. public async task<jsonresult> setstatus(string msg) { await sendnotification(msg); } i getting error 'can not await 'void' your sendnotification has return task , await keyword definition. it's kind of javascript promise (just give idea), has have done , failed functions, in order able track execution flow of async function.

arm - Assembly code comparison fails for 0xFFE700DE >0xA -

as loop condition using following code. cmp r5 , #0xa bge loop but when value in r5 large, say, ffe700de, comparison fails. because signed value? how can compare unsigned? use bhs instruction, unsigned "higher or same" comparison. see instance this list of arm condtion codes . remember integer registers, value in register cannot really signed or unsigned, it's instruction use interpret value. value bunch of bits.

dynamic - reading into an enum from xml in c# -

i have project working on in c# uses enum. at moment looks . . . public enum temp { carea = 10, careb = 20, carec = 22, cared = 35 } however instead of call same data (as enum) either .txt file or .xml file. either do. save re-build every time have add entry enum (this happens frequently) - easier edit .txt or .xml file. instead of using enum changes dynamically @ runtime suggest use dictionary. class myclass { private dictionary<string, int> tempvalues = new dictionary<string, int>() { { "carea", 10 }, { "careb", 20 }, { "carec", 22 }, { "cared", 35 } } public dictionary<string, int> tempvalues { { return this.tempvalues } } } you still need load values file , fill them: private void readvalues(string path) { foreach(string line in file.readalllines(path)) { string[] tokens = strin...

api - Send data between two android devices over internet without using any intermediate server -

i working on android application, in need transfer data between 2 android devices on internet connection without using intermediate server. sugession provided task follows : using socket programming if use approach, there possibility of changing ip address when device reconnect network. using sip2peer api it seems option, documents of api not clear, not able understand , run android example, if having experience api , please provide me hint of using in android, not getting need maintain server using api or not. please provide me hint, how can achieve task.

Umbraco Images wont load load without www -

i have website works fine in umbraco when loading via www.testsite.com however, when navigate website via url testsite.com, content displayed images not. anything need images displayed? running on umbraco 6.2 a quick not awesome fix set domain hostname believe. right click on home node select 'manage hostnames' , set www.testsite.com. works links guess might images?

xcode - Undefined symbols for architecture armv7s in cocos2dx ios -

i getting these linker errors cocos2d::cclayer::cctouchesbegan(cocos2d::ccset*, cocos2d::ccevent*)", referenced from: vtable splash in splash.o "non-virtual thunk cocos2d::cclayer::cctouchesbegan(cocos2d::ccset*, cocos2d::ccevent*)", referenced from: vtable splash in splash.o "cocos2d::ccsize::ccsize(cocos2d::ccsize const&)", referenced from: collision::iscollision() in collision.o "cocos2d::ccarray::count() const", referenced from:...and many more linker errors i using xcode 5.1 , cocos2dx 2.2 when removing armv7s able archive not able run game on iphone 5s has ios7.1. on lower versions gud.. if add armv7s architecture not able run on lower versions , none of device..i getting again linker errors by adding unable archive game. error q0 register not found.. if there way fix i have running , have: armv6 armv7 i386 valid architectures base sdk of ios 7.1.

Python - detecting values in a list -

this question has answer here: pythonic way of checking if condition holds element of list 3 answers how detect if value held in list negative, need find out if there value negative, far have this: if list[range(list)] < 0 but surely detect if values in list negative.how go doing this? also, how able detect if value in list not integer, example floating point number, or character thanks you can use any function, this if any(item < 0 item in my_list): for example, print any(item < 0 item in [0, 1, 2]) # false print any(item < 0 item in [0, 1, -2]) # true we use generator expression in any function. returns true , if of item lesser 0.

c - Using fork() and execlp to count lines -

i'm trying read file, count lines of file, , present result in end. got working out great problem execlp command, have no idea how work with. the code following: #include <stdio.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <unistd.h> #include <stdlib.h> #define exit_on_error(s,m) if (s < 0) { perror(m); exit(1); } int main(int argc, char *argv[]){ int i, status, total=0, f, n=0; for(i=1; i<argc; i++){ if(fork()==0){ f=open(argv[i], o_rdonly); exit_on_error(f,"erro na abertura ficheiro"); if(fork()==0) { wait(); // ????????????? execlp("wc", "wc", "-l", null); } close (f); return (0); } else{ wait(&status); total += status >> ...

javascript - Expand jsTree node when parent is clicked -

Image
i trying implement simple tree using jstree. have found documentation dense , overwhelming. right now, expand / collapse node clicking arrow shown here: i want able expand / collapse clicking node name too: the code using simple; have not altered javascript jstree: <ul id="tree"> <li> subfolder1 <ul id="tree"> <li data-jstree='{"icon":"/images/blue-folder.png"}'>pub 1</li> </ul> </li> </ul> just add event listener in html file , call toggle_node function. code below listens single click. $(document).ready(function(){ $('#jstree_div').on("select_node.jstree", function (e, data) { $('#jstree_div').toggle_node(data.node); }); } if want listen double click need event listener, since jstree not support double click events yet. $('#jstree_div').on("dblclick",function (e) { var li = $(e...

Understanding Haskell's type system -

i've got 3 functions boombangs xs = [if x < 10 "boom" else "bang" | x <- xs odd x] length' xs = sum [1 | _ <- xs] removenonuppercase st = [x | x <- st, x `elem` ['a'..'z']] here's type(type signature?) of each function *main> :t boombangs boombangs :: integral => [a] -> [[char]] *main> :t length' length' :: num => [t] -> *main> :t removenonuppercase removenonuppercase :: [char] -> [char] haskell should give me error when pass array of ints removenonuppercase or string boombangs. too, how know it's wrong when haven't specified type anywhere. also why types of boombangs , removenonuppercase different though work on same input. i apologize if question seems vague or downright ignorant. i've started on learn haskell , i'm wrapping head around paradigm coming programming in c , python. any resources learning more haskell , type system appreciated. ghc use...

Ensuring generic wildcards match in Java -

so understanding following: hashmap<class<?>,list<?>> map would allow insert pairing. how enforce can insert matched pairs. e.g. map.put(string.class, new vector<string>()); map.put(integer.class, new vector<integer>()); but disallow following: map.put(classa.class, new vector<classb>()); //i want refuse compile is possible? update: input far. understand abstracting away map insertion enforce common type across both parameters. keep map clean, how can guarantee compiler case. e.g. cause compiler grumble, , no amount of casting seems fix (at least i've tried) list<string> list1 = map.get(string.class); so instead i'm using following i'm not happy it list list2 = map.get(string.class); nb i'm not in front of ide memory general idea clear. i not directly use hashmap , default methods has not allow desire. i'd write own collection based on hashmap expose it's own put method. this: pu...

c# - Moving Platforms in a Tile Map -

Image
i using tile map if moving platform hits tile should go direction. using list both tilemap , platform, helps keep things neat. the image below shows platform, in motion , when collides 1 of black circles should change directions , head opposite way going. unfortunately having problem need find correct platform go other direction. created list in main class , not know how call upon list inside class besides main. question: how call upon list holding multiple objects going in different directions, in different position, , created in main class, can know if platform colliding tile? simply put, how make platform collide tile? here process tile map must go through used , called: to make tile map 2 classes used, block class , game1 class (the main class). inside block class texture, position, , blockstate (which decides thing do) public block(texture2d texture, vector2 position, int blockstate) { this.texture = texture; this.position = position...

c# - Listing a field from all the entities in a collection -

i'm writing out aggregated list of statuses. works fine except situation there none. @ moment, null rendered , position empty. item.stuff.where(e => condition(e)) .select(f => f.status) .aggregate("---", (a, b) => (a == "---") ? b : (a + b)); i've got a suggestion solution , improvement follows. [flags] enum status { none = 0, active = 1, inactive = 2, pending = 4, deleted = 8 } item.stuff.where(e => condition(e)) .aggregate(status.none, (a, b) => | b.status) as i'm great fan of simpler syntax, love skipping select part. however, result not elements listed. in fact, single 1 listed (instead of 5 previously) , none appears there single status before. perhaps i'm brain-stuck can't see why. and, consequently, not should it, neither... :( if statuses coming extenal system (i.e. database) might need renumber statuses there well. note works if use power-of-two values values of stat...

android - When Start Emulator is display this error and eclipse close? -

Image
i have format , copy required sources when run project in eclipse going close , error displayed don't understand why error display i using eclipse kepler 64 bit you must change java 64 bit. see here

tsql - DAX/powerpivot equivalent to T-SQL where in -

i unable construct query equivalent t-sql below. i working on our new analytics dashboard , have solved wanted, have stuck on 1 problem. image table , t-sql query http://server.esterminal.cz/dax/all.png table id productid timeid storeid price 797190 7946 267 73 100 797191 7946 269 73 101 797192 7946 270 73 102 797193 7946 271 73 104 797194 7946 271 74 105 797195 7947 271 74 200 797196 7947 271 73 202 797197 7947 271 75 203 query select * productfact productid in (select productid productfact storeid = 75) result id productid timeid storeid price 797195 7947 271 74 200 797196 7947 271 73 202 797197 7947 271 75 203 i want show products on offer in 1 store , show details of other stores stock product. i...

visual studio - Add a project on local solution but not in source control (TFS) -

edit: i have existig solution in visual studio (which on tfs source control). in solution, have several projects (under source control). now, add project (for test purpose) solution, project on local computer , not commit on source control, because other team members doesn't need it! i can obviously, remove project of source control, while in solution, others team members able see project if they'll not able load ! anyway avoid .sln add local project ? possible ? thanks. yes ofcourse. easiest way create own local solution file test project , other projects need.

css - Dynamic DIV for 2 different views -

i'm trying make dynamic div using css , angular. here have far: fiddle var myapp = angular.module('myapp',[]); function myctrl($scope) { $scope.name = 'views'; } i have big div (marked red). in div have 2 divs: left 1 (black) , right 1 (yellow). , 2 links: 7 days , 30 days. when click on 7 days should have first view: here have right div fix width , left 1 has adjust width ("red div" minus "yellow div"). when click on 30 days link, yellow div should disappear , black div should big red one. so far managed make right div appear , disappear.. problem left 1 not expanding none of views any suggestions? here's need: http://jsfiddle.net/hb7lu/3140/ . represents how "take full width when condition verified". ng-class="{w100: show_tab==2}" means "the w100 class applied element if show_tab==2 true". some remarks you: in css, #child_element_id enough id definition. should not ...

soap - Paypal set wrong Content-Type what to do? -

our paypal payments broken , problem wrong content-type them, should go , make fix on side or hope have in staff catch , fix it? curl -i https://www.paypalobjects.com/wsdl/paypalsvc.wsdl http/1.1 200 ok server: apache content-type: text/html connection: keep-alive vary: accept-encoding i've opened internal issue this, you'll able fix side sooner.

Calling regasm without administrative rights for COM interop in Excel VBA -

a workaround calling regasm without admin rights described here already: com interop without regasm i'm trying create com library users can deploy , use excel vba without admin privileges. liked regasm workaround, since seems people don't have success using registration-free com objects excel vba. want binding users can benefit syntax completion. the accepted answer in question mentioned above, however, doesn't describe put assembly dll on user's computer. admin rights required install assembly in gac, i'm wondering 1 can put dll file. presume application's dir being searched referenced dlls, can't put dll in excel's dir without admin rights again. possible use workaround excel client? there other way call com objects vba without need of admin privileges deploy them first? calling regasm without administrative rights com interop i think should possible use registrationservices.registerassembly , regoverridepredefkey apis implem...

java - Leading and trailing spaces must be detected in the names contained in the combobox -

im new swings, id know something. have table, , column name-ca1 has combobox. want each item in list of combobox according condition. condition is: leading , trailing spaces must detected '#' symbol. trying use renderer combobox.... since im new... im not able figure out. the combobox consists of list of names... alphanumeric characters along special characters.. so requirement names, if consist of spaces before or after it, must detected '#' before or after respectively.

Is there way to check device model in Apportable SDK? -

i have implement special behaviour particular device model. need check device model. i'm using [uidevice currentdevice] name]; but it's return me nexus 7 running apportable i think it's kind of weird result. other way it? use [[uidevice currentdevice] nativemodel] nslog(@"%@", [[uidevice currentdevice] nativemodel]); will generate d/spin ( 3956): 2014-04-14 09:44:21.446 spin[3956:2752] nexus 7 in logcat output there more information uidevice api extensions in .apportable/sdk/system/uikit/uidevice.h apportable typically makes api decisions ios ports seamless possible. if want android specific result, non-ios api extension created. here details on uidevice.h mappings android build api's : @property (nonatomic, readonly) nsstring *nativesystemname; -> @"android" @property (nonatomic, readonly) nsstring *nativecpuabi; -> build.cpu_abi @property (nonatomic, readonly) nsstring *nativemodel; -...

actionscript 3 - Error 1009 : Cannot access a property of method of a null object reference -

i don't understand going on main.as package { import flash.display.movieclip; import flash.events.mouseevent; public class main extends movieclip { public var pirkles:circles = new circles() public function main() { gotoandstop(1) playbtn.addeventlistener(mouseevent.click, playscreen) } public function playscreen(event:mouseevent):void { gotoandstop(2) addchild(pirkles) } } } and circles.as package { import flash.display.movieclip import flash.events.event; import flash.events.keyboardevent; import flash.ui.keyboard import flash.events.mouseevent; public class circles extends movieclip{ public function circles():void { stage.addeventlistener(keyboardevent.key_down, move) this.y = 175 this.x = 10 } public function move(event:keyboardevent):void { if (event.keycode == keyboard.right) { this.x = this.x+10 } else if (event.keycod...

ios - iOS7 and PhoneGap build - app height and touch response -

i've built app using phonegap build, running on ios7. build went fine, , install fine, there problems can't figure out. firstly, app height isn't full size - looks c. ios 6 size. if use phonegap build debug tool call alert(window.innerheight);, response 480. secondly, app isn't responding touch events. again, if use debug tool, can pass click events app , responds expected, know app responsive, if try perform same event on device, nothing happens. i'm sure these common issues, can't seem figure them out! same app works on andoird, makes me suspect it's configuration issue. reference, config.xml looks like: <?xml version="1.0" encoding="utf-8" ?> <widget xmlns = "http://www.w3.org/ns/widgets" xmlns:gap = "http://phonegap.com/ns/1.0" id = "com.xxxxxx.walkingguide" versioncode="100" version = "1.0.0"> <!-- versioncode optional , android --...

ruby - "Element not found in the cache ..." although the same command code works when run through IRB -

i trying run script on entering input , hitting enter, new field text input open ups. when script run, cursor goes newly opened field, not enter input expected. have specified explicit timeout , script waits particular time still fails throwing: - "element not found in cache - perhaps page has changed since looked up" #enter no. of nights browser.find_element(:xpath,"/html/body/div[5]/div/div[3]/div[2]/div[2]/div/div/div/div/div[2]/div[2]/div/div/div/div[2]/div/div/div[3]/div/div[2]/div[2]/div/div/div/div/div/div/div[3]/div/div/input").send_keys"1",:return #enter no. of rooms browser.find_element(:xpath,"/html/body/div[5]/div/div[3]/div[2]/div[2]/div/div/div/div/div[2]/div[2]/div/div/div/div[2]/div/div/div[3]/div/div[2]/div[2]/div/div/div/div[2]/div/div/div[3]/div/div/input").send_keys"2",:return i have tried both implicit , explicit waits doesn't either. strangely, if execute steps manually in ruby shell, works fine! ...

Android iBeacon Library ranging api -

i'm using android ibeacon library , trying number of ibeacons in region. using ranging api devices count. count keeps on changing 0 n when ibeacons , phone still. when try details of devices following exception. what's causing exception. when tried debugging see datas not null. 04-14 11:26:37.203 11754-11883/com.test.ibeacon e/androidruntime﹕ fatal exception: intentservice[ibeaconintentprocessor] process: com.test.ibeacon, pid: 11754 java.util.nosuchelementexception @ java.util.arraylist$arraylistiterator.next(arraylist.java:576) @ com.test.ibeacon.mainactivity$1.didrangebeaconsinregion(mainactivity.java:115) @ com.radiusnetworks.ibeacon.ibeaconintentprocessor.onhandleintent(ibeaconintentprocessor.java:73) @ android.app.intentservice$servicehandler.handlemessage(intentservice.java:65) @ android.os.handler.dispatchmessage(handler.java:102) @ android.os.looper.loop(looper.java:136) @ android.os.handlerthread.run(hand...

php - Paypal PDT script not working using cURL -

i can't seem paypal pdt script working. paypal hits return url i'm presented blank screen , nothing happens. can see incorrect? here's code: $tx = $_get['tx']; $id = $_get['cm']; $amount = $_get['amt']; $currency = $_get['cc']; $identity = '###########################################'; // init curl $ch = curl_init(); // set request options $url = 'https:www.paypal.com/cgi-bin/webscr'; $fields = array( 'cmd' => '_notify-synch', 'tx' => $tx, 'at' => $identity, ); curl_setopt($ch,curlopt_url, $url); curl_setopt($ch,curlopt_post, count($fields)); curl_setopt($ch,curlopt_postfields, $fields_string); curl_setopt($ch,curlopt_returntransfer, true); curl_setopt($ch,curlopt_header, false); // execute request , response , status code $response = curl_exec($ch); $status = curl_getinfo($ch, curlinfo_http_code); // close connection curl_close($ch); if($status == 200 , strpo...

sql - MySql Error 1241 on Insert Statement -

this code, , giving me: "error code 1241. operand should contain 1 column(s)" . have been staring @ few hours , cannot figure out causing it. can provide create table statement if help. additionally using mysql workbench 56. sorry poorly formatted code, first post, if have broken rules please let me know. happy resubmit it. old code: insert sales (sales_id, sales, salesman, customer, date, region) values ( (null,null,null,...), (...), ); corrected code: insert sales (sales_id, sales, salesman, customer, date, region) values (null, 2456.00, 'barb', 'd-square', '2014/06/10', 'n reg'), (null, 3894.00, 'barb', 'lowes', '2014/05/08', 'n reg'), ...(last row); two things think clarify how fixed this. first, rearranged recommended in chosen answer, realized values statement had many parentheses. it was : values ((first row),(second row),... ); but correct way actually: values (first row...

python - Tkinter error, binding an entry object with a function, 2 arguments given, 1 needed -

i'm new tkinter. in order learn tkinter, have followed this tutorial , , tried use new little project. however, have error when pressing enter on entry box have created. here code: # -*- coding: utf-8 -*- import tkinter class pocketdex(tkinter.tk): def __init__(self, parent): tkinter.tk.__init__(self, parent) self.parent = parent self.initialize() def initialize(self): self.grid() self.labelvariable = tkinter.stringvar() self.labelvariable.set("cuvântul căutat este:") label = tkinter.label(self, textvariable = self.labelvariable, anchor="w") label.grid(column = 0, row = 0) self.entry = tkinter.entry(self) self.entry.grid(column = 1, row = 0, sticky='ew') self.entry.bind("<return>", self.enterpressed) def enterpressed(self): print "it worked!" if __name__ == "__main__": app = pocketdex(none) a...

mysql - how do i echo a row with quotationmarks in PHP -

does of know how can echo " echo $row['time']; " in quotation marks. the print should "xyz" i need own json style used in app.. thanks in advance :) you can concate "" using in echo as echo '"'.$row['time'].'"';

javascript - Add a second function after .load() and first function completed -

i have 2 separate html files being dynamically added index.html means of jquery .load(). after html content has loaded fade-in animation happens. want call yet function -- orientationload() -- depending on html loaded. understand orientationload() being called before load() has completed loading. console error: typeerror: 'undefined' not object (evaluating '$('.page').classlist.contains') can help? thanks function orientationload() { var viewportwidth = window.innerwidth; if (viewportwidth > 768) { landscapeclass(); } else { portraitclass(); } }; function changepage(filename){ $('.content_wrapper').animate({opacity:0}, 500, function(){ if (filename == 'home.html?v=1'){ $('.page').addclass('home'); }else{ $('.page').removeclass('home'); } if (filename == 'story.html?v=1'){ $('.page').addclass(...

javascript - countdown is not counting down as expected -

hoping this, i'm not js expert. i have countdown set up, adapted keith wood's countdown . it's not counting down in browser, though seems functioning in every other regard. here on jfiddle . and here's code: html: <div id="form"> <div id="topbox"> <div class="countdown"></div> <div id="until"> until move-in </div> </div> </div> js: $(document).ready(function() { //preload rollover image var image = $('<img />').attr('src', '../../images/countdown_button1.png'); // jqueryui calls buttons $(".back a").button({ icons: {primary: "ui-icon-triangle-1-w"} }); // checklist button rollover $('#bottombox a').hover( function () { $('#bottombox').addclass("button").removeclass("nobutton"); ...

Link to pimcore object from within plugin -

i'm developing plugin link existing admin interface components - i.e. link grid view object crud screen. i know can using deeplinks in examples here . want maintain open tabs. im using pimcore 2.0 release. have thought standard feature in admin section? anyone? cheers you should handle grid item click , call pimcore.helpers.openobject(id, type); for reference can check ontreenodeclick handler in pimcore.

c# - 'The operation cannot be completed because the DbContext has been disposed' - after adding Dispose() -

i getting above error on various controller actions after adding line.... protected override void dispose(bool disposing) { repo.dispose(); base.dispose(disposing); } ...to controller. before adding line had issue dbcontext returning old or cached data after record update operation. seems fixed, i'm having 'dbcontext has been disposed' issue. controller looks this... public class casestoreviewcontroller : controller { private casereviewrepository repo; public casestoreviewcontroller() { repo = new casereviewrepository(dataaccess.current); } protected override void dispose(bool disposing) { repo.dispose(); base.dispose(disposing); } } repository looks this... public class casereviewrepository : idisposable { private hsadbcontext _db; public casereviewrepository(hsadbcontext db) { ...

android - Exception while sending an email in Java with javax.mail -

i'm trying android app sends image automatically without intervention user. i'm using javax.mail jar (and activation.jar , additional.jar ) in order so. i'm doing following properties props = new properties(); props.put("mail.smtp.auth", true); props.put("mail.smtp.starttls.enable", true); props.put("mail.smtp.host", "smtp.gmail.com"); props.put("mail.smtp.ssl.enable",true); props.put("mail.smtp.port", "465"); session session = session.getinstance(props,new authenticator() { protected passwordauthentication getpasswordauthentication() { return new passwordauthentication(user,pass); } }); mimemessage message = new mimemessage(session); message.setfrom(new internetaddress("*******@gmail.com")); message.setsubject("email subject"); message.addrecipient(message.recipienttype.to, new internetaddress("******@gmail.com")); mimebodypart...

c - Send/Read using a TCP socket, anomalies in the byte sizes -

i'm trying implement working http client-server application make practice network programming. 2 programs have follow basic algorithm: client - send request server - send "+ok\r\n" server - send file size in bytes server - send file client - send ack i'm having lot of troubles in reading part, because perform dirty read on stream. these 2 reading function i'm using: /* reads line stream socket s buffer ptr line stored in ptr including final '\n' @ maxlen chasracters read*/ int readline (socket s, char *ptr, size_t maxlen) { size_t n; ssize_t nread; char c; (n=1; n<maxlen; n++) { nread=recv(s, &c, 1, 0); if (nread == 1) { *ptr++ = c; if (c == '\n') break; } else if (nread == 0) /* connection closed party */ { *ptr = 0; return (n-1); } else /* error */ re...

go - revel's .flash and .error -

i installed booking app , build small app myself , both suffer inability of displaying flash errors shown here: https://github.com/revel/revel/blob/master/samples/booking/app/views/hotels/settings.html the example view use in own app https://gist.github.com/daemonfire300/10581488 , iterating on .error works fine. am missing something? i wrote controller (please note used default app instead of usercontroller use in example): type user struct { username string password string email string } func (c app) register(user user) revel.result { c.validation.required(user.username).message("missing username") c.validation.required(user.password).message("missing password") c.validation.required(user.email).message("missing email") if c.validation.haserrors() { c.validation.keep() c.flashparams() } return c.redirect(app.index) } when miss field on form (for example password), errors , prev...

php - How can I get this SQL query to work...? -

i making game class , decided make leaderboards page. have admin area need grab data both tables in page. the 2 tables user_settings , leaderboards . code on leaderboards.php page: <?php $records = array(); if ($results = $db->query("select * user_settings union select * leaderboards")) { if ($results->num_rows) { while ($row = $results->fetch_object()) { $records[] = $row; } $results->free(); } } ?> <?php foreach ($records $data) { ?> ...the html etc... <?php } ?> what need change in order make query work. need change foreach loop? or...? have far needed grad data 1 table i'm not sure how work. edit: the user_settings table admin set config such site name etc. far doing trying select 2 tables without page breaking, @ moment breaking. have feeling foreach loop , of code underneath query. @ moment not want grab data database, want select page doesn't break. ...

perl - Variable Replacement using Regex -

i want replace variable in file(temp.txt) in perl. temp.txt hi $test. how you?? now want replace variable $test . code tried below: open $filename, "<", temp.txt or die $!; while (<$filename>) { s/$test/'abc'/g; print; } it not working. can tell me doing wrong? you need escape $ because perl thinks variable: use warnings; use strict; while (<data>) { s/\$test/'abc'/g; print; } __data__ hi $test. how you??

python - flask-sqlalchemy max value of column -

lets have user model such from flask import flask flask.ext.sqlalchemy import sqlalchemy app = flask(__name__) app.config['sqlalchemy_database_uri'] = 'sqlite:////tmp/test.db' db = sqlalchemy(app) class user(db.model): id = db.column(db.integer, primary_key=true) username = db.column(db.string(80), unique=true) email = db.column(db.string(120), unique=true) numlogins = db.column(db.integer) def __init__(self, username, email): self.username = username self.email = email def __repr__(self): return '<user %r>' % self.username how query records user maximum logins? you order numlogins , take first result, won't work if multiple people have same number. instead, find max number, find users number. max_logins = db.session.query(db.func.max(user.numlogins)).scalar() users = db.session.query(user).filter(user.numlogins == max_logins).all() you reduce 1 query. sub = db.session.query(d...

Visual Studio 2013 Slow IDE Responsiveness -

for unknow reason, visual studio 2013's ide seems less responsive. should snapping considering i'm running on high end pc lots of ram. happens when not debugging web application. when click on menus, there's noticable delay before responds , there's no highlighting of menu. clicking on html text or items in solution explorer slow. there's pause cursor stuck on text selection state. here's configuration screen: version 12.0.30324.00 update 2 rc microsoft .net framework version 4.5.50938 installed version: ultimate architecture , modeling tools microsoft architecture , modeling tools uml® , unified modeling language™ trademarks or registered trademarks of object management group, inc. in united states , other countries. lightswitch visual studio 2013 microsoft lightswitch visual studio 2013 microsoft office developer tools - update 1 visual studio 2013 enu microsoft office developer tools - update 1 visual ...