Posts

Showing posts from March, 2015

Notepad++ Search For 3 Character -

i have huge textfile different names. how search names include 3 characters or 3 characters long? press ctrl+f , enable regular expression search. search for: [^a-za-z][a-za-z][a-za-z][a-za-z][^a-za-z] it'll search for: [non-letter character] 3*[letter character] [non-letter character] edit: said, wanted search numbers too, how: [^a-za-z][a-za-z][a-za-z][a-za-z][^a-za-z]

responseText from $.get in jquery -

i have code: var response = $.get(url); and want responsetext returned response object. , there. solutions i've looked on stackoverflow change ajax request, data there in object. how can responsetext out of object? dont want change above code. jquery.get returns jqxhr object var response = $.get(url); response.done(function(data) { alert(data); });

r - elegant way to use rbind() on multiple dataframes with similar names? -

currently, have multiple dataframes same name , in running order ( foo1 , foo2 , foo3 , foo4 , foo5 ... etc). trying create large dataframe containing rows of above dataframes rbind() . there elegant way equivalent of rbind(foo1, foo2, foo3, foo4, foo5...) ? i have tried do.call(rbind, paste0("foo",i)) i=c(1,2,3...) no avail. there solution mentioned here , is: do.matrix <- do.call(rbind, lapply( paste0("variable", 1:10) , get) ) however, answer mysteriously says "that wrong way handle related items. better use list or dataframe, find out why in due course." why wrong way this, , "right" way? thanks. always try rigorously capture relations between related instances of data, or related data , methods, or related methods. helps ease aggregate manipulation such rbind requirement. for case, should have defined related data.frames single list beginning: foo <- list(data.frame(...), data.frame(...), ... ); and requ...

php - Is this way of using the method GET wrong? -

there i've been working , ran problem solve doing header("location:messages.php?id_conversation=$row[id]"); is "wrong"? this not wrong exactly. redirecting resource , passing information resource part of url, , acceptable. however, part wrong way url structured. if going doing regularity, want habit of setting location precisely possible. at least should set full path relative domain root: header("location:/any_directories/messages.php?id_conversation=$row[id]"); and @ best, means including domain , protocol well: header("location:https://yourdomain.com/any_directories/messages.php?id_conversation=$row[id]"); to simplify this, create helper function or object handle kind of redirect. function redirect($url) { header("location:https://yourdomain.com/$url"); } redirect("any_directories/messages.php?id_conversation=$row[id]"); obviously there other considerations in above function, pass...

javascript - How to exclude a specific id from an array? -

i have array sports names, option check , uncheck them. the items checked = false being saved in db. default items in checked = true , but, want exclude 1 of items in array , put checked = false instead. at first, array looks this [ { "id": 26, "name": "live betting", "priority": 0 }, { "id": 8, "name": "nba", "priority": 1 }, { "id": 24, "name": "college basketball", "priority": 2 }, { "id": 42, "name": "women college basketball", "priority": 3 }, { "id": 9, "name": "nhl", "priority": 4 }, { "id": 6, "name": "mlb", "priority": 5 } ] and function working on here _this.getsportchecked(customer).then(function(sportchecked) { var sportids...

android - How to set up authorization in Google Maps according to the OAuth 2.0 protocol? -

i decided realize in application on android access user resources google maps according oauth 2.0 protocol. me new experience, don't know begin, didn't find examples, can looked badly therefore decided ask question. you can read oauth step google documentation here basic steps: obtain oauth 2.0 credentials google developers console. obtain access token google authorization server. send access token api. refresh access token, if necessary.

mercurial - Sourcetree - stuck notification / 1 not tracked file -

i using sourcetree mac hg. i have 1 stuck notification on working copy , says @ bottom of window (bottom status bar) have 1 not tracked file, can't find anywhere if in "all files". even though committing/pushing works anyways, it's bothering me , i'd know if of guys ever had problem before rid of ? git clean -f removed stuck 'a.out' file..

Outlook VBA Move Single Email To Numerous Folders -

i move email 1 existing folder 1 or more subfolders. simple example: email arrives john doe. move mmyy subfolder (that may not exist) under folder named doe, john (that may not exist). if email marked high importance, put copy of email in 2nd subfolder named "highimportance". lastly if email identified highvolumeemailer sql query, move 3rd subfolder named "highvolumeemailer". the vba moves email mmyy folder, potentially save copies of same email 2 other folders. total of three. here code not work: set objdestfolder = objsourcefolder.folders(ssendername) if objdestfolder nothing set objdestfolder = objsourcefolder.folders.add(ssendername) end if set objnewfolder = objdestfolder.folders(smonthandyearofemail) if objnewfolder nothing set objnewfolder = objdestfolder.folders.add(smonthandyearofemail) end if objvariant.move objnewfolder 'count # of items moved lngmoveditems = lngmoveditems + 1 '''''if marked high importa...

javascript - Filter or search in jQuery easy Ui -

i have been working awesome plugin - jquery easyui displaying tree structure. working fine except search functionality, not give proper results. refer http://jsfiddle.net/sanno_s88/rhqbk496 if try search parent nodes, should return child nodes. in scenario, used dofilter method works child nodes trims child nodes when search parent. an example child's when search parent, child on search of javascript. i can write own search logic, wanted know if can using dofilter function. any thoughts highly appreciated!

sql server - Avoid picking rows from joined table and use it only to get column value -

dbo.matchdate(@date) :an inline tvf returns results dbo.patients table .the inline tvf returns these columns : rowid , percentmatch . i have query far: insert #temp2 (rownumber,valfromfunc,funcweight,percentage) select rownumber, d.percentmatch, @constval, d.percentmatch * @constval dbo.matchdate(@date) d inner join dbo.patients p on d.rownumber = p.rowid inner join dbo.resultsstored rs on rs.rowid = d.rownumber p.modifiedat > rs.modifiedat i needed check if modifiedat value of rows returned dbo.matchdate(@date) function dbo.patients table greater modifiedat of rows in resultsstored table rowid's same returned dbo.matchdate(@date) . since dbo.matchdate(@date) returns rowid , percentmatch , modifiedat of rows, joined patients table on rowid column. comparison sake, modifiedat resultsstored table, joined further dbo.resultsstored on rowid column only. problem : results in duplicated rows inserted i.e not getting rows dbo.matchdate(@date) dbo.re...

ios - Pan Gesture Not Working With SWRevealViewController -

i'm using swrevealviewcontroller have sidebar menu in ios app. both front , rear view controllers table view controllers. front view controller has bar button item displays rear view controller, , i've enabled pan gesture display rear view controller. problem pan gesture recognizer works first time, bar button launches rear view controller. if me fix pan gesture worked, great, thanks. the swrevealviewcontroller toggles both views launched storyboard. here code front view controller: - (void)setupsidebarmenu { self.navigationitem.leftbarbuttonitem.target = self.revealviewcontroller; self.navigationitem.leftbarbuttonitem.action = @selector(revealtoggle:); [self.tableview addgesturerecognizer:self.revealviewcontroller.pangesturerecognizer]; [self.tableview addgesturerecognizer:self.revealviewcontroller.tapgesturerecognizer]; } here code rear view controller: - (void)setupsidebarmenu { self.navigationitem.leftbarbuttonitem.target = self.revealvie...

java - Keep adding two numbers until the input is not a double type -

i trying make simple calculator program user enters 2 values, method add() called operations class , values added , result displayed. , using while loop in user keeps entering values added last total , result displayed. has keep running unless user enters input not of type double. import java.util.scanner; public class app { public static void main(string[] args) { scanner input = new scanner(system.in); system.out.println("enter first number: "); double number = input.nextdouble(); system.out.println("enter second number: "); double number2 = input.nextdouble(); double total = operations.add(number, number2); system.out.println(total); system.out.println("enter number again: ); number2 = input.nextdouble(); { total = operations.add(total, number2); system.out.println(total); system.out.println("enter number again: "); ...

jQuery or Javascript: detecting if the text caret has left an element? -

is there way, via jquery or regular javascript, detect if user's text caret has moved out of element (such td, div, span, etc.)? the scenario this: have table of textboxes grouped in pairs inside span element. performing validation on entries in pair not want validation errors pop until user has switched pair of textboxes (i.e. span). perhaps i'm going wrong way, in mind i'm thinking perform validation on pair once user has switched out. need know when caret has moved on span element. can't rely on mouse position since user flick mouse pointer other location while making entries. you can use loses focus event <input type="text" onblur="myfunction()"> or $("input").focusout(function(){ //do somthing; });

Can someone help me Retrieve file from SQL Server vb.net -

can me?!i having problem project have table named document have fields ( id_d , type_d, date_create_d , way , #nbr_som ) , nbr_som foreign key references table named fonctionnaire when print document example(work certificate), document registred file pdf in record exemple (d:\bts\document ) , when search work certificate on forme on (vb.net) date of year or month want extract files this code form contains crystalrepotviewer : private sub form2_load(byval sender system.object, byval e system.eventargs) handles mybase.load dim r new rcattestationdetravail dim dt datatable dt = form1.pfe_grhdataset.enseignants r.setdatasource(dt) crystalreportviewer1.reportsource = r crystalreportviewer1.selectionformula = "{enseignants.num_som} = " & form1.num_somtextbox.text '' dim rapport new rcattestationdetravail dim filename string dim str string = ":" filename = "c:\users\salha\docume...

ios - Possible to get UIButton sizeThatFits to work? -

i have been using method of resizing uibuttons depreciated, , not robust. , other reasons, want sizethatfits work uibuttons. i've read online, i'm not sure if should work (seems working some, not others, difference maybe between style, i'm using custom). here simple test code recreate issue (i put in viewdidload test, shouldn't matter, , real code part of large project): uibutton *btn = [uibutton buttonwithtype:uibuttontypecustom]; [btn settitle:@"this test long title need word wrap more single line when displayed on tiny ipod in portrait view." forstate:uicontrolstatenormal]; btn.titlelabel.linebreakmode = uilinebreakmodewordwrap; // depreciated - nothing replace it? cgrect r = btn.frame; r.origin.x = 0; r.origin.y = 0; r.size.width = 320; r.size.height = [btn.titlelabel.text sizewithfont:btn.titlelabel.font constrainedtosize:cgsizemake(r.size.width,100000) linebreakmode:btn.titlelabel.linebreakmode].height; // returns approx 86 , changes correctly ...

python - "TypeError: read() takes exactly 1 argument (2 given)" when trying to use read() from subclass -

i'm writing class extends pyserial's serial.serial class, , i'm having trouble using readline() function. i'm able reproduce problem little code this: import serial class a(serial.serial): def read(self): return super(a, self).readline() = a() a.read() when run code, traceback: traceback (most recent call last): file "<stdin>", line 1, in <module> file "<stdin>", line 3, in read typeerror: read() takes 1 argument (2 given) i know i'm missing here. expect pass 1 argument ( self ). second argument come from? also, tried using inspect.getcallargs(a.read) figure out second argument, got traceback: traceback (most recent call last): file "<stdin>", line 1, in <module> file "/usr/lib/python2.7/inspect.py", line 900, in getcallargs args, varargs, varkw, defaults = getargspec(func) file "/usr/lib/python2.7/inspect.py", line 815, in getargspec r...

php - How to know if a script was included inside another script -

i new php , using incorrect approach because not used think php programmer. i have files include other files dependencies, these files need have global code executed if $_post contains values, this if (isset($_post["somevalue"])) { /* code goes here */ } all files contain code section, each 1 it's own code of course. the problem since files can included in 1 of these files, code section describe executed in every included file, when post trhough ajax , explicitly use url of script want post to. i tried using $_server array try , guess script used post request, , though worked because right script, same script every included file. question is: is there way know if file included file can test , skip code execute if $_post contains required values? note : files generated using python script uses c library scans database it's tables , constraints, c library mine python script, work , if there fix single file, needs performed python script. ...

Rails 4.2 self-join model -- Create method returns error -

i have simple self-join model account. account can have single parent and/or multiple child accounts. here class: class account < activerecord::base has_many :children, class_name: "account", foreign_key: "parent_id" belongs_to :parent, class_name: "account" end and migration: class createaccounts < activerecord::migration def change create_table :accounts |t| t.references :parent, index: true t.string :name t.string :category t.timestamps null: false end end end when create method invoked on controller, following error: account(#70188397277860) expected, got string(#70188381177720) and references first line of create method in controller: def create @account = account.new(account_params) respond_to |format| if @account.save format.html { redirect_to @account, notice: 'account created.' } format.json { render :show, status: :created, location: @account } else...

OpenCv on Android without using OpenCv manager is not working -

Image
am using opencv on android , when run application give me option of installing opencv manager , don't want use option application. followed this answer forum , follow steps still asking me opencv manager. below android.mk local_path := $(call my-dir) include $(clear_vars) opencv_camera_modules:=on opencv_install_modules:=on opencv_lib_type:=static include c:\opencv-2.4.10-android-sdk\sdk\native\jni\opencv.mk local_module := mixed_sample local_src_files := jni_part.cpp local_ldlibs += -llog -ldl include $(build_shared_library) and properties option i add below code crashes @override public void onresume() { super.onresume(); mloadercallback.onmanagerconnected(loadercallbackinterface.success); } my code after static initialization public class tutorial2activity extends activity implements cvcameraviewlistener2 { static { if (!opencvloader.initdebug()) { // handle initialization error } } ...

php - HTML Form With Enctype Breaks $_POST Data -

a bit of perplexing problem right now. i'm trying set form upload video. here's form: <form role="form" action="upload.php" method="post" enctype="multipart/form-data"> <input type="hidden" name="upload" value="1"> <div class="row"> <div class="col-xs-6"> <span class="btn btn-lg btn-primary btn-block btn-file"> browse... <input type="file" name="file"> </span> </div><!-- col-xs-6 --> <div class="col-xs-6"> <h4 class="feedback-field text-centered">no file selected.</h4> </div><!-- col-xs-6 --> </div><!-- row --> <div class="r...

csv - D3 nested objects should be different colors -

i'm creating line graph in area under line colored based on variable rank not taken account plotting date , close . i'm using d3.nest() chunk data based on rank , looping through datagroup , plotting each entry random color. based on thought process, each of datagroups should different color, when plots, 1 random color whole plot. here's plunker <!doctype html> <meta charset="utf-8"> <style> body { font: 12px arial; } text.shadow { stroke: #fff; stroke-width: 2.5px; opacity: 0.9; } path { stroke: steelblue; stroke-width: 2; fill: none; } .axis path, .axis line { fill: none; stroke: grey; stroke-width: 1; shape-rendering: crispedges; } .grid .tick { stroke: lightgrey; stroke-opacity: 0.7; shape-rendering: crispedges; } .grid path { stroke-width: 0; } .area { stroke-width: 0; } </style> <body> <script src="http://d3js.org/d3.v3.min.js"...

python - psycopg update doesn't work -

i'm trying use psycopg update rows in postgres database , doesn't anything, script runs without error database doesn't change. import psycopg2 conn = psycopg2.connect("dbname=timetrack user=n") cur = conn.cursor() cur.execute("select id, extract(epoch begin_time) b, extract(epoch end_time) e activities;") rows = cur.fetchall() m = 10 ** 6 in range(0, len(rows)): row = rows[i] print(row) cur.execute("update activities set begin=(%s), \"end\"=(%s) id=(%s);", (row[0] * m, row[1] * m, row[2])) conn.commit() cur.close() conn.close() it turns out made mistake in indexing of row variable. wanted set begin begin, end end, , id id in string. however, ended setting begin id, end begin, , id begin. postgres couldn't find rows update because ids wrong, did nothing.

javascript - Success in $.ajax is not get executed -

i novice ajax. first example, wanted implement add operation. purpose, wrote following code: html: <!doctype html> <html> <head> <title>add 2 numbers</title> <meta content="text/html;charset=utf-8" http-equiv="content-type"> <meta content="utf-8" http-equiv="encoding"> <script src="jquery.js"></script> </head> <body> <form id="addform" method="post"> <input type="text" name="first"> <input type="text" name="second"> <input type="submit" name="btnsubmit"> </form> <script src="global.js"></script> </body> </html> php: <?php header('content-type: text/html; charset=utf-8'); $json = array('success' => false, 'result...

java - Hibernate Automatically load relationships -

i have following entity classes userentity , ticketentity. user has many tickets , many tickets can belong user. question is, there way automatically load tickets belonging pertaining user using hibernate or have manually load entity relationships db? think .load() i'm not quite sure. in case like userentity.load() any appreciated, thanks userentity.java package com.issuetracking.domain; /** */ import java.util.list; import javax.persistence.*; @entity @table(name="user") public class userentity { @id @column(name="user_id") @generatedvalue(strategy=generationtype.auto) private int id; @column(name="firstname") private string firstname; @column(name="lastname") private string lastname; @column(name="username") private string username; @column(name="email") private string email; @column(name="password") private string password; @transient private string confirmpassword; @column(name=...

jailbreak - Programmatically put an iOS device to sleep -

i wondering if there way programmatically put idevice sleep, jailbreak tweak. test if iphone on too. there way (public or private api) this? simulating press cool. know activator cydia tweak can this, wondering how. all methods private springboardservices.framework : void* sbsspringboardserverport(); void sblockdevice(void*); to lock device use this: sblockdevice(sbsspringboardserverport());

javascript - Mouseover on all elements in frame only responds to click -

i'm trying apply handler elements inside iframe (that on same domain) , can't figure out why function fires on click. fear may have fact iframe active when i'm clicking it. have seen applications of in jsfiddle such http://jsfiddle.net/danmana/pmbw2/ this code (i tried mimicking jsfiddle using delegate function , got same results): $('iframe').contents().on("mouseover", "*", function() { $(this).css("background-color", "yellow"); }); edit working jsfiddle ( http://jsfiddle.net/danmana/pmbw2/ ) found if switch newest version of jquery 2.1.0, code no longer works, seems 1.8.3 newest 1 works code. this works me - var $c = $('iframe').contents(); $c.delegate('div', 'hover', function() { $(this).css("background-color", "yellow"); });

assembly - Machine Code (.asm & movsx) -

i'm looking @ these problems in book , trying figure out mean exactly. .data 1 word 8002h 2 word 4321h .code mov edx,21348041h movsx edx,one movsx edx,two ^ edx starts out value of 21348041 hex right? because of movsx edx adds fffff8002 hex? edx adds fffff4321 hex? confusing, assuming book explaining movsx converts signed? the first 1 correct, not "adds". mov* moves data. because request data treated signed, , you're using less 1 word of data (assuming 32 bit architecture), actual data moved padded left 1 if source number has left-most bit set (ie negative). note addendum @ end. because 0x4321 isn't negative (less 0x8000 ), if treat signed it's still positive. move literal value give it.

BizTalk WCF-SQL typed stored procedure response schema -

Image
generating response schema typed stored procedure, stored procedure did database updates prior returning final resultset. response schema generated visual studio has quite garbage. is there way force generate cleaner schema? the storedprocedureresultset4 1 matters. here's same answers msdn. unfortunately, marked answer not work since there no way, or it's really, hard, capture , suppress result sets called stored procedure. the cause related stored procedure code. the wizard generate schema types elements returned in response sql server. meaning, stored procedure emitting results updates you're getting metadata them. the way solve modifying sp code not emit result on operation shouldn't. basically, if see in result window in sql management studio, schema it. status , message presumably result of sp 1 way suppress assign result temp table redirecting form output stream. however, if storedprocedureresultset4 matters, that's have use. ...

java - Can all users access the tables created in my schema? -

i've installed oracle 12c, sql developer, , have created several tables...but in schema. want create oracle db backend java front end application. once created, schemas available user appropriate permissions or local user created them? that's more 1 question. but, create account (or multiple accounts) own tables , stored procedures , functions. , yes, once created can access (as long have required permissions). , yes, can run stored procedures , functions create (again, if have required permissions).

css - Getting rid of blank space below footer in Mobile -

Image
client didn't want have responsiveness website, have totally removed responsiveness bootstrap based wordpress theme. website looking how looks in desktop. however, on cart page, there not content or div elements, page ends soon, causing white space isn't looking good. i've posted screenshot below. there fixed footer @ end, not visible on page. advice appreciated. i've given these 2 in header. <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width" /> edit: due not having sufficient content on particular website page mobile displaying it's default behavior of showing white space. solved having min-height . as have mentioned footer positioned fixed, need set bottom style property 0 [bottom:0 !important], , need implement media-query in order have implemented mobile it's happening while opening website in mobile. so might c...

xmpp - Ejabberd : Disable request Accept/Cancel to chat with another user -

currently, i'm developing ios/web app when testing xmpp server imessage , adium see request each other able chat. certificate acceptance. haven't start xmpp development on web , ios. still need follow steps? there way can chat everyone? in xmpp, people request each other see others in contact list , see presence. however, nothing in xmpp prevent user chatting user not in roster. if ui allow start chat based on specific user jid, can chat together. the default let chat everyone.

opengl es - Android GLES 2 draw line flicker and strange effects -

Image
i trying draw 3d lines in android using gles 2. resulted in strange effects. flicker happens when rotate scene/camera. not that, there lines drawn in 2d (sometime dots) @ random. screenshot: while image shows no problem @ (using different camera angle): i've tried use gles 1 draw these lines , worked (no flicker or random lines). perhaps have shader code? vertex shader taken android gles example simple. update: after more tries, found happens when camera yaw (y axis rotary) more 90 degree. within range of 0-90 yaw, lines display normally. doing wrong? i'm running program on galaxy tab s android v4.4.2. here whole code used reproduce erroneous image: main activity: package com.mycompany.bug_test; import android.opengl.glsurfaceview; import android.support.v7.app.actionbaractivity; import android.os.bundle; public class opengles20activity extends actionbaractivity { private glsurfaceview mglview = null; @override protected void oncreate(bundle save...

javascript - Best way to upload several thousand files? -

so need able consistently have users uploading 3,000 4,000 images @ time. using dropzonejs, works fine around 1,000-2,000 images, higher , start have issues. images ~2mb in size, resized client side ~300kb, sent server. resizing server side not option, i'm not sure else can do. ideas? edit: okay seem have found may factoring in issue such high memory usage when adding large amount of files. issue seems caused few simple div statements using bootstrap classes. every 1000 photos added (before starting upload), causing increase of ~400mb in memory. here seems causing huge increases in memory usage: <div> <div class="col-xs-6"> <span class="name" data-dz-name></span> </div> <div class="col-xs-6"> <span class="size" data-dz-size></span> </div> </div> if remove bootstrap column classes divs, increase of ~3mb per 1000 photos added. going wrong boo...

c# - How to handle duplicate data or avoid clashes? -

we trying build resource booking system , user can make booking location or people in system. multiple users may make multiple bookings same resource same timing. for example, user a, b , c trying book location-a following timing. user => 17/03/2015 10:00 12:00 => 17/03/2015 14:00 15:00 => 18/03/2015 10:00 12:00 => 18/03/2015 14:00 15:00 user b => 17/03/2015 11:00 12:00 => 18/03/2015 10:00 12:00 user c => 17/03/2015 11:30 13:30 the system needs handle resource clashes avoid double booking same timing or overlap timing. 1 of user can take resource , rest booking must failed. question proper way handle it? should use transaction or table lock before insert data table? using visual studio 2008 , sql server 2008. thank advise , appreciate it. there @ least 2 business processes involved here. process one: show available seats. process two: book location. since these processes don't follow 1 im...

Simple Angular 2 project fails 'Unexpected reserved word' -

i trying create simple angular2 project based on ng2do project. using quickstart , have following code... <script src="js/quickstart/dist/es6-shim.js"></script> .... import {component, template, bootstrap, foreach} 'js/quickstart/angular2/angular2'; this gives me following error... uncaught syntaxerror: unexpected reserved word what missing? don't know if helps have been having issues day realised because starting code script reference <script src="app.js"> </script> instead of using <script> system.import('app'); </script> hope helps using in tsconfig { "version": "1.5.0-beta", "compileroptions": { "target": "es6", "module": "amd", "declaration": false, "noimplicitany": false, "removecomments": true, "nolib": fal...

javascript - disable input box on check box jquery NO onchange -

in project have check box basis if input box disable. when using click event achieve correctly when in database not behave correctly value expecting. example value 0 display disable false , disable false (default) when value 1 display disable true input not disabled here code suggestion appreciated on click event $('#flag').click(function() { console.log("sumenu change on click"); if ($(this).is(":checked")) { $('#url').prop('disabled', true); console.log("check disble true"); } else { $('#url').prop('disabled', false); console.log("nocheck disble false"); } }); code ajax success getting value , should turn off / turn on input on data load if (data[i].flag == "0") { console.log("value 0 no check disble false"); $('#flag').prop('checked', false); $('#url').prop('disable', false); } e...

python 2.7 - Convert generator (iterator) to django queryset -

i have django model property __iter__ returns generator (iterator), further want convert resulted iterator queryset, allows me further filtering on resulting queryset. car = car.objects.get(id=45) # __iter__ returns car objects cars = car.__iter__() cars.filter(name='abc') ? the above throw error, because cannot filter generator(iterator). also dont want convert generator(iterator) list of id's, can use in car.objects.filter() any ideas on how solve above problem. thanks as said, if __iter__ method returns generator, not possible perform further queryset methods on it. one option return ids , use id__in filter, you've said don't want that. another option additional filtering in python instead of sql. car = car.objects.get(id=45) # __iter__ returns car objects cars = car.__iter__() cars = [c c in cars in c.name='abc'] without knowing __iter__ does, can't offer other suggestions.

Getting two different hash key, While debugging the android program -

i using code keyhash. packageinfo info = getpackagemanager().getpackageinfo(getpackagename(), packagemanager.get_signatures); (signature signature : info.signatures) { messagedigest md = messagedigest.getinstance("sha1"); md.update(signature.tobytearray()); log.d("keyhash", base64.encodetostring(md.digest(), base64.default)); } when debug code then, select "base64.encodetostring(md.digest(), base64.default)" , press shift + ctrl + i, return keyhash. again press shift + ctrl + i, return different keyhash. log.d("keyhash", base64.encodetostring(md.digest(), base64.default)); please tell me, problem? you have change in method replace line - messagedigest md = messagedigest.getinstance("sha1"); on place of - messagedigest md = messagedigest.getinstance("sha"); it helps you.

sql server - DW Factless Fact Table w/ Transactional Free Form Fields -

i reconstructing factless fact table transaction table. there obvious shared dims org, status, service, serviceaction, send date, etc. however, there 2 issues i'm trying work through: on transaction table there free form entry fields values phone, email, chkbxrequestreceipt. directly related transactionkey. if pull these fields out of fact table own dim, creates 1-1 dim-fact relation not seem correct. the serviceaction dim 1 field on fact table broken out 3 different dim tables. done because services share no common fields. there 1 transaction every serviceaction. sum of rows in 3 service tables = total rows of transaction table. could offer advice on best way model this? you can consider phone, email, chkbxrequestreceipt degenerate dimension (or multiple degenerate dimensions). degenerate dimensions dimension without dimension table. have degenerate dimensions when fact table has transaction level grain. about 3 tables serviceaction . suggestion put the...

unix - awk script not working properly in SunOS (which worked well with Red Hat) -

i looking out file replacement functionality done in awk . had solution worked red hat linux flavour not working sunos 5.10. great if can troubleshoot issue. source file (src.txt) aaaa uid=xxxx pwd=nnnn u_no=12345 bbbb uid=yyyy pwd=eeee zzzz uid=yyyy pwd=eeee reference file (ref.txt) block,parameter,value aaaa,uid,1a1a aaaa,pwd,1b1b bbbb,uid,2a2a zzzz,pwd,9b9b zzzz,uid,9a9a bbbb,pwd,2b2b required output file (tgt.txt) the target file should updated source file based on lookup values reference file follows: aaaa uid=1a1a pwd=1b1b u_no=12345 bbbb uid=2a2a pwd=2b2b zzzz uid=9a9a pwd=9b9b code awk -f= ' fnr==nr { split($0,b,",") a[b[1] fs b[2]]=b[3] next} !/=/ { f=$1 print next} { print $1"="(a[f fs $1]?a[f fs $1]:$2)} ' ref.txt src.txt > tgt.txt the code solution given 1 of our friends here in stack overflow , worked pretty in red hat linux. when tried copy sunos 5.10, first showed syntax error at: !/=/ { i replaced fie...

mysql - How do I get required result using sql -

select `id`,`amount`,'creationtime' `table1` amount not null group `id`; following query give me result: with 2 columns,and data ordered in group. id | cash | creationtime 1 | 12 | 2015-10-30 07:59:11.000000 1 | 10 | 2014-10-07 08:55:27.000000 1 | 3 | 2012-10-05 06:35:48.000000 2 | 100 | 2015-10-30 07:59:11.000000 2 | 10 | 2014-10-07 08:55:27.000000 3 | 3 | 2012-10-05 06:35:48.000000 want 1 row result, depending on creation time of row. need row amount=3 creation time oldest. output want: id | cash | creationtime 1 | 3 | 2012-10-05 06:35:48.000000 2 | 10 | 2014-10-07 08:55:27.000000 3 | 3 | 2012-10-05 06:35:48.000000 i have column, "createtime" in table. please can me how can this? what result using: select id,amount,creationtime tabl...

javascript - What does paragraph about figuring out XUL elements mean in MDN document: "How to convert an overlay extension to restartless" -

recently friend of mine , have been working on firefox extension. handed code me today, , i've been trying make restartless. used tutorial how convert overlay extension restartless (on mdn) . since don't have experience working javascript , extensions in general, wondering if understand step number 6 means here in tutorial. saying can't use "no more xul overlays", , understand this. don't understand how part: figure out xul elements need create add-on add interface, needs go xul window, , how it. docs: document.getelementbyid() , document.createelement() , element reference , node reference (dom elements nodes). i decided against using document.loadoverlay, since it's buggy. i'm not sure if helps much, here code our overlay.xul. again, sorry if question basic, appreciated. if need provide more code please let me know. @ point thought code our overlay.xul file important. <?xml version="1.0" encoding="utf-8"?> ...

localhost - videowhisper live streaming php script with red 5 or wowza -

so tryed setup own rtmp server red5 , want use own local red5 rtmp address streaming website (like ustream videowhisper). users can stream , watch streams others on server on website , dont have buy expencive servers online. videowhisper needs rtmp adress. please can tell me how , im needing this. i installed red5 on localhost , server started , running. in videowhisper set rtmp rtmp://myipaddress connection failed. here settings.php <?php $rtmp_server = "rtmp://localhost:1935/videowhisper-live"; // rtmp://your-server-ip-or-domain/application $rtmp_amf = "amf3"; // amf3 : red5, wowza, fmis3, fmis3.5 // amf0 : fcs1.5, fms2 // blank flash default $rtmfp_server="rtmfp://stratus.adobe.com/f1533cc06e4de4b56399b10d- 1a624022ff71/"; // rtmfp server negotiangin p2p connections possible // own independent developer key/address from: https://www.adobe.com/cfusion/entitlement/index.cfm?e=stratus $tokenkey = "videowhisper"; /...

fwrite - My php quiz is not writing the user's grade to a separate file. I'm not sure if I'm doing this right -

i'm having issue getting php quiz write user's grade separate file. shows how many got right/wrong not write file. wrong code in here would prevent that, or missing something? constructive input helpful. <?php session_start(); #error_reporting(e_all); ini_set('display_errors', 1); require_once('connect.php'); require_once "lib.php"; require_once "utils.php"; $quiz_done = true; if(isset($_session['active'])) { $emailaddress = $_session['emailaddress']; $sql="select * users emailaddress='$emailaddress'"; if($results = mysqli_query($link, $sql)) { while($row = mysqli_fetch_array($results, mysqli_assoc)) { $userid = $row['userid']; $_session['userid'] = $userid; } } echo $userid; $sql1="select * quiz userid='$userid'"; $result1 = mysqli_query($link, $sql1); if($result1) { whi...