Posts

Showing posts from May, 2012

c# - Access Printer Status using Winspool -

hello i've used example on how access printer status using winspool. //code written mark middlemist - @delradie //made available @ http://delradiesdev.blogspot.com //interop details http://pinvoke.net/ using system; using system.runtime.interopservices; namespace delradiesdev.printerstatus { public class winspoolprinterinfo { [dllimport("winspool.drv", charset = charset.auto, setlasterror = true)] public static extern int openprinter(string pprintername, out intptr phprinter, ref printer_defaults pdefault); [dllimport("winspool.drv", setlasterror = true, charset = charset.auto)] public static extern bool getprinter(intptr hprinter, int32 dwlevel, intptr pprinter, int32 dwbuf, out int32 dwneeded); [dllimport("winspool.drv", setlasterror = true)] public static extern int closeprinter(intptr hprinter); [structlayout(layoutkind.sequential)] public struct printer_defaults { public intptr pdatatype;

C: How to read a jpg from a file and save it? -

i having trouble reading jpg file , saving it. want implement file sharing system between client , server , unable read jpg , save on same process. here have far int main(int argc, const char * argv[]) { char *buffer; file *picture; file *newpicture; struct stat st; long filesize = 0; picture = fopen("path/root/game-of-thrones-poster.jpg", "rb"); fstat(picture, &st); filesize = st.st_size; if(filesize > 0) { buffer = malloc(filesize); if(read(picture, buffer, filesize) < 0) { printf("error reading file"); } fclose(picture); newpicture = fopen("path/root/new.jpg", "wb"); write(newpicture, buffer, filesize); } free(buffer); } when tries read file, tells me filesize 0. fstat() identical stat(), except file stat-ed specified file descriptor fd. you passing file * , fstat expects int

REST RQL Java Implementation -

is there java implementation of "rql" (resource query language), there implementation of "fiql" (feed item query language) here part of cxf, questions : can use fiql engine of cxf implementation separably using cxf, in case i'm using spring mvc is there implementation of rql rql vs fiql r-sql parser partial implementation of fiql: https://github.com/jirutka/rsql-parser https://github.com/jirutka/rsql-hibernate

How can i give a where condition before update_batch in codeigniter? -

i want update table input same input fields names array , has add more function generates input fields this: i want update_batch in codeigniter model created function this: code block: function update_batch_all($tblname,$data=array(),$userid) { $this->db->trans_start(); $this->db->where('userid',$userid); $this->db->update_batch($tblname,$data); $this->db->trans_complete(); return true; } it not working. can 1 me how can update tables data update batch has condition? you can read docs update_batch() here here's short summary: you pass in associative array has both, key, , update value. third parameter update_batch() call, specify key in assoc array should used clause. for example: $data = array( array( 'user_id' => 1, 'name' => 'foo' ), array( 'user_id' => 2, 'name' => 'bar' ) ); $this->db

c - Free() segfault on PIC24 -

i have 2 16-bit pointers being allocated @ runtime, in order save long doubles flash (using microchip dee flash emulation library). code works fine, , recalls saved values correctly, if use free() on malloc()'d pointers, code segfaults @ next malloc() call (in function, in section of code). void readmiccaldata(microphone* pmicread) { /* allocate space 2*16-bit pointers */ int16_t* tempflashbuffer = (int16_t*)malloc(sizeof(int16_t)); int16_t* tempflashbuffer2 = (int16_t*)malloc(sizeof(int16_t)); if ((tempflashbuffer == null) || (tempflashbuffer2 == null)) { debugmessage("\n\rheap> failed allocate memory flash buffer!\n\r",1); } /* increment through 2-byte blocks */ wc1 = rcm_mic_cal_start_address; while(wc1 < rcm_mic_cal_end_address) { /* init pointer lowest 16-bits of 32-bit value e.g. 0x0d90 */ tempflashbuffer = (int16_t*) &pmicread->factor_db[i4]; /* save pointer , increment next 16-bit address e.g. 0x0d92 */ tempflashbuffer2 =

How to create release key for android v2 maps -

Image
i tried below code debug key , working fine. when make apk map crashing. after searching in google found debug key work in release mode. keytool -list -v -keystore "c:\users\your_user_name\.android\debug.keystore" -alias androiddebugkey -storepass android -keypass android so,how can create release key v2 maps. please me. i didn't had chance of doing that, understanding should done is: 1. first of need export project signed application : right click project -> android tools -> export signed application package... this take through wizard have create new release.keystore password or use existing 1 created before. 2. point on process should identical 1 use debug.keystore . 3. steps of creating debug api key , registering in google api console described @ blog post wrote: google maps api v2 key 4. remember using debug.keystore not give desired result.

android - Lost Keystore password -

i want update application playstore , lost keystore password.now trying create new 1 . there problem if build apk keystore password ? well, not first lose keystore password.. i use 1 bruteforce when got stuck: android keystore recover you can go few guesses. and @stinepike mentioned.. cannot continue updating existing applications

DMQL-Data Mining Query Language -

i'm trying references dmql google keep viewing same results no matter do. 1 have references dmql , it's history , syntax ? this bit of wild guess there workshop in ecml languages data mining , machine learning. if follow committee members, of them have references dmql... sorry not more helpful.

java - recommended way of programming in my case? -

so want develop fun/cool game or something, knowledge have pretty decent java / android, still call self beginner, aquired knowledge 200 'newboston' videos , other material internet, html5/js on same level java/android, , feel dont know how progress here or way go , tools use, want sit down , start working on something, please recommend/help me decide right/easy/simple way go knowledge have, or atleast point me in direction can learn more. i have found tool called 'appmobi xdk', consider developing it.. , wanted hear other more advanaced programmers opinions, maybe 'xdk tool' wrong way go, please me decide , find way jump forward programming carear/skills. i feel lost , confused these tools , options around, phonegap, appmobi xdk, eclipse, html/js, unity3d... it depends on you're trying do. if want make game, kind of game going be? after make decision, need choose engine. real thing sit , start doing it. can appmobi xdk wrong way start in c

Rails: view based on a different model-controller -

i using 2 different models&controllers - products , checkout , want checkout ordered product number. (meaning checkout product number 5, checkout product number 7 etc.) how go this? should use view under products connect checkout controller , model? how can that? need configure , where? routes? other? alternatively, should use checkout view, somehow make sure id/numbering of view based on products ? how can that? need configure , where? routes? other? for rendering checkouts dependent on associated product can following: routes.rb resources :checkouts checkout_controller.rb def index @checkouts = checkout.order("product_id asc") end app/views/checkouts/index.html.erb <% @checkouts.each |c| %> <%= c.inspect %> <% end %>

New to javascript & jquery. Am I not closing something correctly? Dreamweaver only says "Syntax Error" -

<script> $(document).ready(function () { // code bring each link on screen , in position $("#link1").animate({ left: '30px', top: '5px' }, 1000); $("#link2").animate({ left: '80px', top: '5px' }, 1400); $("#link3").animate({ left: '130px', top: '5px' }, 1400); $("#link4").animate({ left: '180px', top: '5px' }, 1600); $("#link5").animate({ left: '230px', top: '5px' }, 1800); // fade in & out on hover $("#link1").hover(function () { $(this).fadeout(150); $(this).fadein(150); }); // fade in & out on hover $("#link2").hover(function () { $(

Utilize Azure Graph API for SharePoint Online User management -

let's have sharepoint online subscription, hence can manage own * .onmicrosoft.com domain , users/groups connected it. as far understand, storage behind spo users , groups reside azure ad. i had thought way manage these users/groups remotely using powershell module microsoft online. , wounder whether azure graph api can used purposes of retrieving users , group members spo? have no azure subscription, there way utilize azure graph api without azure subscription, having spo subscription? ok, turns out possible. briefly steps following: create service principal serve 'contact point' external application ( here start point); i've used symmetric key authorization; add newly created service principal 'company administrator' role; look @ azurecoder's article , check out comprehensive example of using graph api: https://github.com/azurecoder/azure-activedirectory ; code correctly deals authentication parameters, constructing proper service r

database - Oracle ORA-01422: exact fetch returns more than requested number of rows -

i trying create member function returns member names of expired members. select query works outside of member function , member function compiles no problems when call function error: ora-01422: exact fetch returns more requested number of rows i assume simple have not been using oracle long got bit stuck syntax. can this? since query can return more 1 row need use cursor , cursor-for loop iterate on results. cannot return more 1 member name using varchar; use pl-sql table.

android - Updating fragments/views in viewpager with fragmentStatePagerAdapter -

need problem of updating pages while using viewpager. using simple viewpager fragmentstatepageradapter. want access current fragment/view can update textviews in fragment/view. searched around in forum , came know few things - 1 of ways handle setting tag in instantiateitem() call of adapter , retreive view findviewbytag. not understand how implement , not sure if work fragmentstatepageradapter. - explored other options suggested in various forums, cannot make them work. my code same in android http://developer.android.com/training/animation/screen-slide.html . basic components same (fragment activity xml display components including textview, viewpager xml view pager in it, fragment class , main fragmentactivity class). in fragmentactivity class have added pagechangelistener viewpager can textview changes during onpageselected(). any is appreciated. adding code reference. public class myactivity extends fragmentactivity //variable declarations protected void oncreate(b

javascript - How to determine what cell has been clicked? -

i new javascript , having use extjs 3.4. have created simple tree 3 columns. know either cell selected, or even, row , column selected. i using example sencha uses @ http://dev.sencha.com/deploy/ext-3.4.0/examples/treegrid/treegrid.html : var tree = new ext.ux.tree.treegrid({ title: 'core team projects', width: 500, height: 300, renderto: ext.getbody(), enabledd: true, columns:[{ header: 'task', dataindex: 'task', width: 230 },{ header: 'duration', width: 100, dataindex: 'duration', align: 'center', sorttype: 'asfloat', tpl: new ext.xtemplate('{duration:this.formathours}', { formathours: function(v) { if(v < 1) { return math.round(v * 60) + ' mins'; } else if (math.floor(v) !== v) { var min = v - math.floor(v);

hibernate - Is "flush" of session must called in this case? -

i defined "booking" entity "part" entity ,their relationship 1 many.now in case had such operation step 1:retrieve 1 booking fk,assume under booking,it has 3 part,then show in ui step 2:in ui,i add 1 new part,then mark original 3 saved part deleted part,finally save booking again. now in back-end,i handle saving logic following first,my booking action's save function following public string save() throws exception{ booking = presave(booking); booking = dosave(booking); booking = postsave(booking); return success; } the dosave function following @transactional(propagation=propagation.required,isolation=isolation.default) private booking dosave(booking booking) throws exception{ logger.debug("save booking start,will delete deleted/update/save record in db"); //step 1:get booking dao spring context bookingdao dao = (bookingdao) dao

scala - How to configure my SBT to use a plugin with a specified plugin? -

i want use lifty plugin, failed download in sbt. c:\users\freewind>sbt sbt-version [info] 0.12.3 > console welcome scala version 2.9.2 (java hotspot(tm) 64-bit server vm, java 1.7.0_04). i followed document of lifty, insert code project/plugins.sbt : resolvers += resolver.url("sbt-plugin-releases", new url("http://scalasbt.artifactoryonline.com/scalasbt/sbt-plugin-releases/"))(resolver.ivystylepatterns) addsbtplugin("org.lifty" % "lifty" % "1.7.4") and build.sbt : seq( lifty.liftysettings : _*) it reports warnings when run sbt : [warn] module not found: org.lifty#lifty;1.7.4 [warn] ==== typesafe-ivy-releases: tried [warn] http://repo.typesafe.com/typesafe/ivy-releases/org.lifty/lifty/scala_2.9.2/sbt_0.12/1.7.4/ivys/ivy.xml [warn] ==== sbt-plugin-releases: tried [warn] http://scalasbt.artifactoryonline.com/scalasbt/sbt-plugin-releases/org.lifty/lifty/scala_2.9.2/sbt_0.12/1.7.4/ivys/ivy.xml [warn] ====

iphone - Import data files into iOS application -

Image
i tap on attachment in email , able import dxf file ( xyz.dxf ) application somehow being copied rar file ( xyz.rar ) in inbox folder. can 1 explain reason behind this? tried on google couldn't find information. hope has experienced format related problem while importing files, me. in advance pointers. i editing question providing more information below: drawing interchange file document type: please refer attached picture indicates item 0 (drawing interchange file) 1 showing problem. if declare " document content type utis\item 0 = public.data " copies file in "document\inbox" folder types changes rar no change in file contents. if leave public.text type in plist , doesn't import file application @ all. if only leave " com.autodesk.dxf " in "document content type utis" item 0, doesn't import. typical type: custom type file used testing, working without problem, no extension problem etc.

java - Is alarmmanager ALWAYS cleared after reboot? -

simple question: alarmmanager always cleared after reboot? cleared after reboot on devices , when user boots device shortly after booted off? i need know because recreate app's alarm in onbootreceiver , want avoid having double alarms set. is alarmmanager cleared after reboot? definitely on full reboot. there devices have "quickboot" (htc comes mind), , have not run experiments see behavior there. and when user boots device shortly after booted off? yes. i need know because recreate app's alarm in onbootreceiver , want avoid having double alarms set. alarms in hashmap keyed pendingintent . setting alarm using equivalent pendingintent should replace prior alarm. "equivalent", mean: same operation (activity, service, broadcast) same request code equivalent intent (matches via filterequals() , pretty means matches on except extras) and i'd nervous using flag_cancel_current when defining new pendingintent

asp.net - how to open file by name in VS2012 express -

in visual web developer express 2010 pressing ctrl+o , entering >of index shows file list , allows select , open proper file. how same thing in visual studio express 2012 ? i tried ctrl+q , typed of index tried index in both cases "no search result available" message appears.

windows 8 - What is the connection string for a SQL Server 2012 default instance? -

i have installed windows 8 , vs 2012, want connect sql server 2012 default instance, can't figure out connection string it. i have tried: .\sqlexpress .\sqlexpress,1433 and same connections pcname instead of . first using ssms ? or trying connect using vs 2012 ? second connecting default instance of express edition or non-express edition ? (if using express edition please modify question header , question reflect that) express edition have default name sqlexpress , non-express edition has default name mssqlserver if need know instance of sql server trying connect, can found looking @ sql server configuration manager (sscm). make sure sql server service running. if instance name correct, @ sql native client configuration -> client protocol in sscm , check if tcp/ip enabled or not. if enabled check if firewall blocking connection or not. as side note, if using default port don't have explicitly define port when trying make connection.

java - Any Drools example for update listener -

with reference drools java update i found updatelisteners exists can used fire rules when facts(objects) updated via java code, couldn't find example it please find/share helpful example this thanks chakri did check documentation? check 4.7.2.1.6. @propertychangesupport section http://docs.jboss.org/drools/release/6.0.0.beta2/drools-expert-docs/html_single/index.html#d0e4780

javascript - JS only updates one element with same ID on onclick response -

this simple problem, i'm not familiar js. i'm using wordpress comment rating plugin display 2 loops of comments - 1 sorted "thumbs" rating , , second standard order. the problem: when thumb clicked next comment in standard section vote added comment in rating section - since it's called first in code on site. standard section rating box not being updated until page refresh. what expected: when vote clicked, rating same comment should updated in both rating , standard loops sectons. code: function ckratingcreatexmlhttprequest(){ var xmlhttp = null; try { // moz supports xmlhttprequest. ie uses activex. // browser detction bad. object detection works browser xmlhttp = window.xmlhttprequest ? new xmlhttprequest() : new activexobject("microsoft.xmlhttp"); } catch (e) { // browser doesn’t support ajax. handle want //document.getelementbyid("errormsg").innerhtml = "your browser doesnt support xmlhttprequest.

axis2 - java.lang.AbstractMethodError for deployed aar on WSO2 Application Server -

after invoking operation "try it" using wso2 application server, admin area. error. have created wsdl file using eclipse , generate server side code using axis2 code generator, archive using axis2 archiver , deployed in application server. can attribute problem difference of axis2 versions on wso2 , eclipse plugin? we had faced similar issue before on tomcat deployment. issue due conflict of jars in tomcat , our webapp. had few jars creating issues loading of tomcat jars(jasper-compiler, jasper-runtime etc). once removed them, our application started working properly.

Asp.net with C# and Mono on Debian - Nginx / g-wan -

i'm developing web application in c# , asp.net. acutally i'm looking using efficient , performant running system. well question ist now: option: asp.net & c# & mono & debian & nginx option: asp.net & c# & mono & debian & g-wan option: asp.net & c# & windows server & iis which 1 select , why? the application showing stuff. there nothing download. many help.

svn - Subversion Edge Console -

my collabnet subversion edge console interface doesn't appear formatted anymore (it used in past). looks may have lost path css files. have tried multiple browsers, showing same results. has else experienced or know trick things on track? it hosted on top of apache , uses http if matters. i able fix (and improved interface) upgrade installation subversion edge 3.3.1.

php - Inserting data into first empty column cell without creating a new row -

i want add data table, 1 column @ time. therefore don't want add new row, column i'm adding may not have data in compared other columns. result suppose want add data first empty cell in specified column without adding new row whole table (as there may enough rows). my table has 5 columns. i'm using: $sql=("insert [my_table] ([my_column]) values ('[my_data]')"); please assist correct code? know it's basic stuff i'm new mysql. thanks in advance. so can use update statement where condition target specific row update table_name set column_name = 'whatever' column_name = '' , id = '1' if want update rows column blank use update table_name set column_name = 'whatever' column_name = '' no need of using id in above query reference on update

asp.net mvc - MVC Entity relationship - how to add child to entity as it's being created -

i have basinpeak entity default controller created in mvc project. when open http://xx.xx.xx.xx:51573/basinpeak/create , add new basinpeak, how can attach new note basinpeak @ time? i want call create action notecontroller when new note created how pass noteid basinpeak? or there easier way add note , have linked basinpeak public class basinpeak { public int id { get; set; } public datetime datetime { get; set; } public int edus { get; set; } public int rating { get; set; } public int? noteid { get; set; } public virtual note note { get; set; } } public class note { public int id { get; set; } public string notes { get; set; } public datetime when { get; set; } public string personid { get; set; } public string history { get; set; } } you should ideally create basin peak first , create note attached basinpeak if want user should not leave page basinpeak created try using ajax ideally should this. you hit u

java - right click popup menu is not working properly (in jtable) -

its working first time after deleting line shows blank on popup menu in right click. think because of refresh method couldn't solve it. private void refresh() { list<string> head = new arraylist<>(); head.add("id"); head.add("П/Н"); enlargealistablemodel model = new enlargealistablemodel(dbsql.listalis(), head) { // ***************** }; tblenlarge.setmodel(model); tblenlarge.addmouselistener(new mouseadapter() { @override public void mousereleased(mouseevent e) { if (e.ispopuptrigger()) { popup.removeall(); jmenuitem delete = new jmenuitem("delete"); delete.addactionlistener(new actionlistener() { @override public void actionperformed(actionevent e) { if (tblenlarge.getselectedrow() == -1) { } else { deleteenlarg

excel - Run all possible combination of page filters in a pivot + VBA + Dynamic Solution -

i trying create macro dynamic , runs through possible combination of page filters , produce reports. right now, have 2 filters: accountmanager , costcenter , macro below runs through values of accountmanager , corresponding value of costcenter , prepares report. sub run_all_reports() dim pt pivottable dim pf pivotfield dim pi pivotitem, pi2 pivotitem sheets("pivot").activate set pt = activesheet.pivottables("budget") each pi in pt.pagefields(1).pivotitems pt.pagefields(1).currentpage = pi.name each pi2 in pt.pagefields(2).pivotitems pt.pagefields(2).currentpage = pi2.name call run_report next next end sub i not know how extend functionality dynamic, i.e. reads how many page filters present , prepares report each possible combination. lets say, introduce filter - area. should produce reports possible combination. example below: john, marketing, london john, marketing, newyork

java - ResultSet.next() Throwing SQLException: Result Set Closed -

i've tried debug code , read oracle doc , don't see reason why result set closed. statement statement = databaseconnector.connect(); string sql = "select * room room_type '*"+roomtype+"*' "+availability; boolean foundresults = statement.execute(sql); if(foundresults){ resultset rs = statement.getresultset(); stringbuilder row = new stringbuilder(); if(rs!=null){ while(rs.next()){ re: sqlexception i'm not quite sure databaseconnector supposed in question code, following test code works me. re: wildcard character when using operator in query from within access application itself asterisk * wildcard character use. when querying ace (access) database from other application 1 needs use "standard" percent % wildcard character. note following code uses % ; using * won't work here. import java.sql.*; public class jdbcquery { public static void main( string args[] ) {

javascript - Re-sorting backbone collection from view -

i'm having problems resorting collection upon click event. sorting function triggered , executes each model neither reset event gets triggered nor collection changes on view. i have multiple sort criterias defined on collection like: fenorequire.collections.competitioncollection = backbone.collection.extend({ model: fenorequire.models.competitionmodel, comparator: function (property) { return selectedstrategy.apply(model.get(property)); }, strategies: { name: function (competition) { return competition.get("name"); }, namereverse: function (competition) { console.log(competition); return -competition.get("name"); }, date: function (competition) { console.log(competition.get("event")); }, }, changesort: function (sortproperty) { this.comparator = this.strategies[sortproperty]; }, initialize: function () { this.changesort("name"); } }); and on v

javascript - append new criteria to actual search url during paging -

i having hard times append new criteria existing url say, have url after search-submit: /found_items/?state=bla&score=bla and in result page, have paginator, want if click on next button, url above should remain , new ?page=number should appended url. <a href="?page={{ locs.next_page_number }}">next</a> what happening is, /found_items/?state=bla&score=bla disappearing , becoming /?page=number . i want this: /found_items/?state=bla&score=bla&page=numer how can this? doniyor, i believe may want add other parameters url when page first loads, , can set state , score in view populates values in rendered url. can set defaults state , score in view when visitor first comes page. <a href="{% url 'name_of_view' %}?page={{ locs.next_page_number }}&state={{ state }}&score={{ score }}">next</a> or, if parameters may different different renderings of page, create query string in view ,

c++ - Unique pointer to stream -

#include <memory> #include <istream> typedef std::unique_ptr<std::istream> mytype; class myclass{ mytype mystream; public: myclass(mytype a_stream){ mystream = std::move(a_stream); //compiler error } }; why i'm not allowed move newly created stream? far know, streams not copyable, movable. miss something? unique pointer fits non-copyable objects, @ least theorically. compiler error no match 'operator=' the argument constructor by-value -- have make by-reference . by-value object needs copied when use constructor. ok, use unique_ptr , still copied can moved. so, try this: myclass(mytype &a_stream){ mystream = std::move(a_stream); //compiler error } or maybe even myclass(mytype &&a_stream){ mystream = std::move(a_stream); //compiler error } this by-reference , no copy @ place using occur. although, find strange error @ place of move , may wrong.

javascript - jQuery returning undefined with transaction.executeSql() -

i trying populate html tag data web sql database jqm application. here code: $("#profile").on("pageinit", function () { db.transaction(function (transaction) { var sql = "create table if not exists profile " + " (id integer not null primary key autoincrement, " + "nickname varchar(100) not null," + "tankvol varchar(100) not null," + "watertype varchar(100) not null," + "category varchar(100) not null)" transaction.executesql(sql, undefined); var sqlnickname = "select nickname profile"; transaction.executesql(sqlnickname, undefined, function (transaction, result) { var ul = "<ul>"; if (result.rows.length) { (var = 0; < result.rows.length; i++) { var row = result.rows.item; var nickname = row.nickna

Why is my PowerShell host running as 32-bit on a 64-bit machine? -

i'm building powershell host in vs 2012, in c# (.net 4.5) console project. project configured cpu , 'prefer 32-bit' not checked. i've added reference system.management.automation manually adding <reference include="system.management.automation" /> to itemgroup other references in .csproj file. getting odd behaviour reading registry (missing keys, etc.) , realised looking @ x86 part. ran script in host: if ([system.intptr]::size -eq 4) { "32-bit" } else { "64-bit" } and got "32-bit" which wasn't surprise given behaviour, surprise given configuration. got ideas? there hosted powershell has x86? on off-chance, tried checking 'prefer 32-bit' box, saving project, un-checking , saving project again. after this, built 64-bit. info, visual studio 2012 update 2 (11.0.60315.01).

Android Google Maps V2 shows blurry image on Android 2.3.3 - Titanium -

i have implemented ti.map module on sdk 3.1. run code show map: var mapobject = require("ti.map"); var map = mapobject.createview({ width:ti.ui.fill, height:ti.ui.fill, annotations:annotations, userlocation:true, regionfit:true, maptype:mapobject.normal_type }); here image of blurry map: http://goo.gl/qkznv which taken device android 2.3.3. it works fine on android > 4. i have set right google maps v2 key. because when didnt have key, didn't show map, grey area. does know issue is? i don't if answer solution specific situation. i had problem using both google maps android api debug , release keys mixed together. when ran app in debug mode using release key. shows maps cache never load google maps servers because key incorrect. results, when zooming, in blurry or missing images. your app show error 1 below on startup: 05-13 13:51:22.053: e/google maps android api(29198): ensure following correspond in api co

oauth 2.0 - Google OpenId and Google APIs -

i trying achieve openid login google , acces token access google apis (such google plus, or drive) the first attemp successful big problem: make openid stuff, , user redirected google identify himself, return app identified. make oauth stuff google apis, redirect user again identify himself , cameback code, exchange code access token needed call google apis. the user needs identify twice. that's not good. i read , tryed google hybrid openid , oauth . links there points deprecated oauth1 interface, , cant make work, user identified not request_token continue oauth stuff. so have couple of questions: is there way identify user agains google openid , @ same time users consent access google apis? is hybrid protocol still working oauth2 , new google apis? i'm on way or im missing something? i need both openid , oauth beacouse application needs in google marketplace , must login users openid, , need hit apis need oauth2 access_token. thanks! why ne

java - Dynamically update JComboBox (NullPointerException) -

i'm trying dynamically update jcombobox in swing application , getting null pointer exception. class accounts extends jpanel { jcombobox<string> accountselect; defaultcomboboxmodel accountselectmodel; public accounts() { this.initgui(); } public void initgui() { //setlayout etc... string[] al = {};//start empty this.accountselectmodel = new defaultcomboboxmodel(al); this.accountselect = new jcombobox<string>(); this.accountselect.setmodel(accountselectmodel); this.add(this.accountselect); } public void updatecombobox(string[] al) { //clear items , apply new this.accountselectmodel = new defaultcomboboxmodel(al); this.accountselect.setmodel(this.accountselectmodel); } public void removecomboboxitems() { //a call here here resorts in null exception pointer ??? this.accountselectmodel.removeallelements(); } } thanks feedback. update figured out problem. sure wasn't problem (sorry not putting

c# - Can we use variable for a table name in query? -

here in code trying retrieve information database , store in table. in query have used variable specify table, doing because want use single piece of code retrieve information various tables based on table name variable "a" contain when executing it's throwing me exception. please help... myoledbconnection.open(); string = "login"; string query = string.format("select email,username,phoneno,department '{1}' email='{0}'", editrecordtextbox.text,a); datatable dt = new datatable(); oledbdataadapter da = new oledbdataadapter(); da = new oledbdataadapter(query, myoledbconnection.vcon); da.fill(dt); note- part of code, exception occuring in code only. your code in fact working correctly. first of all, remove single quotes around table name. these mark text, not identifier or name. i can imagine login reseverd name cannot use plain text in sql. depending on database can quote tablename recognizes name, not reserved word.

ios - How to prefer tap gesture over draw gesture? -

in view i'm overriding "touches*" methods let user draw on screen. i'm recording locations. in addition have 2 gesture recognizers on view detect single tap , double tap. if move finger little bit , short enough, recording small "draw" gesture. when raising finger, additional tap gesture triggered. trial , error possibly figure out minimum time , movement threshold i'm sure there smarter ways? need know after how movement and/or save assume no tap gesture trigger. you can avoid tap gestures. instead of can recognize taps in touch events itself. - (void)touchesended:(nsset*)touches withevent:(uievent*)event { if(touches.count == 1) { if([[touches anyobject] tapcount] == 1) { // action here single tap } else if([[touches anyobject] tapcount] == 2) { // action here double tap } } } and have set global bool variable check whether user moved finger on screen. bool

Create and fit a Multiplicative linear regression using Python/Sklearn -

i'm using python 2.7 , scikit-learn fit dataset using multiplicate linear regression, different terms multiplied instead of added in sklearn.linear_models.ridge . so instead of y = c1 * x1 + c2 * x2 + c3 * x3 + ... we need y = c1 * x1 * c2 * x2 * c3 * x3... can enable python , sklearn fit , predict such multiplicative/hedonic regression model? i think should able regular linear regression manipulating input data set (data matrix). the regression y ~ c1 * x1 * c2 * x2 *... equivalent y ~ k * (x1 * x2 *...) k constant so if multiply of values in design matrix together, regress on that, think should able this. i.e. if data matrix, x, 4 x 1000 features x1, x2, x3, , x4, use pre-processing step create new matrix x_new, 1 x 1000 single column equals x1 * x2 * x3 * x4, fit y ~ x_new (clf = linearregression(), clf.fit(x_new,y))

android - i dont know how to get the position of the img that i click so i can pass it to next acitvity -

my grid view working okay , displays image sdcard.when long press image contextual task box open.one of option view(to view in full screen).i dont know how id or postion of selected image can pass activity open in fullscreen. public class mainactivity extends activity { public class imageadapter extends baseadapter { private context mcontext; arraylist<string> itemlist = new arraylist<string>(); public imageadapter(context c) { mcontext = c; } void add(string path){ itemlist.add(path); } @override public int getcount() { return itemlist.size(); } @override public object getitem(int position) { // todo auto-generated method stub return itemlist.get(position); } @override public long getitemid(int position) { // todo auto-generated method stub return 0; } @override public view getview(int position, view convertview, viewgroup parent) {

matlab - Inverse of rgb2ycbcr() in Octave? (No ycbcr2rgb) -

how convert output of rgb2ycbcr rgb in octave? can't find ycbcr2rgb function in image package. i finished rewriting rgb2ycbcr , implementing ycbcr2rgb octave's image package. part of next image package release (likely happen @ end of summer). clone image package repository or download individual functions manually: the ycbcr2rgb function ; the new rgb2ycbcr function ; the private function calculations.

C++/Boost Insert list items into map without manual loop -

in c++ program, have std::list , std::map (although using boost:unordered_map) , know elegant way of inserting elements in list map. key result of method call on elements on in list. so example have: std::list<message> messages = *another list elements*; std::map<std::string, message> message_map; and want insert elements list map key being message.id(), every message in messages. is there way without looping on list , doing manually? i can't use c++11 still interested in c++11 solutions interests sake. able use boost. thank you. a c++11 solution: can use std::transform transform std::list elements std::map elements: std::transform(message.begin(), messages.end(), std::inserter(message_map, message_map.end()), [](const message& m) { return std::make_pair(m.id(), m); }); the equivalent can done c++03 passing function pointer instead of lambda.

mongoose - MongoDB GeoNear Aggregate -

the question is: consider following location: [-72, 42] , range (circle) of radius 2 around point. write query find states intersect range (circle). then, should return total population , number of cities each of these states. rank states based on number of cities. i have written far: db.zips.find({loc: {$near: [-72, 42], $maxdistance: 2}}) and sample output of is: { "city" : "woodstock", "loc" : [ -72.004027, 41.960218 ], "pop" : 5698, "state" : "ct", "_id" : "06281" } in sql group "state", how able here while counting cities , total population? assuming follow mongoimport routine zipcode data (i brought mine collection called zips7): mongoimport --db mydb --collection zips7 --type json --file c:\users\drew\downloads\zips.json or mongoimport --db mydb --collection zips7 --type json --file /data/playdata/zips.json (depending on os , paths) then db.zips7.ensurei

javascript - parse float with two decimals, -

this input <input type="text" name="price" class="solo-numeros"> with function $(".solo-numeros").blur(function() { var numb = parsefloat($(this).val().replace(/\d/g,"")).tofixed(2); $(this).val(numb); }); i try change result input float 2 decimals so try 555.61 but on blur value change to 55561.00 why that???? this happens because you're removing non-numeric characters ( \d ), such period. "55.61" becomes "5561" , made two-decimal string-representation of float, hence "5561.00" references: javascript regular expressions . string.replace() . number.tofixed() .

jquery - looking for a responsive javascript charting library -

there couple of charting libs out there, of them not responsive. i have tried morris.js isn't responsive. so looking 1 responsive , free , looks morris.js( no highcharts, flot, google ) anybody? try amcharts: http://www.amcharts.com/javascript-charts/ they respond container changes dynamically perfect adaptive layouts.

asp.net mvc - IIS 8 401.3 with ACL and static content -

i'm having problem iis , acl's. i have configured mvc application under dedicated apppool. apppool runs under applicationpoolidentity (which in case user iis apppool\accountinfo.local = same name website). i gave full control user on root folder , made sure permissions inherited. when access home page runs fine , can access it. however, when try access static content, in subfolder (content/site.css) error 401.3. i have made sure permissions inherited , if go effective permissions can see user have full control. i have enabled failed request tracing , security auditing don't log files, nor events in event viewer. what missing here? ok, got it. apparently requests static content don't go through applicationidentity through standard iusr account. once gave user read permissions on folder, started working. learnt new today.

Java logic in my code -

okay, have code below , keep getting run-time errors , i'm thinking flaw in codes logic. i'm trying use setoneotherpicture method pick picture , set array later called on displayed in showartcollection method. i've been given 2 parameters, which , pref . can me this? thanks. public class house { string owner; picture pref; picture favpic; picture [] picarray = new picture [3]; public void showartcollection () { artwall awall = new artwall(600,600); awall.copypictureintowhere(favpic,250,100); awall.copypictureintowhere(pref,51,330); awall.copypictureintowhere(pref,151,330); awall.copypictureintowhere(pref,351,280); awall.show(); } public void setoneotherpicture (int which, picture pref) { this.picarray [which] = new picture (filechooser.pickafile ()); } public static void main (string [] args) { house phdshouse = new house ("mad ph.d."); picture favpic = new picture (); picture pref = new picture ();

python - Ordering multiple functions with enable/disable options -

i sending ajax request "data" field containing string, multiple options user sets. each option either "enabled" or "disabled", , act enable or disable functions in class. wondering if there better way of organizing code doesn't involve calling every function , checking see if enabled or disabled? class parse(webapp2.requesthandler): def post(self): data = self.request.get("data") func1_option = self.request.get("func1_option") func2_option = self.request.get("func2_option") func3_option = self.request.get("func3_option") newdata = func1(func2(func3(data))) self.response.write(newdata) def func1(foo): if funct1_option = "disabled": return foo else: return some.function(foo) def func2(foo): if funct2_option = "disabled": return foo

c - Why does my producer - consumer pattern have unexpected output? -

in this excercise (producer - consumer), 3 producers 1 thread each , produce prime numbers. when run program, first prime number consumed not first produces, don't expected output. can please me find , correct bug? here's main file pattern: #include <stdio.h> #include "oslab_lowlevel_h.h" int nextprime( int ); #define fifo_size 10 /* declare structure hold producer's starting value, * , integer producer-number (producer 1, 2 or 3). */ struct prod { int startvalue; int id; }; unsigned int stack1[0x400]; /* stack thread 1 */ unsigned int stack2[0x400]; /* stack thread 2 */ unsigned int stack3[0x400]; /* stack thread 3 */ unsigned int stack4[0x400]; /* stack thread 4 */ unsigned int stack5[0x400]; /* stack thread 5 */ /* declare variables first-in-first-out queue */ int fifo[fifo_size]; /* array holding fifo queue data. */ int rdaddr; /* next unread entry when reading queue. */ int wraddr; /* next f