Posts

Showing posts from August, 2015

vhdl - Lattice Diamond 2.1 -

i upgraded machine winxp win7, , @ same installed lattice diamond 3.1. more complex simulations hang, active-hdl uses 100% cpu time , in infinite loop. stupidly don't have installation of lattice diamond 2.1 or 2.2, , unbelievably lattice allows download latest version. no fallbacks! does have installation file lattice diamond 2.1 or @ pinch 2.2? can provide ftp put on if has. know big file, 1g+. actually able copy active-hdl 9.2 directory win7 in virtual box on machine, , overwrite active-hdl 9.4 directory. still wouldn't mind old installation file @ least can simulate now. , diamond 3.1 possible eliminate bkm warnings , errors. there 2 many bugs in 2.1, tech support admitted warnings diamond bugs not flaws in code. actually found can download older version support -> software archive actual link: http://www.latticesemi.com/en/support/softwarearchive.aspx

cocoa - Xcode 5.1 access the app itself -

i began coding objective c last night , made first basic cocoa app macbook air. have built , everything, can't find executable app in project folder? i using 5.1 look in ~/library/developer/xcode/deriveddata . find folder program.

c - Round Robin Scheduling With Arrival Time (concept of wait queue) -

i studying round robin , there concept of wait queue struck mind searched internet , found nothing on it. how round robin scheduling algorithm solved if there arrival time given process? round robin scheduling technique executes process given time slice , appends process @ end of ready queue, before appending @ end of ready queue, checks whether there other process can inserted in queue(on basis of arrival time) if such process exists inserts such programs in queue , @ end of queue adds current executed process

bash - I need to get the amount of numbers entered from a parameter and assign them to variables -

i making program have user provide 3 digit number when running program. if not have 3 numbers, im give error message. how can test length of number , how can assign each number out of digits variable? thanks in advance! i tried doing: grep '^[0-9][0-9][0-9]$' did not work. consider following starting point. add more error checking getting practice. #!/bin/bash while : read -p "enter 3 digit number or q quit: " input if (( input >= 100 && input <= 999)); echo "good entry" digit1=${input:0:1} && echo "digit1 $digit1" digit2=${input:1:1} && echo "digit2 $digit2" digit3=${input:2:1} && echo "digit3 $digit3" elif [[ $input == "q" ]]; break else echo "bad entry" fi done output: enter 3 digit number or q quit: 4256 bad entry enter 3 digit number or q quit: 242 entry digit1 2 digit2 4 d

Checking if two elements are equal in JavaScript -

why elementa === elementb produce different results elementb.isequalnode(elementa)? after checking this answer on is there way check if 2 dom elements equal? i'm trying check if 2 elements equal in javascript using === . surprisingly, when element a , b same a === b returns false while b.isequalnode(a) returns true . here's example: html: <div> <h1>test</h1> </div> javascript: var inmemorydiv = document.createelement('div'); var inmemoryh1 = document.createelement('h1'); inmemoryh1.innerhtml = "test"; inmemorydiv.appendchild(inmemoryh1); var h1 = document.getelementsbytagname('h1')[0]; alert(h1 === inmemoryh1); // false alert(inmemoryh1.isequalnode(h1)); // true alert(h1.innerhtml === inmemoryh1.innerhtml); // true replicated in fiddle . why case? you create new element. not same existing one. equal though have same structure , content. it's 2 string objects equal if contai

select - MySQL nested, nested subquery not getting outter variable -

i have spendings table , dates table, joined date_id , id... what i'm trying do, 1 query info spendings, plus sum of spendings limit and/or offset this query right now select spendings.id, spendings.price, spendings.title, dates.date, users.username, currencies.value, ( select sum(sum_table.price) ( select s.price spendings s, dates d s.date_id = d.id , day(d.date) = 25 limit 2 offset 0 ) sum_table ) sum_price spendings, dates, users, currencies spendings.date_id = dates.id , day(dates.date) = 25 , spendings.user_id = users.id , spendings.curr_id = currencies.id limit 2 offset 0 output id price title date username value sum_price 3 6.00 title1 2013-11-25 alex € 21.00 4 15.00 title2 2013-11-25 alex € 21.00 it works, if date here day(d.date) = 25 same outer 1 here day(dates.date) = 25 if instead put day(d.dat

Nginx image_filter on OpenShift not working -

i'm trying build nginx instance on openshift, able resize external images, url. ex. http://nginx-paramount.rhcloud.com/resize/100x100/http://perankhgroup.com/fghjk.jpg on localhost, working, i'm not able make work on openshift, because of default.conf...and maybe because of proxy_pass. error getting in browser "unsupported media type"...so image_filter module working, gives error...415. this default.conf, included nginx.conf: http://pastie.org/9094471 any idea of can in order make work on openshift? lot!

Why read data from a text file C# -

i'm learning c # right , i've gotten point console applications i'm learn how read data text file. before start learning how make program i've been trying find out why want this. feel if understand why i'm doing can better understand benefits of , give time deserves when being taught. appreciate if tell me when , how use reading data text file , benefits are? have been looking couple of weeks , can't find , need started. thank in advance. at basic level, read data text file because data need stored in text file (as opposed database or retrieved web service call). why data stored in text files? many reasons: text files amongst easiest files create , process. un*x comes whole plethora of tools creating, searching, filtering , modifying them , many have been ported windows. little can go wrong text files. indexes can corrupted on databases. database file formats vary 1 database next , on. simple csv (comma separated variable) file form of text f

java - Spring service class contains too many finder methods -

i using spring framework , spring data jpa develop application. below 1 of repository interface , service class. public interface userrepository extends jparepository<user, long> user findbyname(string name); user findbyemail(string email); } public class defaultuserservice implements userservice { @inject protected userrepository userrepo; @override public user getuserbyid(long id) { return userrepo.findone(id); } @override public user getuserbyname(string name) { return userrepo.findbyname(name); } @override public user getuserbyemail(string email) { return userrepo.findbyemail(email); } } as stated many experts, service layer design should coarse grained , focused on application operations. looking @ service class above, believe not design directly expose finder methods repository. since 3 service methods above returning same object type (user), want expose 1 finder method instead of 3 able enc

how to convert string to int in Java -

this question has answer here: how convert string int in java? 28 answers how convert int string? 18 answers i'm working on caesar cipher example in want different keys user , 1 key decrypt original text , got problem, here code public static void main(string[] args) { scanner user_input= new scanner(system.in); string plaintext = "university of malakand"; string key; key = user_input.next(); ceasercipher cc = new ceasercipher(); string ciphertext = cc.encrypt(plaintext,key); system.out.println("your plain text :" + plaintext); system.out.println("your cipher text :" + ciphertext); string cplaintext = cc.decrypt(ciphertext,key); system.out.println("your plain text :" + cplaintext); } it

javascript - array and object confusion in json -

what different between is var json = [{ 'id':1, 'name':'john' }] and var json = { 'id':1, 'name':'john' } my understanding in code 1 json array, means can have multiple object contains property of id , name. second 1 it's object. it? and how one var json = ['id':1,'name':'john'] compare code one? nothing valid json in case. the first 1 array of native javascript objects. the second 1 javascript object. the last 1 isn't valid , throw error. syntactically wrong. use json.stringify() on javascript arrays or objects make valid json.

sip - Kamailio-Asterisk - route "FROMASTERISK" not found -

i'm trying implement kamailio 4.1 asterisk 12.1.0 regarging tutorial: http://kb.asipto.com/asterisk:realtime:kamailio-4.0.x-asterisk-11.3.0-astdb and when try compile kamaili.cfg, still got error: apr 19 16:59:31 debian /usr/local/sbin/kamailio[5751]: error: <core> [route.c:1137]: fix_actions(): route "fromasterisk" not found @ /usr/local/etc/kamailio/kamailio.cfg:780 i have loaded modules in tutorial. i tried find solve issue, no result. thank help! that error mean in kamailio.cfg file not found section route "fromasterisk" also note, kamailio config file /usr/local/etc/kamailio/kamailio.cfg you have add section or remove route.

php - How to maintian database for ranking system reseting it periodically while saving old data? -

i need maintain database gaming tournament ranking system in ranking data reset every 3 months old ranking saved well. can suggest me how should that? should create new table each ranking period or should maintain data in single table , check them using time constraint?

x86 - How can I add two 16 bit numbers in assembly language in microprocessor 8086 -

hey using window 7 x86. want add 2 16 bit numbers. when add 3+3 answer correct when add 7+7 it's not working. , want add 2 numbers 75+75 answer should 150. what procedure please tell me. thanx in advance .model small .stack 100h .data num db 9 dup(0) result dw 9 dup (0) .code main proc mov ax,@data mov ds,ax mov ah, 1 int 21h ; input user mov num, al ; store in array int 21h ;get 2nd number user mov num+1, al ;store in array @ num[1] index mov al, num ;mov number al add dl, num+1 ;add num[1] in num in dl sub dl, 48 ; subract assci become number 0 ~ 9 mov ah, 2 ; output int 21h mov ah, 4ch int 21h main endp end main here code add 2 16-bit numbers on 8086: .model small .data db "enter first number$" b db "enter second number$" c db "the sum is: $" d db 00h .code start: mov ax,@data mov ds,ax mov dx,offset mov ah,09h int 21h mov ah,01h int 21h mov bh,al mov ah,

Python 3.4 asyncio task doesn't get fully executed -

i'm experimenting python 3.4's asyncio module. since there's no production ready package mongodb using asyncio, have written small wrapper class execute mongo queries in executor. wrapper: import asyncio functools import wraps pymongo import mongoclient class asynccollection(object): def __init__(self, client): self._client = client self._loop = asyncio.get_event_loop() def _async_deco(self, name): method = getattr(self._client, name) @wraps(method) @asyncio.coroutine def wrapper(*args, **kwargs): print('starting', name, self._client) r = yield self._loop.run_in_executor(none, method, *args, **kwargs) print('done', name, self._client, r) return r return wrapper def __getattr__(self, name): return self._async_deco(name) class asyncdatabase(object): def __init__(self, client): self._client = client self._

arrays - JavaScript syntax issue: [{ }] hierarchy -

i came across following nested array , little confused why uses particular syntax: var allquestions = [{ question: "which company first implemented javascript language?", choices: ["microsoft corp.", " sun microsystems corp.", "netscape communications corp."], correctanswer: 2 }]; full example: http://jsfiddle.net/alxers/v9t4t/ is common practice use [{...}] having declared such variable? the definition array object literal in it. not realy nested array. { question: "which company first implemented javascript language?", choices: ["microsoft corp.", " sun microsystems corp.", "netscape communications corp."], correctanswer: 2 } is object literal, array contains. in fiddle linked there several of these defined in allquestions array. doing makes easy loop on array of questions , display each in turn.

android - compare current date and time and retrieve data from database -

in database storing fields such name , comment , datetime(yyyy-mm-dd hh:mm). when try retrieve data using select statement, not working , showing null pointer exception code creating , inserting database sqlitedatabase database; string st = yeartopass+"-"+monthtopass+"-"+daytopass+" "+hourtopass+":"+minutetopass; database = getapplicationcontext().openorcreatedatabase( "universalreminder", mode_private, null); database.execsql("create table if not exists birthdaytable(nameofperson varchar(20),comment varchar(150),bdatetime varchar(20));"); database.execsql("insert birthdaytable values('"+name+"','"+comment+"','"+st+"');"); toast.maketext(getapplicationcontext(),st,toast.length_long).show(); and code try select public class customdialog extends activity{ sqlited

python - Install pysqlite in virtualenv with python3 support -

i've created virtualenv with: mkvirtualenv -p /usr/bin/python3.4 django after, tried install pysqlite: pip install pysqlite but got: downloading/unpacking pysqlite downloading pysqlite-2.6.3.tar.gz (76kb): 76kb downloaded running setup.py (path:/home/sigo/.virtualenvs/django/build/pysqlite/setup.py) egg_info package pysqlite traceback (most recent call last): file "<string>", line 17, in <module> file "/home/sigo/.virtualenvs/django/build/pysqlite/setup.py", line 85 print "is sphinx installed? if not, try 'sudo easy_install sphinx'." ^ syntaxerror: invalid syntax complete output command python setup.py egg_info: traceback (most recent call last): file "<string>", line 17, in <module> file "/home/sigo/.virtualenvs/django/build/pysqlite/setup.py", line 85 print &quo

php - how to implode the following array for $val = explode(",".$number) -

array ( [0] => array ( [num] => 338975270 ) [1] => array ( [num] => 4542682328 ) ) now want use implode function output : (338975270,4542682328) you should .. echo "(".implode(',', array_map(function ($v){ return $v['num'];},$yourarray)).")"; working demo explanation : you can't directly use implode() on md array. use array_map() grab values num key , subject implode() .

php - htaccess get parameters for seo url -

// sorry grammar mistakes , other thing that's wrong, english isn't mother tongue(don't know if spelled good). i have made seo friendly urls htaccess. problem is, information out url(using get) , seo friendly urls can't that. my previous url this: http://rasolutions.eu/blogitem?id=2 so in php $_get['id'] , 2. i've got seo friendly urls it's this: http://rasolutions.eu/blogitem/2/ and php script can't see id from, return me homepage. i have googled need use (.*) in htaccess don't know or how. htaccess code atm: options +multiviews rewriteengine on rewritecond %{request_filename} !-d rewritecond %{request_filename} !-f rewriterule ^([^\.]+)$ $1.php [nc,l] # www not www. rewritecond %{http_host} ^www\.rasolutions\.eu$ rewriterule ^/?$ "http\:\/\/rasolutions\.eu\/" [r=301,l] rewriterule ^blog/(.*)([0-9]+)/$ blog.php?page=$1 [nc,l] rewriterule ^blogitem/(.*)([0-9]+)/$ blogitem.php?id=$1 [nc,l]

c++ - how to put a raw char * to AVPacket -

i have compressed image stored in char * , want put avpacket can put ffmpeg decoder. can show how this? sample or tutorial appreciated. thanks in advance i show sample code related ffmpeg encoder. static int encode_frame(avcodeccontext *avctx, avpacket *pkt, const avframe *pict, int *got_packet) { unsigned char *buf; int ret, buflen; int64_t maxsize; // store image data buf variable. buf = .... // calculate buf length. buflen = .... // allocate avpacket. maxsize = ff_min_buffer_size + avctx->width * avctx->height * 9; if ((ret = ff_alloc_packet2(avctx, pkt, maxsize)) < 0) return ret; // copy buf avpacket. memcpy(pkt->data, buf, buflen); pkt->size = buflen; *got_packet = 1; return 0; }

javascript - Stream file uploaded with Express.js through formidable and gm to eliminate double write -

i want upload , resize image in 1 go without writing disk twice. to upload image use: node-formidable : https://github.com/felixge/node-formidable to resize image use: gm : http://aheckmann.github.com/gm/ when run code error: 'this socket closed'. error: spawn enoent @ errnoexception (child_process.js:988:11) @ process.childprocess._handle.onexit (child_process.js:779:34) my code: function uploadphotos (req, res) { // parse file upload var form = new formidable.incomingform(); form.multiples = true; // allow multiple files html5 multiple attribute. form.maxfields = 100; // maximum number of fields (no files). form.keepextensions = true; // include extensions of original files. form.uploaddir = original_images_dir; form.onpart = function (part) { if (!part.filename) { // let formidable handle non-file parts. return this.handlepart(part); } gm(part) .resize(200, 200) .stream(function (err,

Python complex numbers notation -

complex numbers use "i" denote imaginary unit . does know, why python uses "j" instead? in disciplines, in particular electromagnetism , electrical engineering, j used instead of i, since used electric current. in these cases complex numbers written + bj or + jb. source.

actionscript 3 - how to convert action script 3 to c#? -

all. i trying parse binary(amf3) data using c#. and have found useful class , functions https://code.google.com/p/cvlib/source/browse/trunk/as3/com/coursevector/amf/amf3.as and has got static function below. class uuidutils { private static var upper_digits:array = [ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' ]; public static function frombytearray(ba:bytearray):string { if (ba != null && ba.length == 16) { var result:string = ""; (var i:int = 0; < 16; i++) { if (i == 4 || == 6 || == 8 || == 10) result += "-"; result += upper_digits[(ba[i] & 0xf0) >>> 4]; result += upper_digits[(ba[i] & 0x0f)]; } return result; }

testing - White UI Automation framework: back colour -

i using white ui automation testing in project. stuck @ point need background color of control. sample code please ? if using test app, create textbox , bind text of textbox control's background. test text box's text.

Jquery Droppable -

following jquery code can access gallery-folder properties jquery object droppable isn't working on it $(function() { jquery(document).find('#am-container').find('img').draggable({revert: true}); jquery(document).find("#gallary-folder").droppable({ drop: function(event, ui) { var draggablesrc = ui.draggable.attr("src"); var gallery_id = $(this).find('li').attr("id"); } }); }); following html <div id="gallery-folder" class="gallery-folder ui-droppable"> <div class="gallery-folder-inner"> <a href="gallery_view.php?id=22&gallery_name=clothes123"> <img width="68" height="48" src="images/icon-2.png"> </a> </div> </div> this fiddle http://jsfiddle.net/gv7da/4/ i saw fiddle. that's working fine

java - Unable to sort array in alphabetical order -

i trying sort array alphabetically having troubles step 3 . here current code : import java.util.arrays; import hsa.console; public class howtosortanarray { static console c; public static void main(string[] args) { c = new console (); string[] mystrarray = new string[500]; for(int i=0;i<5;i++) { c.print("input word: "); mystrarray[i]=c.readline(); } arrays.sort(mystrarray, string.case_insensitive_order); (int = 0; < mystrarray.length; a++) { c.println(mystrarray[a]); } } } can explain me why code isn't working 1 is: string[] words = new string[] {"b", "b", "a", "d"}; arrays.sort(words, string.case_insensitive_order); (int = 0; < words.length; a++) { c.println(words[a]); } does have declaring array values? pretty lost. you need change line to: for(int i=0;i<mystrarray.length;i++);

sql server - How to find the next 10 characters after a string -

i have string "create procedure test" . please find requirement below: 1- have find string "procedure" . 2- after want search if particular string "dbo" exists in next 5 characters after string procedure . 3- if dbo not exists want concatenate string myschema before string test . any suggestions a regular if simple calculations should need; declare @input nvarchar(max) = 'create procedure test' declare @keyword nvarchar(max) = 'procedure' declare @inject nvarchar(max) = 'myschema.' declare @index bigint = charindex(@keyword, @input) declare @dboindex bigint = charindex('dbo', @input, @index) if @dboindex < 1 or @dboindex - @index - len(@keyword) > 5 begin set @input = stuff(@input, @index + len(@keyword) + 1, 0, @inject) end select @input an sqlfiddle test with . charindex find strings you're looking exist in original string, if positions differ 5 or less (or dbo not exis

python - How to get dictionary objects from a list of tuple objects? -

i have following list of tuple objects : z = [set([33, u'11:22:33:44:55:ff']), set([12, u'11:22:33:44:54:ce'])] i want have following list of dictionary objects out of : d = [{33 : '11:22:33:44:55:ff'}, {12, '11:22:33:44:54:ce'}] please see -- want use first element of set, dictionary key . can suggest me code snippet, how perform ? edit sorry list of 2 element set objects (and not list of tuple objects). sets unordered. there no "first" element of set. you have enforce ordering on them - checking type works: dict(sorted(x,key=lambda k:isinstance(k,int),reverse=true) x in z) out[33]: {12: u'11:22:33:44:54:ce', 33: u'11:22:33:44:55:ff'}

php - What is the best way to enter data into a small database when mapping tables? -

i have small problem believe of clever people out there have simple solution for. haven't realised yet. i designer project , part of work depend upon postgresql database have 1 version of truth. set tables using common practices such using pk (serial) each table. when link 2 tables use foreign key. helps me in sanity checking design , doing reports on it. take example following 3 tables 1 field each: student_id : student_name 1 : j bloggs class_id : class_name 1 : physics student_class_assoc : student_id : class_id 1 : 1 : 1 i can input data using pgadmin students , classes no problem, when comes associating student , class have go each table , find id. in case trivial, when have around 70 or 80 entries becomes troublesome. ideally way able input data searching through student_name , class_name field , entering releveant id. i've thought using simple php form this, thought ask else first see if there better so

knockout.js - Access viewmodel in knockout mapping plugin -

i using knockout mapping plugin add computed property item in observable array. however, computed property relies on different property in viewmodel. how access viewmodel property when creating observable during mapping? please note cannot use options.parent, because property further in viewmodel. i unable change viewmodel, because generated server side. edit: here's jsfiddle shows issue. line commented out need working. http://jsfiddle.net/g46mt/2/ this have now, throwing error: var mapping = { 'collection': { create: function(options) { var model = ko.mapping.fromjs(options.data); model.total = ko.computed(function() { var result = this.price() * viewmodel.count(); // :( return result; }, model); return model; } } }; var json = { ... large json object ... }; var viewmodel = ko.mapping.fromjs(json, mapping); one possible solution use {defer

how to fill gridview with checkboxes in asp.net using vb -

i have gridview pregenerated columns <asp:gridview id="gridview1" runat="server" autogeneratecolumns="false" backcolor="white" bordercolor="#336666" borderstyle="double" borderwidth="3px" cellpadding="4" gridlines="horizontal"> <rowstyle backcolor="white" forecolor="#333333" /> <columns> <asp:templatefield headertext="menuid" > <itemtemplate> <asp:label id="label1" runat="server" text='<%# bind("menuid") %>'></asp:label> </itemtemplate> </asp:templatefield> <asp:templatefield headertext="menuparentid" > <itemtemplate> <asp:label id="l

windows - Finding the Owner of An Active Directory Group -

how can find owner of active directory group? not writing programming code - interested if possible find on iterface. thanks! in active directory users , computers: find group in question right-click , select properties selected security tab click advanced button select owner tab you should see owner of group.

php - how to display 2 different array in single array using for loop -

my output : array ( [0] => array ( [0] => array ( [no] => 316198 [name] => uma ) [1] => array ( [0] => array ( [totavg] => 3.0403 [tot] => 20.2023 [id] => 27 [pid] => 710600 [adr] => local [photo] => 123.png [date] => 19930-01-06 05:40 ) ) ) ) and want show : { "no": "316198", "name": "uma", "totavg": "3.0403", "tot": "20.2023", "id": "27", "pid": "710600", "adr": "loca

c++ - boost::thread_specific_ptr slows drastically relative to simple TlsGetValue and TlsSetValue -

i had small class called wcthreadspecificprivatedata. implementation: class wcthreadspecificprivatedata { public: wcthreadspecificprivatedata(); ~wcthreadspecificprivatedata(); void* getdata(); void setdata(void*); protected: uint32_t m_datakey; }; wcthreadspecificprivatedata::wcthreadspecificprivatedata():m_datakey(0) { m_datakey = ::tlsalloc(); } void* wcthreadspecificprivatedata::getdata() { void* retval = 0; if (0 != m_datakey) retval = ::tlsgetvalue(m_datakey); return retval; } void wcthreadspecificprivatedata::setdata(void* in_data) { if (0 != m_datakey) ::tlssetvalue(m_datakey, in_data); } i used store pointers thread specific struct called targetspecificdata. @ point decided use instead of class boost::thread_specific_ptr. works me, however, experience drastic performance drop. became more slower. i checked boost implementation (for windows) , saw implemented tlsgetvalue , tlssetvalue calls, expect same b

mongodb - Mongo aggregate with multiple aggregation types -

i need aggregate following data - country: one, car: volvo, name: smith, price: 100 - country: one, car: bmw, name: smith, price: 200 - country: two, car: romeo, name: joe, price: 50 - country: two, car: kia, name: joe, price: 110 - country: two, car: kia, name: joe, price: 90 (names unique, each 1 owns cars in single country) the results, expect (pluralization not required): - name: smith, type: volvos, country: one, val: 1 // count of car-type - name: smith, type: bmws, country: one, val: 1 - name: smith, type: total, country: one, val: 2 // count of cars - name: smith, type: price, country: one, val: 300 // total car price - name: joe, type: romeos, country: two, val: 1 - name: joe, type: kias, country: two, val: 2 - name: joe, type: total, country: two, val: 3 - name: joe, type: price, country: two, val: 250 e.g. pivotized data version build report country | name | volvos | bmws | romeos | kias | total | price --------------------

c# - Particular DateTime exception -

i need convert datetime strings format "mmm-yy" . i'm working culture "{es-es}" . it works fine month except march (in spanish marzo ). throws me exception: 'convert.todatetime("mar-13")' threw exception of type 'system.formatexception' system.datetime {system.formatexception} i've tried: string format = "yyyymm"; datetime result; cultureinfo provider = cultureinfo.invariantculture; result = datetime.parseexact("mar-13", format, provider); and this: datetime date = convert.todatetime("mar-13"); this works fine example with: "jun-13" "feb-13" "nov-13" ... edit real problem with: datetime date = convert.todatetime("ene-13"); -> ok datetime date = convert.todatetime("feb-13"); -> ok datetime date = convert.todatetime("mar-13"); -> crash datetime date = convert.todatetime("abr-13"); -&g

emacs jedi - completion shows function name and creates documentation in tooltip but documentation not found for scipy -

when complete sp.integrate.quad see tooltip function documentation, accept completion, tooltip goes away. i'd prefer see the main part of doc string underneath function entire time i'm editing it's arguments. stop gap, tried getting @ documentation way. jedi:show-doc or company-jedi-show-doc promising functions @ least re-displaying docstring information, give error saying can't find documentation. why can't these procedures see documentation, yet initial completion tooltip can? has used jedi achieve close desired setup? jedi setup info: https://gist.github.com/anonymous/11180631 py-install-directory var must set correctly jedi:show-doc. can set variable directly in emacs init file following sentance. (setq py-install-directory "~/.emacs.d/elpa/python-mode directory") or following sentance case python-mode package updated (setq py-install-directory (concat "~/.emacs.d/elpa/" (car (directory-files "~/.emacs.d/elpa/&q

javascript - Is it bad practice to pass $scope to a service? -

is bad practice pass $scope service? cause memory leaks since controllers can instantiated multiple times? example: .controller('testcontroller', function ($scope, testservice) { $scope.loaddata = function() { // loaddata set properties on scope testservice.loaddata($scope); }; }); not sure memory leak part since $scope being placed on stack, yeah, want separate concerns , return data services, not bind data controller within them. also, can lead confusion if else looking @ controller code , can't figure out how field within $scope got set.

c++ - How to add Crypto++ library to Qt project -

Image
i downloaded crypto++ source , compiled cryptlib project in visual studio 2013, , added generated .lib file qt project, made .pro file this: qt += core gui qt += sql greaterthan(qt_major_version, 4):qt += widgets target = untitled template = app sources += main.cpp\ mainwindow.cpp headers += mainwindow.h \ databasecontrol.h \ test.h forms += mainwindow.ui win32:config(release, debug|release): libs += -l$$pwd/ -lcryptlib else:win32:config(debug, debug|release): libs += -l$$pwd/ -lcryptlibd else:unix: libs += -l$$pwd/ -lcryptlib includepath += $$pwd/ dependpath += $$pwd/ win32-g++:config(release, debug|release): pre_targetdeps += $$pwd/libcryptlib.a else:win32-g++:config(debug, debug|release): pre_targetdeps += $$pwd/libcryptlibd.a else:win32:!win32-g++:config(release, debug|release): pre_targetdeps += $$pwd/cryptlib.lib else:win32:!win32-g++:config(debug, debug|release): pre_targetdeps += $$pwd/cryptlibd.lib else:unix: pre_targetdeps += $$pw

Microsoft Test Manager: I have not found Do Exploratory Testing tab in Test Manager 2012 -

i have installed visual studio 2012 ultimate microsoft test manager, reviewing bibliography version allow make exploratory test, in microsoft test manager, in test tab can´t see exploratory testing tab, read version , realize tab included default, not know if necessary configure in microsoft test manager, in team foundation server or visual studio 2012. sounds using mtm 2012 tfs 2010, see mtm 2012 compatibility tfs 2010 need @ least tfs 2012. if can't upgrade tfs 2012 reason, check article using exploratory bugs . it in time waiting tfs upgrade.

php - CakePHP: Find a record and retrieve the 10 following records -

i developing tool can 10 records big table, based on input in form. example, if table has column record "number", can input 1 number , app return 10 following records record number. the porpuse of lastest 10 inputs from last fetch . the problem that, afaik, there's no way make find condition of starting search @ specific position. find neighbors quite close, unfortunately returns 2 results: previous , next 1 search. any ideas? edit: right query looks this: $data = $this->tweet->find('all', array( 'field' => array('tweet.permalink' => $param2), 'fields' => array('tweet.embed'), 'limit' => 10, 'order' => array('tweet.created' => 'desc'), 'contain' => false, // 'offset' => 1, 'conditions' => array('not' => array('tweet.embed' => null), 'tweet.status' => 'approved'

Ruby Regex: Match Until First Occurance of Character -

i have file lines vary in format, basic idea this: - block of text #tag @due(2014-04-20) @done(2014-04-22) for example: - email john doe #email @due(2014-04-20) @done(2014-04-22) the issue #tag , @due date not appear in every entry, like: - email john doe @done(2014-04-22) i'm trying write ruby regex finds item between "- " , first occurrence of either hashtag or @done/@due tag. i have been trying use groups , ahead, can't seem right when there multiple instances of looking ahead for. using second example string, regex: /-\s(.*)(?=[#|@])/ yields result (.*): email john doe #email @due(2014-04-22) is there way can right? thanks! you're missing ? quantifier make non greedy match. , remove | inside of character class because it's trying match single character in list ( #|@ ) literally. /-\s(.*?)(?=[#@])/ see demo you don't need positive lookahead here either, match until characters , print result capturing group.

why android cant find class Mission in dataBase -

i create android application show list of mission data data base database manager ...but have error tell me there no table mission in database public class dbasemanager extends sqliteopenhelper { private dbasemanager mdbhelper; private sqlitedatabase mdb; public static final string db_name = "si.db"; public static final string db_path = environment.getexternalstoragedirectory() +"/si/db/"; //**********************************table_missions************************************** private static final string table_missions = "missions"; private static final string col_id_mission = "idmission"; private static final int num_col_id_mission = 0; private static final string col_nom_mission = "nommission"; private static final int num_col_nom_mission = 1; private static final string col_date_mission = "datemission"; private static final int num_col_date_mission = 2; private static fina

boolean - Python 3 - Only numeric input -

i have trouble finishing python assignment. i'm using python 3.0 program asks user input set of 20 numbers, store them list, , perform calculation on output largest number, smallest, sum, , average. right now, working, except 1 thing! in event of non numeric input user, program ask input again. have trouble doing that, thought of boolean variable, i'm not sure. thanks lot help. here's code : import time #defining main function def main(): numbers = get_values() get_analysis(numbers) #defining function store values def get_values(): print('welcome number analysis program!') print('please enter series of 20 random numbers') values =[] in range(20): value =(int(input("enter random number " + str(i + 1) + ": "))) values.append(value) #here store data list called "values" return values #defining function output numbers. def get_analysis (numbers): print(

c# - Json.NET deserialise to interface implementation -

i'm trying use json.net serialise class transfer via http request. client server test program shares common class files. files interface ( itestcase ) , implementations of interface ( testpicture , testvideo ). serialising , deserialising testcase below within same application works fine, presumably because json.net code contained within 1 assembly. when serialise testcase , send server, try deserialise, error "error resolving type specified in json 'com.test.testcases.testpicture, graphics tester'. path '$type', line 2, position 61" with inner exception of type jsonserializationexception message "could not load assembly 'graphics tester'." in json.net documentation , when json generated $type value "$type": "newtonsoft.json.samples.stockholder, newtonsoft.json.tests" . second parameter seems reference relevant classes namespace, rather project name (namely graphics tester) happening in instance. give

android detect user switching from/to HOME -

i have appwidget @ home , updated periodically. want stop update if home not visiable. use service register screen on/off receiver start/stop updating appwidget when screen on/off. don't know how detect if screen on user focusing on else (i.e. home not @ foreground). how can detect if user switch from/to home in service or receiver (it's appwidget , don't have activity on hand when happens)? as far know, there no direct api detect whether home in foreground or background. but following snippet tell whether user @ home or not. if (mactivitymanager.getrunningtasks().get(0).topactivity.getpackagename().equals("com.android.launcher") { //home } disclaimer: above code work default launcher (com.android.launcher) . so, if user using third-party launcher, can't detect if don't know package name of launcher.

Step over Node in VB.net XML parsing -

Image
i'm trying use xml parsing capabilities of vb.net here xml returned google's traffic directions api. my vb.net code total distance value is returneddistancemeters = returnedxml...<route>...<leg>...<distance>...<value>.value but "short cutting" value in first "step" node , giving me 88 want 193108. how avoid jumping first node called "distance" ? i don't know if there better way. every time have work xml on .net prefer use xsd.exe create class. http://msdn.microsoft.com/en-us/library/x6c1kb0s(v=vs.110).aspx after adding .vb file project, can initialize class xml file using function: private function gettraficfromfile(byval path string) trafic dim stream new io.streamreader(path) dim ser new xml.serialization.xmlserializer(gettype(trafic)) dim mytrafic new trafic mytrafic = ctype(ser.deserialize(stream), trafic) stream.close() return mytrafic end function you can ac

c# - Can i create OwinMiddleware per request instead creating a global object -

i'm working on webapi project & migrating owin/katana hosting. have few doubts regarding. quest ) can create owinmiddleware per request instead creating global object? i'm able create owinmiddleware not able create them per request. wanted create them per request can insert new object in owinmiddleware dependency. i'm using unity in webapi wanted solution aligned unity. i found few links :- http://alexmg.com/owin-support-for-the-web-api-2-and-mvc-5-integrations-in-autofac/ http://www.tugberkugurlu.com/archive/owin-dependencies--an-ioc-container-adapter-into-owin-pipeline but not able adjust new ioc old unity. can suggest solution i found way achive :- app.use((iowincontext context, func<task> next) => { ilogger logger = {resolve dependency using unity}; customowinmiddleware middleware = new customowinmiddleware(context,next, logger); return middleware.invoke(); }); by way i

javascript - Custom widget defined in an HTML page loaded as dojox.layout.contentpane using href and inserted as tab page not parsing custom widgets -

i trying add new tab page using tab.addchild programmatically after creating dojox.layout.contentpane href attribute. following sample snippet of relevant code ( tabmain tab control placed in page) dijit.byid('tabmain').addchild(new dojox.layout.contentpane({ title: 'my page', href: 'country.jsp', closable: true, parseonload: true, postcreate: function () { dojo.parser.parse(); })); this country.jsp has custom widget (that contain 2 standard dijit widgets). custom widgets not parsed , hence not getting custom widget loaded, other standard dijits mentioned in country.jsp loads perfectly. to rule out problem page , custom widget declarations, put custom widget directly in page without loading inside contentpane/tab (and loaded inside dialog page), works fine. so, assume dojo parser not parsing custom widget, when load in content pane shown in above code. does mean, custom widget cannot used such typ

mongodb - Updating Mongo documents -

i update collection transforming documents form: { "_id" : "somestring made", "value" : { "a" : 0.42361499999999996, "b" : 3, "c" : "foo", "d" : "bar" } } to form (with new id's): { "_id" : objectid("77d987f6dsf6f76sa7676df"), "a" : 0.42361499999999996, "b" : 3, "c" : "foo", "d" : "bar" } so take fields out of object "value" , reset id real document id. first document , convert required format , remove old doc , again insert modified 1 . like db.collection.find({}).foreach(function(doc){ var obj = { : doc.value.a, b : doc.value.b, c : doc.value.c, d : doc.value.d}; db.collection.remove(doc); db.collection.insert(obj); });

java - Attaching ActionListener to JComboBox -

i working on program has several functions need happen based on user selection jcombobox. ideally, user selection pulled out , used in series of if/else statements change necessary values. this error getting: method addactionlistener in class jcombobox<e> cannot applied given types; classjcombobox.addactionlistener(this); required: actionlistener found: dwtools reason: actual argument dwtools cannot converted actionlistener method invocation conversion e type-variable: e extends object declared in class jcombobox and here code (at moment, have set put chosen class in name jtextfield testing purposes): import java.awt.*; import javax.swing.*; import java.awt.event.*; import java.text.*; import java.util.*; public class dwtools extends jframe { private string[] classes = { "bard", "cleric", "druid", "fighter", "paladin", "thief", "ranger", "wizard" }; public jtabbedpane m