Posts

Showing posts from May, 2011

Any way to cause SQL Server to parse query in multiple lines so error reporting is more accurate? -

i might overlooking more robust error reporting, error reporting sql server gives me line number (which 1 line) non-syntactical errors. today client had ',' in price value, dealing 72 or fields took me quite awhile find given cannot cast float message. i thinking maybe force sql run code in multiple lines line number more useful bit of info. i tried line break, putting in new lines, , adding new line characters non of worked. does know way this, or have method tracking down these errors? i think try try_convert in fields not set varchar; mean can apply function dates, numbers, , other not character data. you can take @ example: http://msdn.microsoft.com/en-us/library/hh230993.aspx hope helps!

Does Pixate have any sort of callback mechanism for keyframe animations? -

curious whether or not subscribe event/notification @ end of keyframe animation. know? not @ time. found same question on github https://github.com/pixate/pixate-freestyle-ios/issues/86

Using Matlab from c# update variable issue -

in code shared below using matlab dll c# application.the values returned matlab object random variables expecting them change @ different calls. in matlab working normally( returning different values in each call) when click button again returning same values here , powerreclog() should return different value whenever click button again onum.lqia,onum.lqib,onum.lqic,onum.lqid not changing. private void button1_click(object sender, eventargs e) // yeni olcum { var acctx = type.gettypefromprogid("matlab.application.single"); var matlab = (mlapp.mlapp)activator.createinstance(acctx); matlab.visible = 0; matlab.putworkspacedata("pr", "base", 0); onum = new onlineolcum(); try { onum.xpos = convert.todouble(textbox1.text); onum.ypos = convert.todouble(textbox2.text); label1.text += " " + onum.xpos + "

ios - iTunes Connect: price change via script / automated price change -

after having done googling, know it's possible update app's metadata, i.e. name, what's new, via script. it's possible change/update price of in-app purchases , create in-app purchases via script. however, can app prices on itunes, through itunes connect account, changed/automated via script? is, being able change price tier , price effective date , , price end date app. itc.cli in beta, , aims achieve current task. not officially supported, , such wouldn't rely on critical updates.

java - Paint not showing up -

i using jframe , pane , trying draw simple square. painting not showing up. made set color black should visible. code: package w2; import java.awt.color; import java.awt.container; import java.awt.graphics; import javax.swing.*; public class w2 { jframe frame = new jframe("w2"); public w2(){ container pane = new container(); frame.setcontentpane(pane); frame.setsize(750,500); frame.setlocationrelativeto(null); frame.setresizable(false); frame.setvisible(true); } public void paint(graphics g){ g.setcolor(color.black); g.fillrect(50, 50, 50, 50); } public static void main(string args[]){ new w2(); } } the paint method won't called because it's not part of object can painted. see performing custom painting details how painting done in

android - How to share automatically on Facebook without showing the posting dialog? -

Image
i integrating facebook share functionality in app. , have implemented how share custom story using share dialog. every time share shows me preview dialog given below. what intend achieve when click on share button want post automatically on wall. have given "publish_actions" , "publish_stream" permissions in app scope.do need special permission ? i have seen functionally in candy crush. while using daily booster wheel after clicking on 'spread word' button doesn't pop share dialog automatically share custom story in user's wall , story looks below code using custom story share opengraphobject objproperty = opengraphobject.factory.createforpost("namespace:level"); objproperty.setproperty("title","title"); objproperty.setproperty("image","http://www.example.com/demo/image/wrong.jpg"); objproperty.setproperty("url", "http://www.example.com"); objproperty.set

c# - How Do I Import A Xades Signed Xml Document Into Another Xml Document? -

i trying import signed xml document xml document. when import document, , export no change, can no longer validate it. even code below breaks validation. openfiledialog ofd = new openfiledialog(); ofd.showdialog(); if (ofd.filename != "") { xmldocument xmldocument = new xmldocument(); xmldocument.load(ofd.filename); folderbrowserdialog fbd = new folderbrowserdialog(); fbd.showdialog(); if (fbd.selectedpath != "") { xmldocument.save(fbd.selectedpath + @"\doc.xml"); } } how can import/export xml document without breaking signature validation? my xml files are: envelope : dl.omerharmansa.com/envelope.xml invoice : dl.omerharmansa.com/invoice.xml invoice.xml document signed. want import invoice.xml envelope.xml. element of envelope.xml, invoice.xml going imported, shown. given following signed xml: <?xml version="1.0"?> <mysignedxmlroot xmlns:xsd="http://www.w3.org/2001/xmlsche

How to increase the height of remoteview in android notification -

i trying create notification custom remoteview.but when displaying notification,bottom of remoteview getting cropped.only half of remote view visible in notification.could 1 tell me increasing height of notification in android? set style of notification intent bigstyle, notification noti = new notification.builder(this).setstyle(new notification.bigtextstyle().bigtext(longtext))

mysql - python:type error while connection -

Image
this question exact duplicate of: connecting 2 tables python [closed] 2 answers got error on code if rows[0] in line: typeerror: 'in <string>' requires string left operand, not tuple my code: import mysqldb db = mysqldb.connect(host="localhost", # host, localhost user="root", # username passwd="mysql", # password db="sakila") # name of data base cursor = db.cursor() # execute sql select statement cursor.execute("select student myclass") rows=cursor.fetchall() open('qwer.txt','r') file: line in file: row in rows: if rows[0] in line: stmt="select english marks student = :student" cursor.execute(stmt,dict(student=row[0]))

algorithm - Why do admissable heuristics guarantee optimality? -

today in class, professor introduced admissable heuristics , , stated guarantee optimality a* algorithm . i asked him explain using extreme example make obvious, couldn't. can please help? we have list of candidates, right? and each of them has etc (expected total cost) reach goal starting node (i.e. cost reach node + expected remaining cost goal (the heuristic)). now if expected cost identical actual cost, we'll literally pick nodes on shortest path (well, of shortest paths), , nothing else. since pick lowest etc, should pretty obvious why pick nodes shortest path - not on shortest path have higher etc. what if etc less actual cost? pick lowest etc, may end picking nodes not on shortest path. can never reach goal through path that's not shortest path because: the shortest path has lower actual cost non-shortest path the etc @ goal same cost reach goal via path (since we're @ goal, expected remaining cost 0) the etc less or equal actual total

c++ - QT: Frameless window not animating -

Image
i need current project named "ribbonui". project name suggest, want implement ms ribbonui in office 2013 in qt - stuff working nice need know qt::framelesswindowhint . i have subclassed qmainwindow , added enum value qt::framelesswindowhint override default window decoration. buttons implemented fine - can minimize, maximize , close frameless window, window not animated when minimizing/maximizing/restore window taskbar. do have implement animation myself or can use window manager hint or else? here screenshot current work:

CoffeeScript working strangely with Rails 4 -

i cannot coffeescript working rails . first time i'm using coffeescript , i'm new rails too, don't know how make simple coffeescript function work in right way. below people.js.coffee file @ app/assets/javascript directory. myfunction = -> alert "test" the alert “test” message only shows when load page (app/views/people.html.erb , _form.html.erb partial); not when click below button in form: <%= submit_tag "test coffeescript", :type => 'button', :id => 'coffeescript', :onclick => 'myfunction()' %> i don't know why strange behaviour happening. why :onclick not working? generated source code button should ok: <input id="coffeescript" name="commit" onclick="myfunction()" type="button" value="test coffeescript" /> below application.js file @ app/assets/javascript . ... // //= require jquery //= require jquery_ujs //= require

web applications - When to use "client-side routing" or "server-side routing"? -

i'm little bit confused this, , feel stupid asking question, want understand it. so, i'm working client side web framework, backbone, angular or durandal. framework includes routing. but of course still have server database stuff, , on, has routing. my question is: when use "client-side routing" or "server-side routing"? how "decided" whether routing performed on client side or whether request first sent web server? i have particularly hard time imagining because client side routing before server ever gets know request. i'd thankful if explain how these 2 routing systems work together. p.s.: have not included code samples because i'm not looking answer concerning particular framework, concerning routing process in general. tl;dr: with server-side routing download entire new webpage whenever click on link, with client-side routing webapp downloads, processes , displays new data you. imagine user

ios - How can I pass the value of picker to select my Entity -

i learning core data creating expenses tracker app. have 2 entities , category , transaction. category can hold many transactions , model created correctly. i have picker selecting category addtransactionviewcontroller. use following code save transaction when save button pressed _savedtransaction.type = [_pickercategories objectatindex:[_picker selectedrowincomponent:0]]; _savedtransaction.timestamp = [nsdate date]; _savedtransaction.amount = transactionamount.text _savedtransaction.category = _transactioncategory; i sure doing stupid save because _savedtransaction.category is returning null when log it. other parameters log correctly, transaction saved... how can store transactioncategory value set picker? you have pass value of picker view category _savedtransaction.category = [_pickercategories objectatindex:[_picker selectedrowincomponent:0]];

c# - How to use Linq Query in Object Data Source? -

if have following query code : datatable loans =loans_hr.calcloans(2011, 7, 2013); var groupeddata = b in loans.asenumerable() group b b.field<int>("loan_code") & b.field<int>("emp_num") f select f.copytodatatable(); now want use groupeddata result in objectdatasource how ? try this: group b new {b.field<int>("loan_code"), b.field<int>("emp_num")} p.s. perhaps, must use aggregates.

google apps script - How to run GAS from Eclipse 4.3 -

i installed eclipse , google plugin according to https://developers.google.com/eclipse/ https://developers.google.com/eclipse/docs/getting_started https://developers.google.com/eclipse/docs/install-eclipse-4.3 i imported gas files google drive. show projects. but can't find how can run , publish application. can tell me how? seems maybe answer can obtained here: using execution api , on google app scripts guide website. although don't know needs done in eclipse connect google execution api. here's need on google drive side: (i call google app scripts editor: gsuite) for understanding many of following steps see google target project execution api quickstart page . in gsuite open project intend import. set security scopes want google, explained below: 2.1 in gsuite select file -> project properties: scopes tab. 2.2 in eclipse set scopes according 2.1 [to completed] set google project api executable: 3.1 publish: in gsuite in proje

php - Escaping while using PDO -

i love using pdo in php don't bind because there addition of codes etc.. cannot ignore sql injection , other security holes. i use php wrapper class php pdo wrapper class i heard escaping prevents sql injection (is correct)? i heard doing html special chars don't prevent sql injection? can way escape data post ? for example use insert in database using run statement (using php wrapper class) $firstname=$_post["first_name"]; , many more variables global $db; $db->run(sprintf("insert users (usergroup, useremail, username, usertoken, userfirstname, userlastname, userpassword, verified, signupdate, userip) values ('1', '%s', '%s', '%s', '%s', '%s', '%s', 'y', '%s', '%s')", $email, $username, md5(time()*rand(1, 9999)),$firstname, $lastname, $password, time(),$_server[remote_addr])); is above code vulnerable sql injection , there security holes you talki

database - Get SQL Server remote procedure result -

i have 2 sql server 2005, want pull data b. i execute code on b.: create table #res ( valueid int, [timestamp] varchar(32), realvalue float, quality int, flags int ); insert #res(valueid, [timestamp], [realvalue], [quality], [flags]) exec ('exec [cc_externalbrowsing].[dbo].[cc_sp_readtags] @list=''1;2;3;4;5'', @timebegin=''0000-00-00 00:05:00.000'', @timeend=''0000-00-00 00:00:00.000''') @ [winccteszt] select * #res; drop table #res exec part runs fine (without previous insert line). can see data in ssms, can't insert data temp table i error: the procedure 'sys.addlinkedserver' cannot executed within transaction. any ideas? thanks zui use table-valued variable instead of explicit temp table - table-creation cannot occur within transaction. try instead: declare @res table ( valueid int, [timestamp] varchar(32), realvalue float, quality int,

architecture - Can a single processor have varying frequencies for each core? -

i reading blog post company sells bitcoin mining hardware. specialty use of asic achieve highest possible (energy) efficiency. have few questions not related bitcoin mining. please answer! is possible/practical make processor consisting of several cores, each core has different frequency (or generally, different manufacturing processes 20nm, 14 nm etc, or different performance features)? can different cores of cisc, risc & asic grouped inside single processor? 1. first of related first question: difficult produce processors produced different production processes. processors (and chips in general) 'printed' on wafers, many processors on same wafer. not fabricated in parts , put afterwards. in general 1 manufacturing process used per processor. edit: "i have add however, processor consists of many layers (20 or more), layers can more critical others (detail more important), layers production process can used. still applied whole die (printed process

how to enable developer mode for extension in chrome? -

Image
this question not same how prevent users go in debug mode browser everytime open chrome, see following remainder tells me disable developer mode extension, anonying, how disable remainder?

Ajax on node.js and express -

hi trying file uploading(image) in node.js express.this far have done. my app.js var express = require('express'); //express web server var bodyparser = require('body-parser'); //connects bodyparsing middleware var formidable = require('formidable'); var path = require('path'); //used file path var fs =require('fs-extra'); //file system-needed renaming file etc var app = express(); app.use(express.static(path.join(__dirname, 'public'))); app.set('views', __dirname + '/views'); app.engine('html', require('ejs').renderfile); /* ========================================================== bodyparser() required allow express see uploaded files ============================================================ */ app.use(bodyparser({defer: true})); app.route('/').get(function(req,res) { console.log("server started!"); res.render('index.html'); res.end('d

c++ - enumerate child windows doesn't function, but enumWindows does...? -

heading i don't know why, when start enumerating windows, goes correctly, enumerating child windows not enter function... , moves around code... if put hwnd = 0 runs... have no idea why not hwnd find child windows. enter code here #include "stdafx.h" #include <windows.h> #include <iostream> using namespace std; hwnd h; int wpoc, chpoc; static bool callback enumwindowsproc(hwnd hprog, long lparam) { wpoc++; cout << wpoc << ": " << hprog << endl; if(wpoc == 5) h = hprog; if (wpoc > 20) return false; return true; } static bool callback enumchildproc(hwnd hprog, long lparam) { chpoc++; cout <<"ch "<< chpoc << endl; if (chpoc > 20) return false; return true; } void search() { wpoc = 0; bool procsuccess; procsuccess = enumwindows((wndenumproc)enumwindowsproc,null); } void searchmap() { chpoc = 0; bool procsuccess; procsuccess = enu

c++ - Random generator for guess game -

i've been searching better solution own , haven't been able find 1 understand or works me. i have made simple game computer randomly generates number guess number , if higher computer says higher , on.. the problem randomly generated number, after looking alot of information regarding <random> , uniform_int_distribution , default_random_engine . have found out computer generates random number, if run program again same random number generated . my solution: uniform_int_distribution<unsigned> u(0,100); // code randomly generate numbers between 0 , 100 default_random_engine e; // code randomly generate numbers size_t userinput; // user input find out in vector vector<int> randomnumbers; //vector hold random numbers unsigned start = 0, ending = 101, cnt = 0; // used in game not important right cout << "please enter number between 1 , 1000 randomness" << endl; cin >> userinput; for(size_t = 0; < 1000; ++i){ //for l

android - Eclipse won't start after upgrade; clean option not successful -

after trying upgrade eclipse components won't start. i needed upgrade android sdk, needed upgrade avd, needed upgrade of core eclipse components. after trying upgrade core eclipse components, eclipse won't start. after trying start -consolelog -clean -data, following output: !session 2014-06-01 15:02:24.722 ----------------------------------------------- eclipse.buildid=m20120208-0800 java.version=1.7.0_10 java.vendor=oracle corporation bootloader constants: os=win32, arch=x86_64, ws=win32, nl=en_us framework arguments: -data command-line arguments: -os win32 -ws win32 -arch x86_64 -consolelog -clean -da ta !entry org.eclipse.osgi 4 0 2014-06-01 15:02:25.073 !message -clean (osgi.clean) option not successful. unable clean storage area: c:\program files\eclipse\configuration\org.eclipse.osgi org.eclipse.m2e.logback.configuration: org.eclipse.m2e.logback.configuration bundle activated before state location initialized. retry aft er state location initialized. i&

Is method reference caching a good idea in Java 8? -

consider have code following: class foo { y func(x x) {...} void dosomethingwithafunc(function<x,y> f){...} void hotfunction(){ dosomethingwithafunc(this::func); } } suppose hotfunction called often. advisable cache this::func , maybe this: class foo { function<x,y> f = this::func; ... void hotfunction(){ dosomethingwithafunc(f); } } as far understanding of java method references goes, virtual machine creates object of anonymous class when method reference used. thus, caching reference create object once while first approach creates on each function call. correct? should method references appear @ hot positions in code cached or vm able optimize , make caching superfluous? there general best practice or highly vm-implemenation specific whether such caching of use? you have make distinction between frequent executions of same call-site , stateless lambda or state-full lambdas, , frequent uses of met

ruby on rails - This controller's create action works fine, but the almost identical update is just returning 204 regardless -

Image
def create if request.headers['auth'] == user.first.token @post = post.create(post_params) @post.save respond_with(@post) else error = { error: 'gotta authed create' } respond_with(error, :status => 401, location: nil) end end def update if false #request.headers['auth'] == user.first.token @post.update_attributes(post_params) respond_with(@post) else error = { error: 'gotta authed edit' } respond_with(error, :status => 401, location: nil) end end edit: apparently considered correct way handle put rails team (i have no idea why) can give me insight on how handle respond_with behaving consistently? see these issue/pullreqs better idea of how rails considers response correct https://github.com/rails/rails/issues/9862 https://github.com/rails/rails/pull/9887 okay, apparently need pass block respond_with if want customize - see https://stack

python - problems using regex expressions re.search and re.compile -

a stack overflow user has kindly shown me https://pythex.org/ allows build , test regular expressions. i have been able write expression when comes using in python re. module confused. what don't understand when use.compile, , when re.search --> if search text inside of brackets example , there more one, gather supposed use .group[x] x index of item want return example pattern = re.compile(r'view \((\d*)\)') number = pattern.search(data).group(2); as understand if had following, number_connections variable, when printed view (8) view (16) view (12) result print number 16 what don't is: when there more 1 occurance of text looking how loop on them, , how count of how many there are? for example: number.count() return, found 3 in number: (this doesn't work because match regular expression object???) print but happens when there 1 of text looking in regular expression? example regular expression: pattern = re.compile('

Liferay Structure Predefined Value -

which table in liferay stores predefined values given structure. also there facility in liferay populate these values dynamically using webservices? the api used journalstructureservice , however, documentation states, has been replaced dynamic data display api, which, example, can find under ddmstructureservice in version 6.2. this gives hint find underlying data, however, don't want manually write database. do want use api change values. trust me. consider database implementation detail , leave alone - if nothing else make next upgrade experience easier. should never change values in database manually without knowing exactly you're doing. and, trust me, keyword here "exactly", , you'll fail know all possible side effects. don't touch it.

sql - Creating a database table for storing filter criteria in MySQL -

i have problem. i've been banging head against wall 4 days now. know i'm missing something, i'm not sure is. i'm trying store set of filter criteria. user of site see page can select different criteria filtering users of site (say twitter). in page, there main criteria (which dropdown) : 1) tweeted @ (in case textfield appear next entering twitter handle) 2) had tweets more (in case number field appear next it) 3) tweeted between (in case 2 date fields 'from' , 'to' appear next it) so basic flow : 1) user chooses 'tweeted at' main criteria 2) text input box appears next 3) user enters 'coldplay' 4) list of twitter users have tweeted @ coldplay returned phew! ok, problem. i'm not sure how store filter criteria in table (say named filters). i tried following : single table = col 1 - filter_id, col 2 - filter name, col 3 - tweeted_at (charfield), col 4 - no:of tweets (int field 'had tweets more than' option), co

c++ - integer constant is too large for ‘long’ type when searching for large primes -

i trying find prime numbers between 1,000,000,000,000 , 1,000,000,100,000. code ok if number of digits 4 8, if digits more or equal 12 getting: warning: integer constant large ‘long’ type floating point exception #include <iostream> #define num 1000000100000 using namespace std; int main() { bool prime; long double sum = 0; (long long int i=1000000000000; i<=num; i++) { prime = true; for(int j=2; j<=i/2; j++) { if(i%j == 0) prime = false; } if(prime) sum+=i; } cout<<sum<<endl; } it seems want add prime numbers in range mentioned you. suggest segmented sieve purpose. or can plain sieving. take array of size 100001 store whether 100000000000 + i prime or not. (better if can 100001 / 2 bits) store odd number 100000000001 + 2 * i , sieve out odd multiples in range 3 1000001 , add remaining numbers. but still if want stick method, make few suggestion make run in practical time. #include <iostr

java - "The following artifacts could not be resolved" : Maven / Android / Eclipse -

i trying run android application in eclipse using maven . dependencies unfortunately stopping run (could not found or resolved). have checked have dependencies in repository. suggestion welcome. thank time , consideration. pom.xml : <dependency> <groupid>android</groupid> <artifactid>android</artifactid> <version>4.4.2_r2</version> <scope>provided</scope> </dependency> <dependency> <groupid>android.support</groupid> <artifactid>compatibility-v4</artifactid> <version>19.0.1</version> </dependency> console's error message: the following artifacts not resolved: android:android:jar:4.4.2_r2, android.support:compatibility-v4:jar:19.0.1: failure find android:android:jar:4.4.2_r2 in http://repo.maven.apache.org/maven2 cached in local repository, resolution not reattempted until update interval of

Powershell Converting .csv format (Import-csv) to string -

i trying write powershell script read in csv file loop on each row in csv file. within each loop want pass csv header , row values script, both in system.string type format. in particular, struggling conversion string type format- best way this. many thanks. script 1: $csvpath = 'c:\temp\scripts\trial_csv.csv' #get header $header = get-content $csvpath -totalcount 1 $intermediateoutput = "'c:\temp\scripts\output'" $scriptpath = 'c:\temp\scripts\temp.ps1' #get data get-content $csvpath | select -skip 1 | foreach-object { $argumentlist = @() $argumentlist += ("-header", $header) $argumentlist += ("-row", $row) $argumentlist += ("-intermediateoutput", $intermediateoutput) $argumentlist += ("-index", $i ) invoke-expression "& `"$scriptpath`" $argumentlist" } script 2: receive inputs script 1: param( [parameter(mandatory=$true)] [string]

javascript - Kinetic js 5.1 globalCompositeOperation how to -

i'm new kinetic js. im trying .globalcompositeoperation work in 2 parts of project have, have tried several solutions can find here, using 'drawfunc', , 'scenefunc', etc... far no luck. one part of project im trying 'destination-out' work on kinetic.sprite: var strokessprite = new kinetic.sprite({ image: e, animation: 'intro', animations: { 'intro': config.spritestrokes.frames }, framerate: 7, frameindex: 0, scenefunc: function (ctx) { ctx.save(); ctx.globalcompositeoperation = 'destination-out'; ctx.restore(); } var strokes = new kinetic.layer({ width: 1280, height: 1280,

java - Spring Integration get FTP files recursively with outbound-gateway -

i'm trying files within directory structure of 3 levels deep. example: - image a.jpg exists in folder /images/12/34/ - image b.jpg exists in folder /images/56/78 i've tried outbound-gateway stated in : https://github.com/spring-projects/spring-integration-samples/blob/master/basic/ftp/src/test/resources/meta-inf/spring/integration/ftpoutboundgatewaysample-context.xml and http://forum.spring.io/forum/spring-projects/integration/104612-inbound-ftp-polling-sub-directories?p=604430#post604430 my configuration : <bean id="ftpsessionfactory" class="org.springframework.integration.ftp.session.defaultftpsessionfactory"> <property name="host" value="127.0.0.1"/> <property name="port" value="21"/> <property name="username" value="administrator"/> <property name="password" value="sgtspeedy1"/> <property name=&q

php - Symfony2 re-usable snippet functions -

i using symfony2 lately , keep wondering when should create service , when should create class. for example have little snippet function reusable piece of code. because of not want piece of code in controller. meaning want use anywhere in bundle. it's simple, generates full url me based on slug/path. please note else example customstringgenerator() or ever. the snippet: public function generateurlfrompath(request $request, $path) { return $request->getscheme() . '://' . $request->gethttphost() . $request->getbasepath() . $path; } now make sort of toolkit or urlhelper class , define service can inject request object, seems overdone me create service such simple method. what suggest in case? guys when have created reusable functions? thanks far. for reusability, use: services (when need inject other dependencies through constructor), don't have manually everytime. helper controller, controllers extend. classes public static fun

debugging - Is it possible to display local variables tool tips text without hovering in Visual Studio? -

is possible enable visual studio display local, available, variables tool tips text without hovering? convenient. (i know see them can see locals window) you should able "pin" them clicking thumbtack in corner of value. remain displayed. steps: set breakpoint , hover on value, should see thumbtack @ right end. click thumbtack pin value.

c - WinAPI - Synchronizing SwapBuffers -

is possible synchronize swapbuffers in many threads? when try turn on vertical synchronization (wglswapintervalext), stops threads, until doesn't tick (ex. when open 3 windows, every window has approximately 20 frames [60/3] ) every window has separate thread, , of course every thread has own swapbuffer function. swap control per-window in wgl (when set it, applied window current render context tied to). association between render context , window tied device context (see wglmakecurrent (...) ). need vsync 1 of 3 windows if reliably hitting < ~5.6 ms frame time in each. what should consider here having 1 of contexts set swap interval 1 , remaining 2 use 0 . context syncrhonized vblank (swap interval = 1 ) lead other 2 threads. say, have other 2 threads call glflush (...) , busy wait until first thread stops blocking vsync before calling swapbuffers (...) . reason glflush (...) other 2 threads accomplish useful rendering tasks while wait first (synchronized

javascript - Incorporate AngularJS in an HTML File? -

first off: main goal of trying do, have 1 html file. no separate javascript files. i know can put javascript inline html. wondering if can put angularjs inline html. every time try, doesn't work want to. not sure possible. maybe there missing. if there is, please tell me. right now, in controller ng-app array. task, need loop through each element in array. array string, integer, integer, , array inside. of now, way know through angularjs. if there way without angularjs, please tell me. this javascript code. html file loops through each value in array using ng-repeat. function controller($scope) { $scope.items = [ {name: 'xxx', max: 3, peak: 4, users: [{name: "name", ip: "127.0.0.1", date: "2014-05-19 06:45:28"}]} ]; } any or workarounds appreciated. regards. if want angularjs app inside html file, put have in js file inside <script type="text/javascript"></script> . , put @ end of

jquery - Click event for collaps and expand in D3 is not working -

i working on project in have show alot of information show in form of tree. have chosen d3.js awesome library purpose. facing problem , not resolve it. have observed many questions on stackoverflow here , here alse i have following javascript code var url = "/home/showtree?q="+query; var treedt = []; $('#result').show(); $.get(url, null, function (data) { $.each(data, function (index, value) { var d = { "name": "", "parent": "" } d.name = value.name; d.parent = value.parent; treedt.push(d); }); $('#result').empty(); process(); }); function process() { var datamap = treedt.reduce(function (map, node) { map[node.name] = node; return map; }, {}); var treedata = []; treedt.foreach(function (node) { // add parent var parent = datamap[nod

java - Update private ListFragment from parent activity -

i have fragmentactivity creates listfragment . inside listfragment custom adapter. when try make adapter public, wouldn't let me. so, don't have access adapter or i'm not sure how it. add data listview statically public arraylist of objects declare in lifecycle. however, other data want retrieve asynctask database. data in parent activity , know right when finished fetching data. so, can update listview within listfragment access arraylist , not access adapter? if so, can activity or need somehow call method in listfragment ? if need call method in listfragment , how access method activity? if not possible without access adapter, how access adapter without public keyword? better move asyctask listfragmen t? i know sounds lot, i'm wondering how refresh listview cicumstances. appreciated. call method: listfragment fragment = (listfragment) getsupportfragmentmanager().findfragmentbytag("fragtag"); fragment.updatedata(); method

gradle: how to generate a bundle file with dependency=version in it -

in gradle generate "bundle" file - 1 external dependencies , internal modules, like log4j=1.2 my.company.api=1.3 so presume need override build task, access dependencies of root project , iterate on them? best/most elegant way solve it? thanks. you can gradle-dependency-lock-plugin ( https://github.com/nebula-plugins/gradle-dependency-lock-plugin ), generate bundle file (and use lock down dynamic dependencies)

Affects of changing email address of an Amazon account on AWS -

my client wants me change email address using amazon account , aws. using s3 server , ec2 instance static ip. i tried @ documents couldn't find exact answer. logically shouldn't affect want sure. if change email address of following changed? -aws access key id -secret access key -x509 certificates -.pem file connect ec2 server. none of api credentials impacted. can change email address associated aws account no impact on running services.

templates - c++ - other way of implementing function calls in switch cases -

i've got code below: void cashflow::execute (int cmd) { switch(cmd): { case buy: buyproc (); break; case sell: sellproc (); break; ...... } } what i'm thinking of doing maybe create map std::map <int, void (cashflow::*)()> cashflowprocs; then maybe use mcashflowprocs = boost::assign::map_list_of (buy, &cashflow::buyproc)(...etc)(..etc.); then can call (this->(mcashflowprocs [cmd]))() ; how turn template can reused? there issues implementation? note not using c++11 could there issues implementation? yes, hard maintain, adding/removing command need lot of maintenance, error prone, , difficult test. suggest design change before trying improve particular code. 1 - if can change design: use class represent command class command { public: virtual void execute() = 0; virtual ~command() {};; }; class buycommand : public command {

Get error details when using Rf_initEmbeddedR to embed R within a C++ application -

so using setup_rmainloop() initializing r environment embedded within c++ project had problems saving images device , changed code use rf_initembeddedr(0, null) , worked fine but problem whenever error running statement , don't error details. for ex , following r script x<- 2 abc() used return following error if used setup_rmainloop() : error: not find function "abc" but rf_initembeddedr(0, null) , don't error details. any ideas how can error details ?

django - Class based views: get_context_data method -

i know it's purpose is, , know how use it. i'm curious, code doing , why written way i? i'm referring this: def get_context_data(self, **kwargs): context = super(createlisting, self).get_context_data(**kwargs) context['action'] = reverse('create-listing') return context so i'm creating dict called context django base controller class manipulating on end? or off? super part throws me off because i'm not sure relevant information i'm getting it. the super call getting context whatever createlisting s super class is. it's can subclass view , add more context in each of subclasses - in instance you're adding action context.

Getting data from gridview in asp.net -

i want use gridview in asp.net , when click button rows in gridview save in array , can use them 1 one. please tell me solution or suggest me book or link or ... thanks here suppose button not in grid. on click event of button can write following code string[] str = new string[gv.rows.count]; (int = 0; < gv.rows.count; i++) { str[i]= gv.rows[i].cells[0].text.tostring(); } and can have values of gridview cell against each row. now it's how use array further. thanks

swift - How to enumerate an enum with String type? -

enum suit: string { case spades = "♠" case hearts = "♥" case diamonds = "♦" case clubs = "♣" } for example, how can like: for suit in suit { // suit print(suit.rawvalue) } resulting example: ♠ ♥ ♦ ♣ i made utility function iterateenum() iterating cases arbitrary enum types. here example usage: enum suit:string { case spades = "♠" case hearts = "♥" case diamonds = "♦" case clubs = "♣" } f in iterateenum(suit) { println(f.rawvalue) } outputs: ♠ ♥ ♦ ♣ but, only debug or test purpose: relies on several undocumented current(swift1.1) compiler behaviors. so, use @ own risk :) here code: func iterateenum<t: hashable>(_: t.type) -> generatorof<t> { var cast: (int -> t)! switch sizeof(t) { case 0: return generatorof(generatorofone(unsafebitcast((), t.self))) case 1: cast = { unsafebitcast(uint8(trunca

networking - How to make android app work in offline mode -

i want know how can make app work in offline when user lost network connectivity. i need post data server using json post method when user not connected wifi or mobile data. i using following code detect network state using broadcast receiver , don't know how proceed after this. please assist me proceed further. public class updatereceiver extends broadcastreceiver { @override public void onreceive(context context, intent intent) { connectivitymanager connectivitymanager = (connectivitymanager) context .getsystemservice(context.connectivity_service); networkinfo activenetinfo = connectivitymanager .getnetworkinfo(connectivitymanager.type_wifi); boolean isconnected = activenetinfo != null && activenetinfo.isconnectedorconnecting(); if (isconnected) { log.e("net", "connected" + isconnected); } else { log.e("net",

testing - Is it possible to compile a Go program with specific flags for coverage analysis? -

is possible compile go program specific flags coverage analysis? the use case: compile app; run functional automated tests; analyse coverage; should similar gcov or python coverage . many thanks! yes, go has cover tool (as of version 1.2) incorporated test process. go test alone compile program , run automated tests may have. adding -cover flag provide statistics on test coverage. to run it: go test -cover you can output coverage profile: go test -coverprofile=coverage.out and view with: go tool cover -func=coverage.out or go tool cover -html=coverage.out for html formatted output (with colour coding). see http://blog.golang.org/cover , go tool cover -h , go testflag more info.

javascript - Call function from child frame running program -

bear me. take little explaining. i have main page divided 3 <divs> top <div> has hyperlink in it. 1 of other <divs> (called "menu_div") has <object> in loads perl script. default, hidden when hyperlink clicked within "header_div", makes "menu_div" visible via "parent.document.getlementbyid('menu_div).style.visibility='visible'" @ same time, sets "show_hide" flag 1 if user clicks on hyperlink again, checks status of "show_hide", , if set 1, hides <div> , sets flag 0. ** in effect, each time user clicks hyperlink, box toggles on , off with box open, , running script, goes till final part. can hide box again using visibility statement above. however, <header_div> containing hyperlink still set "show_hide flag @ "1", (to popup window open) ** - once menu.pl script has closed window, if hyperlink clicked again, nothing happens (as it's resetting &quo

mySQL set a varchar without the special characters -

i use mysql dbms, have these rows in table: product_name | product_code | prod_type prod1@00x | 1 | @prod2@00x | 2 | +prod3@@00x | 3 | i wanna set prod_type = product_name without special characters. => prod_type prod100x prod200x prod300x (i can have other special characters not '@' , '+') how can that? method 1: you can use replace() method remove special characters in mysql, don't know if it's efficient though. should work. like below: select replace(replace(product_name,'@',''),'+','') prod_type table1 fiddle demo method 2: if have other special charcter go ( source ) -- ---------------------------- -- function structure `udf_cleanstring` -- ---------------------------- drop function if exists `udf_cleanstring`; delimiter ;; create function `udf_cleanstring`(`in_str` varchar(4096)) returns varchar(4096) charset utf8 begin