Posts

Showing posts from 2010

package - Using Qt Installer Framework to create my Application Installer -

i want create installer application. so, have read qt installer framework , tested tutorial example , create installer , work find example. have doubt when try same process application. when compile code folder created @ same level of code: myapplication (my code) build-myapplication-desktop_qt_5_4_1_mingw_32bit-release (code compiled) so questions are: what files of compilation need copy folder myinstaller/packages/vendor/ recommended qt intaller framework? if have dependencies of qt serialport, multimedia, , others, how insert these dependecies qt installer framework? windeployqt.exe want. run on command line , give executable argument. automatically copy in required qt libraries , provide runtime redistributable installer. can use binarycreator generate installer.

javascript - When are variables evaluated when passing them into functions? -

this simple question, know answer. are arguments passed function calculated once , set local variables or calculated every time they're used inside function? for example: when write forloop, should set variable finds object using iteration: for(var = 0; < objects.length; i++) { var obj = objects[i]; obj.title = "title"; obj.description = "description"; } if don't set obj variable operation finding object run more once: for(var = 0; < objects.length; i++) { objects[i].title = "title"; objects[i].description = "description"; } so far i've learnt bad (although i'm guessing performance difference in modern browsers unnoticeable). my question is, if wrapped modifying methods in function , passed objects[i] function, objects[i] calculated once , set local variable obj in function or calculate every time obj called? what better practice, code or code b? code a: func...

python - How to convert tomorrows (at specific time) date to a timestamp -

how can create timestamp next 6 o'clock, whether that's today or tomorrow? i tried datetime.datetime.today() , replace day +1 , hour = 6 couldnt convert timestamp. need help to generate timestamp tomorrow @ 6 am, can use following. creates datetime object representing current time, checks see if current hour < 6 o'clock or not, creates datetime object next 6 o'clock (including adding incrementing day if necessary), , converts datetime object timestamp from datetime import datetime, timedelta import time # today's datetime dtnow = datetime.now() # create datetime variable 6 dt6 = none # if today's hour < 6 if dtnow.hour < 6: # create date object today's year, month, day @ 6 dt6 = datetime(dtnow.year, dtnow.month, dtnow.day, 6, 0, 0, 0) # if today past 6 am, increment date 1 day else: # 1 day duration add day = timedelta(days=1) # generate tomorrow's datetime tomorrow = dtnow + day # create ne...

Is there a conventional iterator interface in Java which separates traversal from element access? -

for application, element access expensive, java.util.iterator no use. want more c++ iterators, can move pointer around without returning element. there in standard library this, or has de facto standard interface evolved through custom? (if not, please don't waste time posting code snippets - i'm quite able think reasonable names job). (since no 1 came around write proper answer, i'll expand comments answer.) to extent of knowledge there's no interface in standard api suits (i.e. interface iterator.skip() ). best solution using standard api methods believe, yourlist.sublist(startindex).iterator() instance. i think that, if possible, should consider creating own iterator interface. (note can let extend java.util.iterator interface able use ordinary iterator if needed.) finally, , future readers have use java.util.iterator , have access underlying list lazily, can use java.lang.reflect.proxy . note proxy objects doesn't play serialization ...

sql server - sql trigger call webservice timeout -

i have sql trigger calls web service because there several trigger on insert , update trigger throws timeout error. i debugged in visual studio , receive timeout error when inserting or updating record. below code alter trigger [dba].[triggerwebservice] on [dba].[callid] after insert declare @internfactureren nvarchar(1) declare @id varchar(50) --check if updated or inserted begin -- insert statements trigger here select @id=id inserted exec [dba].[usp_callophalenvoordelaware] @id end use [helpdesk] go /****** object: storedprocedure [dba].[usp_webservice] script date: 13/06/2015 22:53:15 ******/ set ansi_nulls on go set quoted_identifier on go alter procedure [dba].[usp_webservice]] @callid varchar(38) = null declare @object int; declare @url varchar(255) declare @responsetext varchar(8000); set @url = 'http://localhost:4000/service1.asmx/xxxxxxx?callid=' + @callid + '' exec sp_oacreate...

email - How to insert a mail using the latest GMail API in Swift? -

so have following snippet: var url = nsurl(string: "https://www.googleapis.com/upload/gmail/v1/users/me/messages?uploadtype=media&internaldatesource=dateheader") var rawmessage = "" + "date: thu, 25 sep 2014 18:35:28 -0700\r\n" + "from: john appleseed <john@appleseed.com>\r\n" + "to: steve jobs <steve@jobs.com>\r\n" + "subject: 1 more thing\r\n\r\n" + "some message" var rawdata = rawmessage.datausingencoding(nsutf8stringencoding, allowlossyconversion: true) var request = nsmutableurlrequest() request.url = url request.httpmethod = "post" request.setvalue("bearer \(self.accesstoken!)", forhttpheaderfield: "authorization") request.setvalue("message/rfc822", forhttpheaderfield: "content-type") request.setvalue("\(rawdata?.length)", forhttpheaderfield: "content-length") request.httpbody = rawdata! if let ...

dbref - MongoDB DBReference how to? -

i'm learning mongodb , have next questions. there mongodb documents this coordenada document > db.coordenada.find().pretty() { "_id" : objectid("5579b81342a31549b67ad00c"), "longitud" : "21.878382", "latitud" : "-102.277364" } { "_id" : objectid("5579b85542a31549b67ad00d"), "longitud" : "21.878626", "latitud" : "-102.280379" } { "_id" : objectid("5579b89442a31549b67ad00e"), "longitud" : "21.878845", "latitud" : "-102.283512" } { "_id" : objectid("5579b8bf42a31549b67ad00f"), "longitud" : "21.879253", "latitud" : "-102.286698" } { "_id" : objectid("5579b8dd42a31549b67ad010"), "longitud" : "...

javascript - applying different checkbox filters to show/hide divs -

currently checkbox filtering not working, making grid-cell div's dissapear when selected. i show categories if nothing select or if selected. if area: north selected show items matching north, if south selected show items matching south , if both north , south selected show items matching either north or south. i same price if high selected show high , if both high , low selected show high , low. if area selected north , south , price low show items containing 3 e.g items has data-category-type="high" or data-category-name="north" or data-category-name="south" http://jsfiddle.net/yzyyqqey/3/ $('.checkbox').on('click', function (e) { var $this = $(this), $links = $('.checkbox'); if ($this.hasclass('selected')) { $this.removeclass('selected'); } else { $this.addclass('selected'); } $('.grid-cell').hide(); if ($(".checkbox:checked").length > 0) { //...

HTML Email Design with Nested Tables -

why isn't text-decoration="none" appearing properly? i've tried putting in different locations, such table , tr , td , can't seem work. common mistakes in styling email designs? here code: <table cellspacing="0" cellpadding="0" border="0" max-width="100%" width="600px" align="center"> <tr> <td> <table cellspacing="0" cellpadding="0" border="0" max-width="100%" align="center"> <tr> <td> <!-- header --> <table cellspacing="0" cellpadding="0" border="0" max-width="100%" align="center"> <tr align="center"> <td> <p>is email not displaying correctly? <a href="#" text-decoration="none">vie...

debugging - How to debug transforms in glsl vertex shaders in lwjgl -

i have been working on skeletal animation in game engine creating in lwjgl. can render entities not animated animated entities not draw, makes hard debug using methods suggested here . how can debug vertex shader when nothing drawing? here vertex shader: animated vertex shader #version 330 core in vec3 position; in vec2 texturecoordinates; in vec3 normal; in vec4 bones; in vec4 weights; out vec2 pass_texturecoordinates; out vec3 surfacenormal; out vec3 tolightvector; out vec3 tocameravector; uniform mat4 transformationmatrix; uniform mat4 projectionmatrix; uniform mat4 viewmatrix; uniform vec3 lightposition; uniform mat4 joints[100]; void main(void){ vec4 originalposition = vec4(position, 1.0); int index = int(bones.x); vec4 animatedposition = (joints[index] * originalposition) * weights.x; vec4 animatednormal = (joints[index] * vec4(normal, 0.0)) * weights.x; index = int(bones.y); animatedposition = (joints[index] * originalposition) *...

javascript - Object doesn't support this action - all of a sudden -

i'm running version 1.7.5 , incomprehensible reason, of sudden i'm getting syntax errors (none of stylesheets have changed since working) , i'm including .js file in same way): object doesn't support action i've traced error curious fragment (line 7880): new(less.parser)(env).parse(data, function (e, root) { if (e) { return callback(e, null, null, sheet); } try { callback(e, root, data, sheet, webinfo, path); } catch (e) { callback(e, null, null, sheet); } }, {modifyvars: modifyvars, globalvars: less.globalvars}); ...in loadstylesheet function. don't understand syntax, in fact, , trying @ console same error message: new(less.parser) # fails new(less.parser)(env) # fails typeof less.parser # yields "function" what going on here? description: "object doesn't support action" message: "object doesn't support action" number: -2146827843 stack: "typee...

javascript - jQuery child elements with same ID -

imagine have html structure: <div id="bodyread"> ... <div id="list"></div> </div> ... <div id="bodywrite"> ... <div id="list"></div> </div> as can see, have #list inside 2 different divs (bodyread , bodywrite). lighter code, preferred work id instead of class (even knowing duplicate ids isn't valid, code makes more sense me), , selecting #list on jquery this: $('#bodyread #list').off('click').on('click', function() ... $('#bodywrite #list').off('click').on('click', function() ... works. i'm taking care of make duplicate ids on child divs, can separate them parent div on jquery selector. is approach wrong? mean, can me in trouble? don't duplicate id in child element .. change class="list" can use $('.list').on('click',functi...

python - Getting text without tags using BeautifulSoup? -

i have been using beautifulsoup parse html document , seem have run problem. found text need extract, text plain. there no tags or anything. not sure if need use regex instead in order this, because not know if can grab text beautifulsoup considering not contain tags. <strike style="color: #777777">975</strike> 487 rp<div class="gs-container default-2-col"> i trying extract "487". thanks! you can use previous or next tag anchor find text. example, find <strike> element first, , text node next : from bs4 import beautifulsoup html = """<strike style="color: #777777">975</strike> 487 rp<div class="gs-container default-2-col">""" soup = beautifulsoup(html) #find <strike> element first, text element next result = soup.find('strike',{'style': 'color: #777777'}).findnextsibling(text=true) print(result.encode('utf-8...

node.js - Assets not loading in sails.js app -

i moved arch linux windows 7. i've installed nodejs, npm, sails, grunt. created new sails project sails new <name> , started sails lift . my assets not compiled or injected sails. .tmp/public not exist, too. maybe can me out? check out issue https://github.com/balderdashy/sails/issues/3013 its grunt defaulting false, means grunt work flow not building assets or creating public web folder.

android - How can I specify the type of the field that an Annotation should be applied to in Java? -

i'm creating simple annotation, me inflating settings inside android application. annotation this: @target(elementtype.field) @retention(retentionpolicy.runtime) public @interface coresettings { string name() default ""; } i want ensure used in fields type extends custom class named basesettings . in example below, mainsettings extends abstract class basesettings. public class mainactivity extends baseactivity { @coresettings("prefs") mainsettings settings; (...) } how can it? yes, can cause compiler issue error message if write annotation on field of wrong type. you cannot using @target meta-annotation. in addition, need write annotation processor. annotation processor examine each occurrence of annotation @coresettings in source code, , issues error (just other compiler error) if @coresettings applied type not extend basesettings . short, simple annotation processor write. you compile-time warning when running...

javascript - playing audio in ajax callback -

i create jquery's code auto refresh specific div. in auto refresh using ajax create notification if there have new request client, social network notif. use music notif. when new request comes, music on. before music finished, next notif comes, , music on too. so, there 2 music playing , looked bug. i want play 1 music, next or on come. should do? should check in success ajax if music played? function refresh() { var ini; var requestmasuk = $('#request_belum_terima').text(); var audioelement = document.createelement('audio'); audioelement.setattribute('src', '<?php echo base_url() . 'assets/music/noty.mp3'; ?>'); audioelement.addeventlistener('ended', function() { this.currenttime = 0; this.play(); }, false); var myaudio = document.getelementsbytagname('audio'); settimeout(function() { $.ajax({ url: '<?php echo base_url() . 'contr...

php - Unable to return to 'User Profile' page after login -

i have login.php page user login credentials. after user logs in when dologin.php page displayed. in other words user profile displayed. on user profile element, there edit button leads them editprofile.php page edit personal info. when clicked arrow on tab go user profile page error "confirm form resubmission" displayed. how counter such when user wished go user profile page, details displayed? this dologin.php session_start(); $msg = ""; //check whether session variable 'user_id' set //in other words, check whether user logged in if (isset($_session['user_id'])) { $msg = "you logged in.<br/><a href='index.php'>home</a>"; $msg = "<a href ='logout.php'>logout</a>"; } else { //user not logged in //check whether form input 'username' contains value if (isset($_post['username'])) { //retrieve form data $entered_username = $_post['username']; ...

sql server 2008 - Writing SQL Query, Separating One Columns Into two columns with filter -

Image
i not db administrator , facing problem querying single table. i got table follow updated i wan make query come out following picture updated how can it? quite noob query thanks. you can this: select max(t1.closedate) [date], t1.job, max(case when t1.workrole = 'case' coalesce(t2.worktype,t1.worktype) end) [case], max(case when t1.workrole = 'engineer' coalesce(t1.worktype,t2.worktype) end) [wt] tablename t1 left join tablename t2 on t1.closedate<t2.closedate , t1.job=t2.job group t1.job order [date] desc result: date job case wt ------------------------------------------------------ january, 01 2008 00:00:00 senior normal electronic january, 01 2005 00:00:00 junior average electronic sample result in sql fiddle .

python - Requests dict from cookiejar issue with escaped chars -

i'm running issues getting cookie dictionary python. seems escaped somehow after running command provided requests. resp = requests.get(geturl, cookies=cookies) cookies = requests.utils.dict_from_cookiejar(resp.cookies) and cookies looks {'p-fa9d887b1fe1a997d543493080644610': '"\\050dp1\\012s\'variant\'\\012p2\\012s\'corrected\'\\012p3\\012ss\'pid\'\\012p4\\012vnta2nju0otu4mdc5mtgwoa\\075\\075\\012p5\\012ss\'format\'\\012p6\\012s\'m3u8\'\\012p7\\012ss\'mode\'\\012p8\\012vlive\\012p9\\012ss\'type\'\\012p10\\012s\'video/mp2t\'\\012p11\\012s."'} is there way make characters unescaped in value section of p-fa9d887b1fe1a997d543493080644610 become escaped , part of dict itself? edit: i dictionary like: {'format': 'm3u8', 'variant': 'corrected', 'mode': u'live', 'pid': u'nta2nju0otu4mdc5mtgwoa==', 'type': 'v...

Android Parse Login with email or username -

i'm trying make android app using parse allows 1 login using either username or email. have tried querying object provided email address, object's username login with. however, getting error: 'getfirstinbackground(com.parse.getcallback)' in 'com.parse.parsequery' cannot applied '(anonymous com.parse.getcallback "com.parse.parseobject>)' i'm new app dev , parse, i'm not entirely sure means. understand wont let me use getfirstinbackground because works parseuser's , i'm working parseobjects, code i'm using pulled prior stackoverflow question working answer: login username , email in parse android here code: // allow username or email log in if (memail.indexof("@") != -1) { parsequery<parseuser> query = parseuser.getquery(); query.whereequalto("email", memail); query.getfirstinbackground(new getcallback<parseobject>() { ...

intellij idea - Java - duplicate case label -

i found time ago function replace polish characters in text "normal" version of character. used in projects earlier without problems, now, when copied it, doesn't want work. when try compile old projects in same ide(intellij idea 14.1.3) ok, in new project it's giving me errors: error:(22, 17) java: duplicate case label it happens each case except first , default. function code: public static string polskieznaki(string s) { char[] tekst = s.tochararray(); s = ""; for(int i=0; i<tekst.length; i++) { switch(tekst[i]) { case 'ą': tekst[i] = 'a'; break; case 'ć': tekst[i] = 'c'; break; case 'ę': tekst[i] = 'e'; break; case 'ó': tekst[i] = 'o'; break; case 'ś': tekst[i] = 's'; break; case 'ł': tekst[i] = 'l'; break; case 'ż'...

python - Is there A 1D interpolation (along one axis) of an image using two images (2D arrays) as inputs? -

this question has answer here: interpolate in 1 direction 1 answer i have 2 images representing x , y values. images full of 'holes' (the 'holes' same in both images). i want interpolate (linear interpolation fine though higher level interpolation preferable) along 1 of axis in order 'fill' holes. say axis of choice 0, is, want interpolate across each column. have found numpy interpolation when x same (e.g. numpy.interpolate.interp1d). in case, however, each x different (i.e. holes or empty cells different in each row). is there numpy/scipy technique can use? 1d convolution work?(though kernels fixed) you still can use interp1d: import numpy np scipy import interpolate = np.array([[1,np.nan,np.nan,2],[0,np.nan,1,2]]) #array([[ 1., nan, nan, 2.], # [ 0., nan, 1., 2.]]) row in a: mask = np.isnan(row) x,...

Elasticsearch Java API Function Score Query with geo and time gauss function -

i trying build function score query java api of elasticsearch: { "query": { "function_score": { "functions": [ { "gauss": { "location": { "origin": { "lat": 52.55, "lon": 13.69 }, "offset": "30km", "scale": "10km", "decay": 0.9 } } }, { "gauss": { "createdat": { "origin": "2015-06-14t15:50:00", "scale": "8h", "offset": "4h", "decay": 0.75 } } ...

javascript - Self Executing Anonymous Function Syntax -

i write js self executing anonymous functions (function(){})() but other day saw this, in somebody's code (function(){}()) what's difference, , 1 recommended on other? (function(){}()); i recommended one, because makes more sense. you have function function(){} append () execute it, wrap whole thing in () specify it's expression. done js interpreter not define function declarations, function expression. but doesn't matter, execute properly, it's personal taste problem.

php - How do I encode an array in a form field in NodeJS' request? -

i'm using api requires me put array in form field. example given in php, i'm using nodejs. api expects 1 of fields array, , i'm having hard time figuring out how this. the php example looks this: $request->buildpostbody(array( 'reference' => array( 'line1' => 'soundboard setup', 'line2' => 'thank order', 'line3' => 'our reference is: 3993029/11bd' ), 'lines' => array( array('amount' => 50, 'amount_desc' => 'panels', 'description' => 'sound buttons', 'tax_rate' => 21, 'price' => 5.952 ), array('amount' => 1, 'amount_desc' => '', 'description' => 'wooden case', 'tax_rate' => 21, 'price' => 249 ), array('amount' => 10, 'amount_desc' => 'hours', 'description' => 'support', 'ta...

php - Call to a member function saveSibling() on a non-object? -

i added code add row dynamically form , when user submit form call function(savesibling) of application object save data database(sibling table)but doesnt work. when data has been submitted user redirected updateappplication.php $userid = $_session['username']; $a = new application(); $namesib = $jobsib = $relationshipsib = $jabatan = $age = $statussib = ""; $check = true; if ($_server["request_method"] == "post") { //save n cont next form if(isset($_post['savecontinue'])) { $namesib = $_post['namesib']; $jobsib = $_post['jobsib']; $relationshipsib = $_post['relationshipsib']; $jabatan = $_post['jabatan']; $age = $_post['age']; $statussib = $_post['statussib']; foreach($namesib $a => $b) { if(isset($_post['namesib']) && isset($_post['relationshipsib']) && isset($_post['age...

search - Elasticsearch highlighting with wildcard does not work as expected -

i using elasticsearch highlight sometime , having problems. here highlight query: "highlight" : { "pre_tags" : [ "<span class=\"mark\">" ], "post_tags" : [ "</span>" ], "order" : "score", "encoder" : "html", "require_field_match" : false, "fields" : { "*" : { } } } i specifying * in fields because need highlighting possible fields , not want specify them all. problem if use field query highlights fields not queried, example if query for: name:macdonalds it highlight also: name:**macdonalds** description: **macdonalds** fast food... i using query_string query, , cannot set require_field_match true since searching free test in fields , if set parameter true not highlight anything... any suggestions? has stumble on such issue? well, have managed workaround issue (following @will comment) when specifying explicitly fie...

cordova - SignalR working in browser not in app -

i have app uses signalr when try in browser works properly. of course connection absolute url×¥ when deploy app android device doesn't work. connected chrome remote debug app's webview , can see network tab. the negotiation working , can see result besides nothing works. i assume might permission\configuration issue since works on browser. which steps should take make work? so managed make work. since i'm doing cross-domain communication using jsonp wanted same signalr. in browser worked when compiled apk , ran on device didn't work. changing signalr use cors , not jsnop solved issue.

jquery - slick.js on last slide show alert -

i'm using slick.js http://kenwheeler.github.io/slick/ run through slides, last of should toggle alert. after ferreting around online , realizing should work without having hard code number of slides (and having seen solution: slick carousel. want autoplay play slides once , stop ), i've got following code: $(document).ready(function(){ var item_length = $('.slider > div').length - 1; $('.slider').slick({ appendarrows : '.arrow-holder', adaptiveheight : true, infinite : false, onafterchange: function(){ if( item_length == slider.slickcurrentslide() ){ alert("slide 2"); }; } }); }); unfortunately, nothing happens when reach last slide. nor seem if hard code in last number, taking account 0 indexing. i have no errors or warnings in console, struggling work out how figure out proble...

start-stop-daemon and javaFX program -

this driving me crazy, please start-stop-daemon start javafx jar file, need issue following command start it sudo /opt/jdk1.8.0/bin/java -djavafx.platform=eglfb -cp /opt/jdk1.8.0/jre/lib/jfxrt.jar:/home/pi/prayertime/javafxapplication4.jar javafxapplication4.javafxapplication4 & and start_stop_daemon script follows #!/bin/sh # # init script ship-it # ### begin init info # provides: ship-it # required-start: $remote_fs $syslog $network # required-stop: $remote_fs $syslog $network # default-start: 2 3 4 5 # default-stop: 0 1 6 # short-description: init script ship-it box # description: we'll have fill out later... ### end init info path=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin name=prayertime daemon=/home/pi/prayertime/javafxapplication4.jar daemonargs="javafxapplication4.javafxapplication4" pidfile=/var/run/$name.pid logfile=/var/log/$name.log . /lib/lsb/init-functions test -f $daemon || exit 0 case ...

Python: pickle error: __new__() takes exactly 2 arguments (1 given) -

related: pickle load error "__init__() takes 2 arguments (1 given)" import cpickle pickle pklfile = "test.pkl" all_names = {} class name(object): def __new__(cls, c, s="", v=""): name = "%s %s %s" % (c, s, v) if all_names.has_key(name): return all_names[name] else: self = all_names[name] = object.__new__(cls) self.c, self.s, self.v = c, s, v return self open(pklfile, 'wb') output: pickle.dump(name("hi"), output, pickle.highest_protocol) open(pklfile, 'rb') input: name_obj = pickle.load(input) output: traceback (most recent call last): file "dopickle.py", line 21, in <module> name_obj = pickle.load(input) typeerror: __new__() takes @ least 2 arguments (1 given) is possible make work without having second argument optional? use __getnewargs__ , called when object pickled , provides tuple...

c - Is overflow of intN_t well-defined? -

this question has answer here: do c99 signed integer types defined in stdint.h exhibit well-defined behaviour in case of overflow? 2 answers in c99 there're (optional) types int8_t , int16_t , like, guaranteed have specified width , no padding bits, , represent numbers in two's complement (7.18.1.1). in 6.2.6.2 signed integer overflow mentioned footnotes 44) , 45), namely might result in trapping values in padding bits . as intn_t don't have padding bits, , guaranteed two's complement, mean overflow doesn't generate undefined behavior? result of e.g. overflowing multiplication? addition? result reduced modulo 2^n unsigned types? footnotes not normative. if footnote states overflow can result in trapping values in padding bits, not wrong, can see how misleading. normative text merely says behaviour undefined. placing trapping values i...

oracle - Get 'PL\SQL Table' returned from a function with OracleCommand in C# -

i'm new using oraclecommand in c# return results oracles procedures\functions, i've been able of storedprocedure executions working i'm in need of advise on following. below function returns table created off record type create or replace function return_table return t_nested_table v_ret t_nested_table; begin v_ret := t_nested_table(); v_ret.extend; v_ret(v_ret.count) := t_col(1, 'one'); v_ret.extend; v_ret(v_ret.count) := t_col(2, 'two'); v_ret.extend; v_ret(v_ret.count) := t_col(3, 'three'); return v_ret; end return_table; the type created follows create or replace type t_col object ( number, n varchar2(30) ); the table t_col record create or replace type t_nested_table table of t_col; now when wanted execute function in c#, tried following realised oracledbtype has no enum pl\sql table. using (oracleconnection conn = new oracleconnection(connection)) using (oraclecommand cmd = n...

swift2 - Swift 2.0 import and compile with sqlite3 library -

trying test sqlite swift 2 cannot make correct build when adding libsqlite3.0.tbd file on link binary libraries. tried add libsqlite3.dylib /usr/lib following error. ld: library not found -lsqlite3 clang: error: linker command failed exit code 1 (use -v see invocation) any idea on how can correctly build library. empty project testing. lot in advance. seeing here well. assuming 'tbd' means 'to done', in, library still needs built osx 10.11 sdk. should disappear in next beta... meanwhile, can fixed going project's settings -> build phases -> link binaries. click '+', click 'add other'. hit cmd-shift-g , navigate /usr/lib. there, can select libsqlite3.dylib. project should build without error. in order prevent errors when moving xcode project around, make sure reference libsqlite3.dylib uses absolute path (click on .dylib in file list, go properties pane , select 'absolute path')

scala - Call Redis (or other db) from within Spray Route -

i trying figure out best way establish redis pool , make calls redis within spray route. want make sure can use connection pool redis connections. best way instantiate pool , use within spray routes? there better way establish "global" pool can used? should create actor instead , use make redis calls? bit ignorant here. crude redis client: object redisclient { val pool = new jedispool(new jedispoolconfig(), "localhost") def getvalue(key: string): string= { try{ val jedis = pool.getresource() //returns redis value jedis.get(key) } } } route ends calling function uses redis client trait demoservice extends httpservice { val messageapirouting = path("summary" / segment / segment) { (dataset, timeslice) => oncomplete(getsummary(dataset, timeslice)) { case success(value) => complete(s"the result $value") case failure(ex) => complete(s"an erro...

xcode - Differences between Playground and Project -

Image
in course of answering question, came across weird bug in playground. have following code test if object array , dictionary or set : import foundation func iscollectiontype(value : anyobject) -> bool { let object = value as! nsobject return object.iskindofclass(nsarray) || object.iskindofclass(nsdictionary) || object.iskindofclass(nsset) } var arrayofint = [1, 2, 3] var dictionary = ["name": "john", "age": "30"] var anint = 42 var astring = "hello world" println(iscollectiontype(arrayofint)) // true println(iscollectiontype(dictionary)) // true println(iscollectiontype(anint)) // false println(iscollectiontype(astring)) // false the code worked expected when put swift project or running command line. playground wouldn't compile , give me following error on downcast nsobject : playground execution failed: execution interrupted, reason: exc_bad_access (code=2, address=0x7fb1d0f...

How this code using the wavread function works in matlab? -

i have problems understanding code question (i can't comment on answer because i'm new , don't have enough reputation). the code this: [song, fs] = wavread('c:\path of file\song.wav'); song = song(1:fs*10); spectrogram(song, windowsize, windowoverlap, freqrange, fs, 'yaxis'); i don't know second line of code does. can explain it? affect output of spectrogram? my code is: [song, fs] = wavread('c:\users\iván\downloads\kawai-k3-strings-c5.wav'); song = song(1:fs*5); //(first line ...(1:fs*10) didnt work. why? know. spectrogram(song, 256, [], [], fs, 'xaxis'); the second line of code extracting sample of song's time series of length 10 times sampling frequency in hertz. you should first check there enough samples in song checking length of song using songlength = numel(song)/fs if there not enough samples cover 10 times sample frequency, use shorter multiplier. the spectrogram being computed on sample, r...

jquery - How to make a variable into a true or false statement -

how can enable / disable each or of these 3 variables , can use same script on pages, decide if want 1 , 2 or 3 of varibles set true or false. https://jsfiddle.net/zqu3eqfm/364/ var donotcountp = ':has(.warning):contains(p)'; var donotcounts = ':has(.warning):contains(s)'; var donotcounto = ':has(.warning):contains(o)'; $('.two_column_layout').find("td.player:not("+donotcountp+"):not("+donotcounts+"):not("+donotcounto+")").css('background', 'red'); you can try way (untested code - , better code quality want extract method if-loops): var donotcountp = true; var donotcounts = false; var donotcounto = true; var getplayerquery = function() { var result = "td.player"; if(donotcountp) { result = result + ":not(':has(.warning):contains(p)')"; } if(donotcounts) { result = result + ":not(':has(.warning):contains(s)'...

javascript - Is it safe to modify an Array in for (..in..) loop? -

a = [1,2,3,4,5]; (var in a) { if (a[i] == 4) a.splice(i,1), a.push(7); if (a[i] == 2) a.splice(i,1), a.push(0); if (a[i] == 7) console.log('seven'); if (a[i] == 0) console.log('zero'); } console.log(a); this seems work, not know details of implementation of for(..in..) loop sure safe in conditions. see paired question object modification it's safe change object in sense won't browser complain change array. note that, in example, still valid behavior if saw "seven, zero", "seven", "zero", or nothing @ being printed. on 1 hand, browsers must ensure properties deleted, before being visited, not enumerated. on other hand, browsers free to: enumerate new properties or let them out of loop enumerate properties order. that why not safe use for ... in iterate arrays when depend on index/order. indexes treated enumerable properties , can enumerated same mechanics used object's properties (where...

Fade in letter by letter with JQuery -

i'm trying text of all_msg, , hide method hide , fade in 1 letter @ time, tiny delay, code. var $all_msg = $('#welcome_msg'); function animate(i) { $all_msg.hide(); $all_msg.text.each(function(index) { $(this).delay(700 + index).fadein(1100); }) } and console giving me back: $all_msg.text.each not function i'm new coder if can me give me major boost, thanks. you need retrieve text .text() , split delimiter of choice (space list of words, or empty string list of characters), create span each of items in list , append container on page(and fade them if want): $(function() { //get welcome msg element var $all_msg = $('#welcome_msg'); //get list of letters welcome text var $wordlist = $('#welcome_msg').text().split(""); //clear welcome text msg $('#welcome_msg').text(""); //loop through letters in $wordlist array ...

osx - wireshark - install stable and development builds in OS X -

how can install both (at time of writing) 1.12.5 , 1.99.6 in os x 10.8.5? afaik wireshark installs kmditemcfbundleidentifier path. for lack of answers tried following. installed stable release 1.12.5 first , moved application bundle trash, installed dev version 1.99.6 , renamed app bundle 'wireshark [dev build]', next moved older version trash applications folder. far both working. chmodbpf , wireshark cli utility launcher didn't changed. didn't notice problems in install scripts, might wrong.

xcode - Reload Component in UI Picker View Swift -

i unable reload second component in upickerview based on first component. tried using reloadallcomponents either not work or crashes. trying work on place car makes on left , models of cars on right. when car make changes, simultaneously change right component model. class registrationpage: uiviewcontroller,uipickerviewdatasource, uipickerviewdelegate { @iboutlet weak var usernametextfield: uitextfield! @iboutlet weak var passwordtextfield: uitextfield! @iboutlet weak var passwordretypetextfield: uitextfield! @iboutlet weak var makepicker: uipickerview! @iboutlet weak var modelpicker: uipickerview! @iboutlet weak var licensetagtextfield: uitextfield! var picker1options = [] var picker2options = [] @ibaction func submitbutton(sender: anyobject) { } override func viewdidload() { super.viewdidload() makepicker = uipickerview() modelpicker = uipickerview() let makeandmodel = carmakemodel(); picker1options = makeandmodel.makevalues() let firstvalue = picke...

algorithm - How to find Inverse Modulus of a number i.e (a%m) when m is not prime -

i searched answer question, got various useful links when implemented idea, getting wrong answer. this understood : if m prime, simple. inverse modulus of number 'a' can calculated as: inverse_mod(a) = (a^(m-2))%m but when m not prime, have find prime factors of m , i.e. m= (p1^a1)*(p2^a2)*....*(pk^ak). here p1,p2,....,pk prime factors of m , a1,a2,....,ak respective powers. then have calculate : m1 = a%(p1^a1), m2 = a%(p2^a2), ....... mk = a%(pk^ak) then have combine these remainders using chinese remainder theorem ( https://en.wikipedia.org/wiki/chinese_remainder_theorem ) i implemented idea m=1000,000,000,but still getting wrong answer. here explanation m=1000,000,000 not prime m= (2^9)*(5^9) 2 , 5 m's prime factors. let number have calculate inverse modulo m. m1 = a%(2^9) = a^512 m2 = a%(5^9) = a^1953125 our answer = m1*e1 + m2*e2 e1= { 1 (mod 512) 0 (mod 1953125) } , e2= { 1 (mod 1953125) ...