Sunday, 15 July 2012

android - Registering a content provider -



android - Registering a content provider -

i have been trying create re-create of android's contactsprovider. wanted create minimal changes provider of work in app utilize data. however, want ensure real contacts not accessible app making planned create re-create of provider. after navigating though process of creating re-create provider different authority, tried phone call copied provider. @ point got 2 errors.

the first 1 in own app got error "failed find provider info 'contentprovider'" read this reply had taken care of mentioned here already.

the sec error happens in provider: java.lang.noclassdeffounderror: com.google.common.collect.immutableset$builder reason why getting first error. because provider never able access classes internal android, not getting registered valid provider , app not able "find" provider.

here manifest file contactmanager:-

<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.prajitdas.contactmanager" android:versioncode="1" android:versionname="1.0" > <uses-sdk android:minsdkversion="18" android:targetsdkversion="19" /> <uses-permission android:name="android.permission.read_contacts" /> <uses-permission android:name="android.permission.get_accounts" /> <application android:allowbackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/apptheme" > <activity android:name="com.prajitdas.contactmanager.contactmanager" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.main" /> <category android:name="android.intent.category.launcher" /> </intent-filter> </activity> <activity android:name="contactadder" android:label="@string/addcontacttitle"> </activity> </application> </manifest>

and manifest file contactsprovider:-

<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.prajitdas.android.providers.contacts" android:versioncode="2" android:versionname="2.0"> <permission android:name="com.android.voicemail.permission.read_write_all_voicemail" android:label="@string/read_write_all_voicemail_label" android:description="@string/read_write_all_voicemail_description" android:permissiongroup="android.permission-group.personal_info" android:protectionlevel="system|signature" /> <uses-permission android:name="android.permission.read_contacts" /> <uses-permission android:name="android.permission.write_contacts" /> <uses-permission android:name="android.permission.get_accounts" /> <uses-permission android:name="android.permission.access_fine_location" /> <uses-permission android:name="android.permission.access_coarse_location" /> <uses-permission android:name="android.permission.bind_directory_search" /> <uses-permission android:name="android.permission.update_app_ops_stats" /> <uses-permission android:name="android.permission.read_sync_settings" /> <uses-permission android:name="com.android.voicemail.permission.add_voicemail" /> <uses-permission android:name="com.android.voicemail.permission.read_write_all_voicemail" /> <application android:process="android.process.acore" android:label="@string/app_label" android:icon="@drawable/app_icon" android:allowbackup="true"> <!-- modified provider authorization --> <provider android:name="contactsprovider2" android:authorities="fakecontacts;com.prajitdas.android.providers.contacts" android:label="@string/provider_label" android:multiprocess="false" android:exported="true" android:readpermission="android.permission.read_contacts" android:writepermission="android.permission.write_contacts"> <path-permission android:pathprefix="/search_suggest_query" android:readpermission="android.permission.global_search" /> <path-permission android:pathprefix="/search_suggest_shortcut" android:readpermission="android.permission.global_search" /> <path-permission android:pathpattern="/contacts/.*/photo" android:readpermission="android.permission.global_search" /> <grant-uri-permission android:pathpattern=".*" /> </provider> <provider android:name="calllogprovider" android:authorities="fakecall_log" android:syncable="false" android:multiprocess="false" android:exported="true" android:readpermission="android.permission.read_call_log" android:writepermission="android.permission.write_call_log"> </provider> <provider android:name="voicemailcontentprovider" android:authorities="com.prajitdas.android.voicemail" android:syncable="false" android:multiprocess="false" android:exported="true" android:permission="com.android.voicemail.permission.add_voicemail"> </provider> <!-- handles database upgrades after otas, disables --> <receiver android:name="contactsupgradereceiver"> <!-- broadcast sent after core scheme has finished booting, before home app launched or boot_completed sent. --> <intent-filter> <action android:name="android.intent.action.pre_boot_completed"/> </intent-filter> </receiver> <receiver android:name="packageintentreceiver"> <intent-filter> <action android:name="android.intent.action.package_added" /> <data android:scheme="package" /> </intent-filter> <intent-filter> <action android:name="android.intent.action.package_replaced" /> <data android:scheme="package" /> </intent-filter> <intent-filter> <action android:name="android.intent.action.package_removed" /> <data android:scheme="package" /> </intent-filter> <intent-filter> <action android:name="android.intent.action.package_changed" /> <data android:scheme="package" /> </intent-filter> </receiver> <receiver android:name="localechangereceiver"> <intent-filter> <action android:name="android.intent.action.locale_changed"/> </intent-filter> </receiver> <service android:name="voicemailcleanupservice"/> <activity android:name=".debug.contactsdumpactivity" android:label="@string/debug_dump_title" android:theme="@android:style/theme.holo.dialog" > <intent-filter> <action android:name="com.prajitdas.android.providers.contacts.dump_database"/> <category android:name="android.intent.category.default"/> </intent-filter> </activity> <provider android:name=".debug.dumpfileprovider" android:authorities="com.prajitdas.android.providers.contacts.dumpfile" android:exported="true"> </provider> </application> </manifest>

as can see, have copied original manifest files , modified new authorities provider. have done same java code, big post here. if can help me identify steps either create android internal calls work or maybe resolve first problem of "registering" provider on phone somehow, much appreciated.

com.google.common.collect.immutableset$builder isn't internal android class. part of google's guava library. need add together guava's jar dependency project compile (and, probably, others dependencies, check list contactsprovider in android.mk).

the actual way of adding jar dependency varies depending on utilize building app (e.g. ant, maven, gradle, or eclipse).

android

java - Glassfish 4.0 with Primefaces 5.0 triggers automatically all methods -



java - Glassfish 4.0 with Primefaces 5.0 triggers automatically all methods -

i'm deploying little website on glassfish , have 2 method runs python file. methon 1 runs python file nil more. when access site automatically phone call functions...

public void reservate() { system.out.println("almaaa"); string start, end; start = time1.substring(0,5); end = time1.substring(6,11); reserv = new reservation("asd", room, "19.00", "20.00"); reserv.getoutput(); } <p:commandlink value="#{navigationto.time1button}" onclick="#{navigationto.reservate()}" style="font-size: 300%"/>

the reserv.getoutput() triggers file , runs python file. if access site if dont click on actionlink triggers everyting , made reservation...

i want run python file if click commadnlink.

any suggestion?

java python jsf primefaces glassfish-4

When to choose development of a PowerShell Module over PowerShell Script -



When to choose development of a PowerShell Module over PowerShell Script -

i write powershell script windows administrators, in order help them in tasks related deployment of web application.

is there reason should favor or exclude development of powershell module (.psm1) instead of doing powershell script (.ps1)?

arguments develop script

simplicity: thing using script bit easier , more straightforward windows administrators not requires module installed (but might wrong not windows admin!). faster development: developing module requires more careful programming exposure of internal methods, designing api must more rigorous.

arguments develop module:

reusability: first things comes mind: if administrator wants integrate our script in own script, might easier him reuse module exposing 1 (or several) cmdlet rather invoke our script? ...

if know mutual utilize case of ps scripts vs ps modules, or technical limitations of each choice, might help.

to understand modules can you, read this: http://msdn.microsoft.com/en-us/library/dd878310(v=vs.85).aspx

in nut shell,

windows powershell modules allow partition, organize, , abstract windows powershell code self-contained, reusable units. these reusable units, administrators, script developers, , cmdlet developers can share modules straight others. script developers can repackage third-party modules create custom script-based applications. modules, similar modules in other scripting languages such perl , python, enable production-ready scripting solutions utilize reusable, redistributable components, added benefit of enabling repackage , abstract multiple components create custom solutions.

if script has functions , not written perform single task, can rename .psm1 convert module. if not using functions, of course, there no selection go .ps1. in such case, each .ps1 used perform single task. prefer modules when sharing scripts write others.

powershell module windows-scripting

Google login iOS error "Access Not Configured , activate the API for your project" -



Google login iOS error "Access Not Configured , activate the API for your project" -

i have integrated ios app google plus , maintain getting error past few weeks. did ensure contacts api , google+ api enabled on developer console still receiving error.

error domain=com.google.gtljsonrpcerrordomain code=403 "the operation couldn’t completed. (access not configured. please utilize google developers console activate api project.)" userinfo=0xc8645c0 {error=access not configured. please utilize google developers console activate api project., gtlstructurederror=gtlerrorobject 0xc876bc0: {message:"access not configured. please utilize google developers console activate api project." code:403 data:[1]}, nslocalizedfailurereason=(access not configured. please utilize google developers console activate api project.)}

ios google-plus google-login

php - Error: Module does not exist when clicking links in sugarcrm CE -



php - Error: Module does not exist when clicking links in sugarcrm CE -

at moment when click module link in menu comes saying "error: module not exist." can still access module typing link in address bar. (dir/index.php?module=&action=index&return_module=&return_action=detailview)

this happens in list view when clicking on links record.

please help me !

thanks

sugar ce version 6.5.16 (build 1082)

php error-handling sugarcrm

Google Admin SDK Directory API - Service Unavailable Error while retrieving users -



Google Admin SDK Directory API - Service Unavailable Error while retrieving users -

we have been using admin sdk's directory api retrieve users google apps domain , sync our application. has been working fine till since past 4-5days our client domain has been experiencing error while retrieving users.

exception message : 503 ok { "code" : 503, "errors" : [ { "domain" : "global", "message" : "service unavailable. please seek again", "reason" : "backenderror" } ], "message" : "service unavailable. please seek again" }

i have referred "backenderror accessing users.list in admin sdk" . google hasn't replied yet. can know when issue solved or there solution nowadays solve issue?

thanks!

there nil can it. wait , retry later.

maybe interested in exponential backoff:

https://code.google.com/p/google-http-java-client/wiki/exponentialbackoff

https://developers.google.com/drive/web/handle-errors

http://is.gd/ocgvuz

google-app-engine google-admin-sdk

Canonicalization (c14n) of XML code using PHP class method -



Canonicalization (c14n) of XML code using PHP class method -

i found in php documentation method domnode class, defined domnode::c14n (http://cl1.php.net/manual/en/domnode.c14n.php). sadly i've had hard time finding finish examples it's usage, , have tryed code no success... due null experiance using php default classes.

<?php $document = '<document>... (more xml code canonicalize)</document>'; $xml = new c14n(); $xml = $document->c14n();

when executing get:

fatal error: class 'c14n' not found in c:\wamp\www\...

i have researched , class domnode included in dom extension suposed come installed , enabled default, plus c14n not class method.

i have php 5.3.13.

thanks in advance.

to help reading php manual here:

domnode::c14n

this means class domnode there method named c14n.

so find such domnode, can phone call method on?

well, domdocument illustration domnode, see next manual page: http://cl1.php.net/manual/en/class.domdocument.php write

domdocument extends domnode {

an extends stands is a, domdocument domnode. scrolling downwards on page give general illustration code on how create such object, need phone call method:

// "create" document. $xml = new domdocument( "1.0", "iso-8859-15" ); $xml->loadxml('<document>... (more xml code canonicalize)</document>'); echo $xml->c14n();

hope helps orientation.

example (online-demo):

<?php // "create" document. $xml = new domdocument( "1.0", "iso-8859-15" ); $xml->loadxml('<document b="c" f="e" a="j">... <!-- stupid whitespace illustration --> mother told me go shopping </document>'); echo $xml->c14n();

program output

<document a="j" b="c" f="e">... mother told me go shopping </document>

as illustration shows, attributes sorted , comment has been removed.

php xml

java - Make canvas transparent on Android Linear Layout -



java - Make canvas transparent on Android Linear Layout -

im trying create floating activity , on click open transparent canvas drawing. content drawing want create transparent .

what tried is:

final drawingview drawingview = (drawingview) findviewbyid(r.id.drawing);

my drawingview class:

import java.util.arraylist; import android.content.context; import android.graphics.*; import android.graphics.point; import android.graphics.drawable.bitmapdrawable; import android.graphics.drawable.drawable; import android.hardware.camera.size; import android.util.attributeset; import android.util.log; import android.util.pair; import android.view.motionevent; import android.view.view; import android.view.view.ontouchlistener; public class drawingview extends view implements ontouchlistener { private canvas m_canvas; private path m_path; private paint m_paint; arraylist<pair<path, paint>> paths = new arraylist<pair<path, paint>>(); arraylist<pair<path, paint>> undonepaths = new arraylist<pair<path, paint>>(); private float mx, my; private static final float touch_tolerance = 4; public static boolean iseraseractive = false; public drawingview(context context, attributeset attr) { super(context); setfocusable(true); setfocusableintouchmode(true); this.setbackgroundcolor(color.transparent); this.setontouchlistener(this); oncanvasinitialization(); } public void oncanvasinitialization() { m_paint = new paint(); m_paint.setantialias(true); m_paint.setdither(true); m_paint.setcolor(color.parsecolor("#000000")); m_paint.setstyle(paint.style.stroke); m_paint.setstrokejoin(paint.join.round); m_paint.setstrokecap(paint.cap.round); m_paint.setstrokewidth(30); m_canvas = new canvas(); m_canvas.drawcolor(color.argb(0, 255, 255, 255)); m_path = new path(); paint newpaint = new paint(m_paint); paths.add(new pair<path, paint>(m_path, newpaint)); } @override protected void onsizechanged(int w, int h, int oldw, int oldh) { super.onsizechanged(w, h, oldw, oldh); } public boolean ontouch(view arg0, motionevent event) { float x = event.getx(); float y = event.gety(); switch (event.getaction()) { case motionevent.action_down: touch_start(x, y); invalidate(); break; case motionevent.action_move: touch_move(x, y); invalidate(); break; case motionevent.action_up: touch_up(); invalidate(); break; } homecoming true; } @override protected void ondraw(canvas canvas) { (pair<path, paint> p : paths) { canvas.drawpath(p.first, p.second); } } private void touch_start(float x, float y) { if (iseraseractive) { m_paint.setcolor(color.white); m_paint.setstrokewidth(6); paint newpaint = new paint(m_paint); // clones mpaint object paths.add(new pair<path, paint>(m_path, newpaint)); } else { m_paint.setcolor(color.black); m_paint.setstrokewidth(30); paint newpaint = new paint(m_paint); // clones mpaint object paths.add(new pair<path, paint>(m_path, newpaint)); } m_path.reset(); m_path.moveto(x, y); mx = x; = y; } private void touch_move(float x, float y) { float dx = math.abs(x - mx); float dy = math.abs(y - my); if (dx >= touch_tolerance || dy >= touch_tolerance) { m_path.quadto(mx, my, (x + mx) / 2, (y + my) / 2); mx = x; = y; } } private void touch_up() { m_path.lineto(mx, my); // commit path our offscreen m_canvas.drawpath(m_path, m_paint); // kill don't double draw m_path = new path(); paint newpaint = new paint(m_paint); // clones mpaint object paths.add(new pair<path, paint>(m_path, newpaint)); }

my activity main xml:

<linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/drawing_question" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_marginleft="0dp" android:layout_marginright="0dp" android:orientation="horizontal" android:visibility="visible" > <com.swap.handdrawing.drawingview android:id="@+id/drawing" android:layout_width="wrap_content" android:layout_height="fill_parent" android:layout_marginbottom="0dp" android:layout_marginright="0dp" android:background="@null" > </com.swap.handdrawing.drawingview> </linearlayout>

& how can create this:

java android android-layout canvas

node.js - MongoDb Mongoose .exec() can not get results to console -



node.js - MongoDb Mongoose .exec() can not get results to console -

> cpu.findone({}).sort({_id: -1}).limit(1).exec(function (err, huh) { ... if (err) homecoming handleerror(err); ... console.log(huh.status); ... console.log("hi"); ... }) { domain: null, _events: { err: [function], complete: [function] }, _maxlisteners: 10, emitted: {}, ended: false }

how document found printed console in string format? object instead.

edit:

> cpu.findone({}).sort({_id: -1}).limit(1).exec(function (err, result) { console.log(err) }) { domain: null, _events: { err: [function], complete: [function] }, _maxlisteners: 10, emitted: {}, ended: false } >

as dylants above has stated, mongoose can not correctly print console when ran node shell.

node.js mongodb mongoose

Token error in Google Apps Marketplace application -



Token error in Google Apps Marketplace application -

we have google apps marketplace app deployed on app engine, , uses gdata apis , of 3 days ago (20 of june) started getting error in logs:

unauthorized - server responded with: 401, <html> <head> <title>token invalid - target disabled.</title> </head> <body bgcolor="#ffffff" text="#000000"> <h1>token invalid - target disabled.</h1> <h2>error 401</h2> </body> </html>

this piece of code raises error:

two_legged_oauth_token = gdata.gauth.twoleggedoauthhmactoken(consumer_key, consumer_secret, admin_email) # email settings api client email_settings_client = gdata.apps.emailsettings.client.emailsettingsclient(domain=domain) email_settings_client.auth_token = two_legged_oauth_token sig = email_settings_client.retrievesignature(username=guid) #this line throws error

i know apis , 2 legged auth deprecated, google says it's not supposed happen until next month or so. nil in code or servers has changed, i'm not sure error says, , googling hasn't provided me insights. might mean?

just long shot, if using openid authentication, service may have been closed down.

here find of import migration details : https://developers.google.com/+/api/auth-migration

google-app-engine google-apps-marketplace

ruby on rails - RSpec view specs: accessing view helpers -



ruby on rails - RSpec view specs: accessing view helpers -

i'm testing rails (3.2.18) app , i'm having problem referencing view helpers in rspec (2.14.1) view specs.

the view specs fail because views can't access helper methods defined in app/helpers, nor controller methods have been marked helpers.

i guess can stub way out of this, wondering if can solved simple configuration tweak.

try add together setting spec/spec_helper.rb configs:

rspec.configure |config| config.include applicationhelper end

ruby-on-rails ruby rspec

ios - Multipeer Connectivity Can Not Connect -



ios - Multipeer Connectivity Can Not Connect -

i trying connect iphone device , iphone simulator using multipeer connectivity framework.

so far, i've tried code in this tutorial, , this one too, haven't been able connect 2 devices successfully:

sometimes, 1 of devices not appear in other device's browser list (mcbrowserviewcontroller).

other times, 1 of devices appears twice or 3 times in other device's browser (this question's reply not solve issue). restarting/deleting app not prepare it, changing "service type" string does. somehow sessions "stay alive"?

if advertise using instance of mcadvertiserassistant, invitation dialog not shown on target device.

if, instead, utilize instance of mcnearbyserviceadvertiser plus alert view, invitations accepting them causes state hang in "connecting", , "done" button of browser never becomes enabled (this farthest have come).

i've read several questions/answers here, , still isn't clear if should utilize same or different sessions browsing/advertising, , lifetime said sessions should have.

note: real device running ios 8 beta.

ios multipeer-connectivity

Convering String to Int array in java -



Convering String to Int array in java -

i have "string line " variable in java when give

system.out.println(line);

it gives me output

233 81 335 332 165 56 82 316 123 247 328 348 177 89 86 1 252 228 34 350 116 91 193 106 272 121 56 203 179 259 25 163 101 77 116 135 29 257 254 400 195 192 20 59 270 350 116 92 6 87 22 230 126 207 393 73 399 57 96 93 9 196 172 111 192 234 315 59 35 351 390 239 88 339 145 17 161 330 328 198 47 194 107 231 312 260 118 369 344 114 355 99 117 199 219 5 255 336 124

the above output 4 separate lines.

now want convert string int array, such every location of integer array hold these numbers. tried tokenizing , parsing it, when info big 200000 lines of record, gives me error.

any suggestions? pls help.

use scanner class pass line (string) scanner constructor , utilize methods hasnextint() check , nextint() fetch , store arraylist<integer> utilize of loop.

java string int

actionscript 3 - Ipad won't load local SWF file from As3 -



actionscript 3 - Ipad won't load local SWF file from As3 -

i have 2 swf files within app, packeged air 14.0 ipa, image of loading screen, won't load, when publish test on ipad.

i not sure do.

loader.load(new urlrequest("com/clark/loadingscreen.swf")); loader.contentloaderinfo.addeventlistener(event.complete,swfin); e.target.loader.content.width = stage.stagewidth/2; e.target.loader.content.scaley = e.target.loader.content.scalex; e.target.loader.content.x = (stage.width/2)-(e.target.loader.content.width/2); e.target.loader.content.y = (stage.height/2)-(e.target.loader.content.height*1.5); addchild(loader);

here info adobe topic http://blogs.adobe.com/airodynamics/2012/11/09/packaging-and-loading-multiple-swfs-in-air-apps-on-ios/

actionscript-3 flash actionscript

c++11 - Trying to use lambda functions as predicate for condition_variable wait method -



c++11 - Trying to use lambda functions as predicate for condition_variable wait method -

i trying create producer-consumer method using c++11 concurrency. wait method condition_variable class has predicate sec argument, thought of using lambda function:

struct limitedbuffer { int* buffer, size, front, back, count; std::mutex lock; std::condition_variable not_full; std::condition_variable not_empty; limitedbuffer(int size) : size(size), front(0), back(0), count(0) { buffer = new int[size]; } ~limitedbuffer() { delete[] buffer; } void add(int data) { std::unique_lock<std::mutex> l(lock); not_full.wait(l, [&count, &size]() { homecoming count != size; }); buffer[back] = data; = (back+1)%size; ++count; not_empty.notify_one(); } int extract() { std::unique_lock<std::mutex> l(lock); not_empty.wait(l, [&count]() { homecoming count != 0; }); int result = buffer[front]; front end = (front+1)%size; --count; not_full.notify_one(); homecoming result; } };

but getting error:

[error] capture of non-variable 'limitedbuffer::count'

i don't know much c++11 , lambda functions found out class members can't captured value. value though, capturing them reference, seems it's same thing.

in display of brilliance stored struct members values in local variables , used them in lambda function, , worked! ... or not:

int ct = count, sz = size; not_full.wait(l, [&ct, &sz]() { homecoming ct != sz; });

obviously destroying whole point of wait function using local variables since value assigned 1 time , fun part checking fellow member variables may, should , change. silly me.

so, choices? there way can create wait method has do, using fellow member variables? or forced not utilize lambda functions i'd have declare auxiliary functions work?

i don't why can't utilize members variables in lambda functions, since masters of universe dessigned lamba functions c++11 way, there must reason.

count fellow member variable. fellow member variables can not captured directly. instead, can capture this accomplish same effect:

not_full.wait(l, [this] { homecoming count != size; });

c++11 concurrency lambda synchronization condition-variable

ios7 - Should my iOS game free memory at all when it enters background mode? -



ios7 - Should my iOS game free memory at all when it enters background mode? -

there couple of games want mention, show how handle entering background mode:

clash of clans. seems doesn't free memory @ when enters background mode, in fact can open lightweight applications notes , game go on playing without noticeable delay, seems pretty cool me user's perspective.

game of war. game falls loading screen , initialization process starts on 1 time again when runs inmediately after enters background mode, it's restarting game, annoying sometimes.

so, in case of game, has average memory footprint of 25 mb (and it's going less optimisations), know "free much memory possible" stuff recommended in order neighbour on ios platform, considering freeing memory when game enters background mode cause game have "annoying" pause when enters foreground mode...

...should save progress , pause game when entering background mode without freeing memory @ all, or should free much memory possible , load resources 1 time again when entering foreground mode, respective loading pause?

as point out (by giving 2 games examples utilize opposite strategies), there no unique reply question.

i think proper reply can worked out in given case defining utilize cases want app support.

e.g., 1 utilize case, mention, "the user can switch lightweight app , go game without unnecessary waits". (uc1) then, should have list of lightweight apps , reference devices want create sure utilize case satisfied.

on other hand, may want back upwards different utilize case: "the user come point left game, unless app terminated, in case app should nowadays main menu". (uc2)

in first case, not freeing best approach; in sec case, may want minimise chance app terminated while user task (lightweight or not), can go place left, though has wait resources load.

there might cases intermediate approach best, free part of memory, strike balance.

and, of course, create no sense going first utilize case (uc1) if app memory footprint big terminated after switching app on of devices. in such case, might create more sense freeing memory, @ to the lowest degree can spare app load time (vs. resources load time) when go it.

so, in end, depends...

memory ios7 process background

html - multiple CSS only show/hide button (no java/jquery) -



html - multiple CSS only show/hide button (no java/jquery) -

i need code joke website trying make, uses show/hide button reveal content/hide content.

it starts off hidden, , there button alter it.

however, cannot contain javascript, or jquery, assesment school project doing (which on css mainly)

is possible have multiple? have achieved 1 far.

my code far (i got off of website http://cssdeck.com/labs/css-only-showhide ): (html)

<article> <input type="checkbox" id="rma" role="button"> <label for="rma" onclick=""><span>show</span><span>hide</span></label> <section> <p>joke</p> </section> <section> <p>punchline</p> </section> </article>

(css)

article { position: relative; } article:before, :after { display: table; } article:after { clear: both } article section:last-of-type { display: none; visibility: hidden; } input[type=checkbox] { width: 1px; overflow: hidden; position: absolute; } [for="read_more"] { position: absolute; left: 100px; width: ; text-align: center; box-shadow: inset 1px 1px rgba(0, 0, 0, 0.1), inset -1px -1px rgba(0, 0, 0, 0.1); } [for="read_more"]:hover { background: rgba(0,0,0,.5); color: rgb(255,255,255); } [for="read_more"] span:last-of-type { display: none; visibility: hidden; } input[type=checkbox]:checked ~ section { display: block; visibility: visible; width: 100%; } input[type=checkbox]:checked ~ figure { width: 100% } input[type=checkbox]:checked ~ [for="read_more"] span:first-of-type { display: none; visibility: hidden; } input[type=checkbox]:checked ~ [for="read_more"] span:last-of-type { display: block; visibility: visible; }

you used input[type=checkbox] see if checkbox selected , should utilize id, way can check each 1 , not of them, example:

#first[type="checkbox"] { /* code here */ } #second[type="checkbox"] { /* code here */ }

html css

r - Aggregating 10 minute data to hourly mean with the hourly.apply function fails -



r - Aggregating 10 minute data to hourly mean with the hourly.apply function fails -

i have file date/time info , measured values said date , time. values measured every 10 minutes course of study of 1 month, , attempting time series analysis eventually. before however, wanted aggregate 10 min intervals hourly intervals calculating mean measurement of every 60 minutes. here sample of data(a total of 4319 observations):

date/time value 2013-01-01 00:00:00 31,439999 2013-01-01 00:10:00 33,439999 2013-01-01 00:20:00 39 2013-01-01 00:30:00 35,279999 2013-01-01 00:40:00 37,279999 2013-01-01 00:50:00 32,199997 2013-01-01 01:00:00 35,279999 2013-01-01 01:10:00 38,199997

my date/time info of type posixlt , values measured of type factor. have searched on site , have found several topics posted other users not apply me, or can not recreate same results using suggestions given on posts.

for example, user asked exact same question me: aggregate values of 15 min steps values of hourly steps , followed steps answers provided.

library(xts) dat.xts <- xts(data$values, as.posixct(data$datetime)) hourly.apply(dat.xts,mean)

but lastly line next error message:

error: not find function "hourly.apply"

although did install xts bundle zoo package, hourly.apply function appears stem from. reason this? give thanks in advance.

"hourly.apply" doesn't seem exist looking @ 'apply.daily' function in xts bundle seems straightforward create.

see xts::apply.daily. i've changed 'days' 'hours' produce following

apply.hourly <- function(x, fun,...) { ep <- endpoints(x, 'hours') period.apply(x, ep, fun, ...) }

try out

my.time <- seq(from = as.posixct('2000-01-01 00:00:00'), = as.posixct('2000-01-01 2:00:00'), = '10 min') my.data <- rep(10, length = length(my.time)) my.data <- as.xts(my.data, order.by = my.time) apply.hourly(my.data, sum) [,1] 2000-01-01 00:50:00 60 2000-01-01 01:50:00 60 2000-01-01 02:00:00 10

r statistics time-series aggregation xts

XML / PHP : Creation of a XML text with PHP -



XML / PHP : Creation of a XML text with PHP -

i'm beginner xml on php. page returns me next php error:

but, @ line 2, there "require_once", followed 3 others "require_once", path required file ok, , ends ';'. line above "

i have sample of code, think source of error (in order)

$xml = simplexml_load_string("<result/>"); $entitlements = $xml->addchild("entitlements"); $entitlements->addchild("productid", $productid);

then, below :

$fulfillmentxml = new simplexmlelement($result); //some stuff $fullfillmentxml echo $xml->asxml();

i not understand how xml works in php, thought there problem creating simplexmlelement() after simplexml_load_string() call.

your error doesn't php error, rather browser error generated when tried parse supplied xml contents. hence line 2 of error not refer line 2 of php file, line 2 of generated output.

check output (source of generated page), , see line 2 there. create sure have 1 root element, , nil comes after it.

php xml

windows - Isolated instances of Virtual Machine -



windows - Isolated instances of Virtual Machine -

i using microsoft windows azure cloud, have configure virtual machine(vm) in autoscale.

total 4 4 vm's, 3 instances created original virtual machine.

now problem when more 1 instance running,

lets 3 instances running - 3 instances isolated copies.

when utilize website upload images or files, or delete them. deleted 1 instance, "load balancer" chooses. doesn't uploaded or deleted other instances.

how can solve issue ?

this classic design pattern in load-balanaced websites. info needs shared across multiple servers within load-balanced web farm should saved centrally, not on individual servers. if have folks uploading files, can save them azure blob storage example.

windows azure virtual-machine

java - Custom square views margins padding issue -



java - Custom square views margins padding issue -

i'm trying create table nxm (in case 2x5) square views.

all ok with not-zero margin and/or padding not views of same dimensions, showing background between rows cells.

here xml , java code.

i tried without tablelayout 1 row 1 linearlayout, framelayout, it's same. trying different emulators different number of cells same dimensions.

so problem putting in same line many views same squared dimensions (with background. tried without bg image, colored bg, same issue).

thanks lot!

layout:

<tablerow android:layout_width="fill_parent" android:layout_height="fill_parent" > <com.myname.myproject.nodecontainer android:layout_width="0dp" android:layout_height="wrap_content" android:layout_margin="0dp" android:layout_weight="1" android:background="@drawable/tile_sq" > </com.myname.myproject.nodecontainer> <com.myname.myproject.nodecontainer android:layout_width="0dp" android:layout_height="wrap_content" android:layout_margin="0dp" android:layout_weight="1" android:background="@drawable/tile_sq" > </com.myname.myproject.nodecontainer> <com.myname.myproject.nodecontainer android:layout_width="0dp" android:layout_height="wrap_content" android:layout_margin="0dp" android:layout_weight="1" android:background="@drawable/tile_sq" > </com.myname.myproject.nodecontainer> <com.myname.myproject.nodecontainer android:layout_width="0dp" android:layout_height="wrap_content" android:layout_margin="0dp" android:layout_weight="1" android:background="@drawable/tile_sq" > </com.myname.myproject.nodecontainer> <com.myname.myproject.nodecontainer android:layout_width="0dp" android:layout_height="wrap_content" android:layout_margin="0dp" android:layout_weight="1" android:background="@drawable/tile_sq" > </com.myname.myproject.nodecontainer> </tablerow> <tablerow android:layout_width="fill_parent" android:layout_height="fill_parent" > <com.myname.myproject.nodecontainer android:layout_width="0dp" android:layout_height="wrap_content" android:layout_margin="0dp" android:layout_weight="1" android:background="@drawable/tile_sq" > </com.myname.myproject.nodecontainer> <com.myname.myproject.nodecontainer android:layout_width="0dp" android:layout_height="wrap_content" android:layout_margin="0dp" android:layout_weight="1" android:background="@drawable/tile_sq" > </com.myname.myproject.nodecontainer> <com.myname.myproject.nodecontainer android:layout_width="0dp" android:layout_height="wrap_content" android:layout_margin="0dp" android:layout_weight="1" android:background="@drawable/tile_sq" > </com.myname.myproject.nodecontainer> <com.myname.myproject.nodecontainer android:layout_width="0dp" android:layout_height="wrap_content" android:layout_margin="0dp" android:layout_weight="1" android:background="@drawable/tile_sq" > </com.myname.myproject.nodecontainer> <com.myname.myproject.nodecontainer android:layout_width="0dp" android:layout_height="wrap_content" android:layout_margin="0dp" android:layout_weight="1" android:background="@drawable/tile_sq" > </com.myname.myproject.nodecontainer> </tablerow> </tablelayout>

class:

package com.myname.myproject; import android.content.context; import android.util.attributeset; import android.widget.linearlayout; public class nodecontainer extends linearlayout { public nodecontainer(context context, attributeset attrs) { super(context, attrs); } public nodecontainer(context context) { super(context); } @override protected void onmeasure(int widthmeasurespec, int heightmeasurespec) { super.onmeasure(widthmeasurespec, heightmeasurespec); final int width = getmeasuredwidth(); setmeasureddimension(width, width); } }

java android views margins square

java - Paypal API Seamless checkout refreshed access token not working -



java - Paypal API Seamless checkout refreshed access token not working -

i integrating paypal's seamless checkout , i've managed create work have problem when access token expires (after 15 minutes). utilize refresh_token i'm provived login inquire new access token so:

map<string, string> configurationmap = new hashmap<string, string>(); map<string, string> configurationmap = new hashmap<string, string>(); configurationmap.put("clientid","xxxxxxx"); configurationmap.put("clientsecret", "yyyyyy"); configurationmap.put("service.endpoint", "https://api.sandbox.paypal.com"); configurationmap.put("mode", "sandbox"); apicontext apicontext = new apicontext(); apicontext.setconfigurationmap(configurationmap); createfromrefreshtokenparameters param = new createfromrefreshtokenparameters(); param.setgranttype("refresh_token"); param.setscope("openid"); // optional param.setclientid("xxxx"); // these not needed param.setclientsecret("yyyy"); // these not needed tokeninfo info = new tokeninfo(); // create token info object; setting refresh token info.setrefreshtoken(refreshtoken); info = info.createfromrefreshtoken(apicontext, param);

and obtain new, apparently correct, access token

{ "access_token": "a015vitdabshwd.dfewyfkdcbzdc.suqxkfubpnhazlpchg", "token_type": "bearer", "expires_in": 900 }

however, when create setexpresscheckout request using paypal nvp request this:

pwd=xxxxxx& signature=yyyyyy& user=zzzzzz& itemamt=123.00& cancelurl=https%3a%2f%2fwww.google.com& amt=123.00& desc=price& l_desc0=price& returnurl=http%3a%2f%2flocalhost%3a8080%2fpaypal%2fdopayment%3frateid%3d1901& l_amt0=123.00& identityaccesstoken=a015vitdabshwd.dfewyfkdcbzdc.suqxkfubpnhazlpchg& method=setexpresscheckout& l_qty0=1& currencycode=eur& version=106.0

i right express checkout token, paypal user session not kept , screen this. if log in can finish payment defeats purpose of seamless checkout. should able extend session 1 hr using refreshed access tokens.

note don't have problem when utilize first access token returned alongside refresh token , seamless checkout works fine during 15 minutes access token lasts.

java paypal

rest - How to set multiple header key value pair in java for jersy client? -



rest - How to set multiple header key value pair in java for jersy client? -

in test code, need send request using jersy client 2.7 in java. need set multiple headers of web request. e.g.

header1 12

header2 abc

in current working implementation request getting formed mentioned below. wherein setting authorization token in header using function

public void setauthorizationtoken(string authorizationtoken) { this.token = authorizationtoken; } response = webresource.request(mediatype.application_json) .header("authorization", this.token).post(entity.entity(jsonstring, mediatype));

i checked there method headers (multivaluedmap < string,object > headers) set multiple header kv pairs.

but did not how utilize it.

i have set header key value pair other function (say setheader()) add together more headers in request mentioned above.

can please allow me know how can it?

you can set header value : clientresponse response = resource.type(mediatype.application_json) .header("headerkey1", headervalue1) .header("headerkey2", headervalue2) .header("headerkey3", headervalue3) .post(clientresponse.class, otherrequestdata); , in service : string headervalue1= request.getheader("headerkey1"); string headervalue2= request.getheader("headerkey2"); string headervalue3= request.getheader("headerkey3");

rest

javascript - Append and Load from an array -



javascript - Append and Load from an array -

i'm pretty new javascript , jquery in general , i've been working on script 3 days now. searched around solution wasn't able find yet. guess search skills suck.

so, i'm trying load element multiple pages , append them existing div. example, have page called test.php has <div id="container"> in it. have multiple other pages called:

pizzas.php pies.php apples.php oranges.php mangos.php etc

these pages i'll pulling info load test.php. each of listed pages has <div id="about"> somewhere in it.

users send me string of pages they'd load through text field fill out. take , split it. using array, i'd create div's each string in array. i'm @ far, assuming user has requested info pizzas, pies, , apples:

<script> var str = "pizzas,pies,apples"; var test = str.split(","); $.each(test, function(i,v){ $('#container').append('<div id="' + v + '"></div>'); }); </script>

which yields:

<div id="container"> <div id="pizzas"></div> <div id="pies"></div> <div id="apples"></div> </div>

after creating new div's, want load #about each page corresponding div. thought adding each loop, doesn't work:

$( '"#' + v + '"' ).load( "index.php?x=" + v + " #about" ); //like $("#pizzas").load('index.php?x=pizzas #about');

and that's stuck. anyway, i'd appreciate help on this.

it looks can utilize after you've created divs:

$("#container > div").each(function() { $(this).load("index.php?x=" + this.id + " #about"); });

or, in in 1 shot this:

var str = "pizzas,pies,apples"; var test = str.split(","); var container = $('#container'); $.each(test, function(i,v){ $("<div></div>", {id: v}).appendto(container) .load("index.php?x=" + v + " #about"); });

javascript jquery arrays jquery-load jquery-append

checkbox - Jquery selection and disabling multiple checkboxes by passing data attributes -



checkbox - Jquery selection and disabling multiple checkboxes by passing data attributes -

i trying dynamic checkbox selection going. actual code retrieves values database create id's hardcored values question.

if select section 1, cat 1 , sub cat 1 should checked. if select cat 1, sub cat 1 should checked.

i seem missing somewhere can't spot it!

http://jsfiddle.net/h4zln/

jquery:

$(function() { $("input[type=checkbox]").change(function() { var section_list = $(this).data().section_list; var cat_id = $(this).data().cat_id; if ($(this).hasclass("category_all")) { var all_list = $("input.category_all[type=checkbox]:checked").length; $(".all_select").prop("checked", all_list).prop("disabled", all_list); } else if ($(this).hasclass(section_list+"_list")) { var section_sub_list = $(this).data().section_sub_list; var main_list = $("input."+section_list+"_list[type=checkbox]:checked").length; $("."+section_sub_list+"_sub_list").prop("checked", main_list).prop("disabled", main_list); } else if ($(this).hasclass("cat_id_"+cat_id)) { var sub_cat_id = $(this).data().sub_cat_id; var list = $("input.cat_id_"+cat_id+"[type=checkbox]:checked").length; $(".sub_cat_id_"+sub_cat_id).prop("checked", list).prop("disabled", list); } }); });

html:

<input type="checkbox" class="category_all">all<br><br> section<br> <input type="checkbox" data-section_list = "1" class="all_select 1_list">1 <input type="checkbox" data-section_list = "2" class="all_select 2_list">2 <input type="checkbox" data-section_list = "3" class="all_select 3_list">3 <br><br>cat<br> <input type="checkbox" data-section_sub_list = "1" data-cat_id = "1" class="all_select 1_sub_list cat_id_1">1 <input type="checkbox" data-section_sub_list = "2" data-cat_id = "2" class="all_select 2_sub_list cat_id_2">2 <input type="checkbox" data-section_sub_list = "3" data-cat_id = "3" class="all_select 3_sub_list cat_id_3">3 <br><br>sub cat<br> <input type="checkbox" data-sub_cat_id = "1" class="all_select 1_sub_list sub_cat_id_1">1 <input type="checkbox" data-sub_cat_id = "2" class="all_select 2_sub_list sub_cat_id_2">2 <input type="checkbox" data-sub_cat_id = "3" class="all_select 3_sub_list sub_cat_id_3">3

you need alter lastly 2 if() conditions.

in case of cat need info attribute section_list , not section_sub_list. section not have attribute - section_sub_list

in case of subcat need info attribute cat_id , not sub_cat_id. cat not have attribute - sub_cat_id

working demo $(function () { $("input[type=checkbox]").change(function () { var section_list = $(this).data().section_list; var cat_id = $(this).data().cat_id; if ($(this).hasclass("category_all")) { var all_list = $("input.category_all[type=checkbox]:checked").length; $(".all_select").prop("checked", all_list).prop("disabled", all_list); } else if ($(this).hasclass(section_list + "_list")) { var section_sub_list = $(this).data().section_sub_list; var main_list = $("input." + section_list + "_list[type=checkbox]:checked").length; $("." + section_list + "_sub_list").prop("checked", main_list).prop("disabled", main_list); } else if ($(this).hasclass("cat_id_" + cat_id)) { var sub_cat_id = $(this).data().cat_id; var list = $("input.cat_id_" + cat_id + "[type=checkbox]:checked").length; $(".sub_cat_id_" + sub_cat_id).prop("checked", list).prop("disabled", list); } }); });

jquery checkbox

How can i add elements to the middle of pre existing 2D Arrays in java? -



How can i add elements to the middle of pre existing 2D Arrays in java? -

i have array list declared such:

arraylist<arraylist<string>> info = new arraylist<arraylist<string>>;

i have filled inner array list strings parsed out of text file. later add together of array lists database.

after first parse through , add together info inner array list, want go in , add together additional info can't found in files parsing.

here code have tried not working:

void specialoperations(arraylist<arraylist<string>> data) { for(arraylist<string> sub: data){ string ip = sub.get(0); //system.out.println(sub.get(0)); sub.add(1,ip); } }

in example, first element in row ip address. trying add together same exact ip address sec element , force rest of info right. (there 2 of same ip addresses next each other). plan on padding ip address later want added first.

i know before send 2d arraylist "specialoperations" filled valid data, because can loop through , prints out right data, know not issue of empty data.

edit: have not used many other info types lists other array lists before. i've used hash maps , tree maps not much. if not right approach explain how utilize different one?

edit2: question auto linked says mine answered doesnt reply mine. know how add together middle. think there wrong how i'm implememnting 2d arraylist.

have @ this method of linkedlist:

inserts specified element @ specified position in list. shifts element @ position

i think need.

one more thing:

<arraylist<arraylist<string>> info = new arraylist<arraylist<string>>;

is bit strange. must

arraylist<arraylist<string> info = new arraylist<arraylist<string>>();

java arrays 2d

html - How to change css of class under specific id -



html - How to change css of class under specific id -

i have html want alter css of active class under abc_7 id.please help me.

<label id="abc_7" data-ng-repeat="cell in timecell" class="btn btn-default btnsmall active" style="width: 77px;"> </label>

i have write

#abc_7 .active{ background-color: greenish !important; }

but not working because find active class in #abc_7 lable please help me.

you're specifying kid instead of element had id , class.

it should be: (note, no space between id , class)

#abc_7.active{ background-color: green; }

html css html5 css3

java - using mustache templates with jersey -



java - using mustache templates with jersey -

i want integrate mustache-based templates bailiwick of jersey 2.

in pom.xml have:

<dependency> <groupid>org.glassfish.jersey.ext</groupid> <artifactid>jersey-mvc-mustache</artifactid> <version>2.9</version> </dependency>

my resource class looks this:

@path(value = "/appstatus") public class appstatuschecker { @template(name = "/index.mustache") @get public context getstatus() { homecoming new context(4); } public static class context { public integer value; public context(final integer value) { this.value = value; } } }

in web.xml have this:

<init-param> <param-name>jersey.config.server.mvc.templatebasepath.mustache</param-name> <param-value>/templates</param-value> </init-param>

and when app deployed, under web-inf/classes have folder templates index.mustache inside. content is:

<!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>simple mustache test</title> </head> <body> <h1>this mustacheee</h1> {{value}} </body> </html>

what see after calling myapp/appstatus url is: {"value":4} expect html. there of import part of setup missing?

i had register provider like:

final resourceconfig rc = new resourceconfig().property( mustachemvcfeature.template_base_path, "templates" ).register( mustachemvcfeature.class ).packages("com.example"); homecoming grizzlyhttpserverfactory.createhttpserver(uri.create(base_uri), rc);

not sure if using grizzly. but, maybe help someone.

https://jersey.java.net/documentation/latest/mvc.html#mvc.registration

java template-engine mustache jersey-2.0

Replace only last occurrence of match in a string in VBA -



Replace only last occurrence of match in a string in VBA -

i have string

"c://documents/testuser/www/help/files/move_help.txt"

and have replace move_help.txt move_job.txt

i using below code in vba excel

str = "c://documents/testuser/www/help/files/move_help.txt" rlpstr = replace(str, 'help', 'job')

i getting

"c://documents/testuser/www/job/files/move_job.txt"

expected

"c://documents/testuser/www/help/files/move_job.txt"

can please help on this.

fyi : can't match move_help move_job (move_ not constant. can string)

there's one-line solution this:

rlpstr = strreverse(replace(strreverse(str), strreverse("help"), strreverse("job"), , 1))

technically, it's less efficient combining instr , replace can used within look if need to. also, one-line solutions long they're not incomprehensible.

string vba excel-vba replace

How to convert hexadecimal word to signed integer in python 2-7? -



How to convert hexadecimal word to signed integer in python 2-7? -

i trying write method converting hexadecimal words signed integers. want utilize python 2-7. in python3 can following

def word2int(hex_str): ba = bytes.fromhex(hex_str) homecoming int.from_bytes(ba,byteorder='big',signed=true)

however, neither of these methods (i.e. fromhex , from_bytes) defined in python 2-7. there nice , simple methods of doing in python 2-7?

use int convert unsigned integer, , manually convert signed.

def word_to_int(hex_str): value = int(hex_str, 16) if value > 127: value = value-256 homecoming value

python-2.7 python-3.x

What is the jQuery procedure of appending to a string instead of replacing it? -



What is the jQuery procedure of appending to a string instead of replacing it? -

i converting of raw javascript codes jquery , encounter lines goes -

divrecentnames.innerhtml += "something";

i'm trying utilize .html() method, replace existing value new one.

divrecentnames.html("something");

what jquery equivalent of appending new string existing one?

$('#elementid').append("this append");

official document append method demo http://jsfiddle.net/zuz36/

jquery string append

swing - Java code cannot find resource file after build and clean in Netbeans IDE? -



swing - Java code cannot find resource file after build and clean in Netbeans IDE? -

i need help solve own problem. now, i'm dealing little code app. in project folder contain resource files (*.xlsx, *.png,...). placed them in current folder code file. wonder when run code in netbean ide, worked find.

after build code project, jar file in "dist" directory. run it. open since app used jframe user interface. however, when execute function of app, showed me error log. here error message:

java.io.filenotfoundexception: src\sample.xlsx (the scheme cannot find path specified)

what's matter out there?

here pieces of code:

copyfile(new file("src\\sample.xlsx"), new file(txtout.gettext()+"\\sample.xlsx"));

node: copyfile function used re-create file source dest.

here project folder construction in netbean ide:

project name source pakage(src) myclass.java, sample.xlsx, etc

first, never reference src directly, directory not exist 1 time programme built. second, can not access resources have been embedded within in application context via file reference, no longer exist on file system.

instead, need utilize class#getresource or class#getresourceasstream

url url = getclass().getresource("/sample.xlsx"); inputstream = getclass().getresourceasstream("/sample.xlsx"); // don't forget manage streams appropriately...

java swing netbeans file-io

node.js - Apparently I deleted some of the files on the node_module, how can I restore them? -



node.js - Apparently I deleted some of the files on the node_module, how can I restore them? -

i trying install node trough brew , giving lot of errors, , apparently file not giving permission, thunked file other failed seek intall node , decide remove directory. failed remove dir , files, apparently had been erased.

they are: module.js:340 throw err; ^ error: cannot find module 'child-process-close' @ function.module._resolvefilename (module.js:338:15) @ function.module._load (module.js:280:25) @ module.require (module.js:364:17) @ require (module.js:380:17) @ /usr/local/lib/node_modules/npm/lib/npm.js:15:1 @ object. (/usr/local/lib/node_modules/npm/lib/npm.js:461:3) @ module._compile (module.js:456:26) @ object.module._extensions..js (module.js:474:10) @ module.load (module.js:356:32) @ function.module._load (module.js:312:12)

how can solve this? wanted seek sails.js fun, didn't see fun time yet, problems.

thank you

i know super late. however, getting same error while trying react native app , running.

i installed node homebrew , after getting following:

error: cannot find module 'child-process-close' @ function.module._resolvefilename (module.js:336:15) @ function.module._load (module.js:278:25) @ module.require (module.js:365:17) @ require (module.js:384:17) @ /usr/local/lib/node_modules/npm/lib/npm.js:15:1 @ object.<anonymous> (/usr/local/lib/node_modules/npm/lib/npm.js:520:3) @ module._compile (module.js:460:26) @ object.module._extensions..js (module.js:478:10) @ module.load (module.js:355:32) @ function.module._load (module.js:310:12)

i ran brew postinstall node , got:

permission denied - /usr/local/lib/node_modules/npm/authors

so ran:

sudo brew postinstall node

and seemed work fine. go installing waterline, firebase, or whatever else tried.

hope helps!

node.js sails.js

visual studio 2010 - WiX Toolset: File extensions registering asking for feature install on different user -



visual studio 2010 - WiX Toolset: File extensions registering asking for feature install on different user -

i having problem wix installation in registering file extension because have tie every component feature, can't feature install "all users"?

specifically happening install msi under admin account. msi not located in shared location accessible users. extension appears register other users when other users click on file (with newly registered extension) open it, tries original msi first install feature. if msi found open installed application normal, otherwise errors. admin business relationship installed msi, not inquire install feature msi (even if delete msi before clicking on file extension)

i have set installlevel of features "1" , set typicaldefault "install" , installdefault "local". bundle set install @ machine level.

is there else needs set?

see if helps: troubleshooting unwanted self-repairs using event viewer

basically need understand why repair happening (which component key path ) , remediate it. alternatively wrap msi exe (wix burn) , cache msi in location users can access if repair needed.

visual-studio-2010 wix windows-installer

javascript - AngularJS weird error when creating simple directive -



javascript - AngularJS weird error when creating simple directive -

i'm trying create simple directive in angularjs , don't understand why code below gives me next error:

error: [$compile:tplrt] http://errors.angularjs.org/undefined/$compile/tplrt?p0=tawithmessage&p1=custombutton.html

the code is:

<!doctype html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.0/angular.min.js"></script> <script> var app = angular.module('aaa', []); app.directive("tawithmessage",function() { homecoming { templateurl: "custombutton.html", replace: true }; } ); </script> </head> <body> <div ng-app="aaa"> <script type="text/ng-template" id="custombutton.html"> <p>blah <em>blah<em>blah</em></em> blahhello, <h2>kkk</h2> <input type="text" placeholder="enter name here" ng-keypress="valid=true"/></p> </script> <form> <div ta-with-message></div> <input type="submit"> </form> </div> </body> </html>

what don't understand works when replace h2 span e.g.:

<p>blah <em>blah<em>blah</em></em> blahhello, <span>kkk</span> <input type="text" placeholder="enter name here" ng-keypress="valid=true"/></p>

does have display of element? why happening , how prepare it?

this page of angularjs error reference should help you:

error: $compile:tplrt: invalid template root further explanation auto-closing <p> tag

first (non-working) illustration in question contains slight html markup error.

why? because <p> allows phrasing content within it. heading tags not phrasing content. when browser sees non-phrasing-content (for example, heading) tag within <p>, implicitly adds </p>.

not putting </p> before <h2> not error, it's allowed html specs:

the end tag may omitted if <p> element followed <address>, <article>, … <h1>, <h2>, <h3>, … or <p> element, or if there no more content in parent element , parent element not <a> element.

but in end first illustration in question interpreted browser this:

<p>blah <em>blah<em>blah</em></em> blahhello,</p> <h2>kkk</h2> <input type="text" placeholder="enter name here" ng-keypress="valid=true"/>

note how </p> changed position after <input> before <h2>.

incompatible directive template

this makes such directive template incompatible, because has more 1 root element. angularjs docs linked above, directive template must have content within single top-level tag. however, first illustration after browser interpretation turns out have 3 top-level tags.

when alter <h2> <span> illustration ok, since <p> doesn't auto-close anymore (<span> phrasing content).

what can do

wrap template in <div>. unlike <p>, can contain type of content. :)

javascript html angularjs angularjs-directive

GWT:how to display a popup at the poistion of the key pressed -



GWT:how to display a popup at the poistion of the key pressed -

i trying display word suggestion list when ctl+space entered in eclipse. need know location user has entered ctrl+space can display suggestion list exact below word user entered.

i see ways mouse cursor position , isnt there way keyboard button pressed position , writing within textarea, tried getcursor, gives me no of word on user entered ctrl+space. not location per window.

any thought

thanks

there no reliable, accurate , cross-browser way textarea.

you can experiment richtextarea (you don't have provide toolbar rich text features) , getformatter().inserthtml() method. insert new html element @ cursor position. can insert list of suggested words, can style anyway like, or can insert empty div , seek show panel relative it.

or can utilize different ui approach. create panel fixed position relative textarea , show suggested words there - similar way smartphone keyboards show suggested words above keyboard itself. 1 time users realize suggested words show in same place, may design better.

gwt

web services - Javasctipt post function in to PHP function. Post to webservice -



web services - Javasctipt post function in to PHP function. Post to webservice -

i have been asked turn below javascript function in php function.

i have never been asked , have been struggling lot , may have wrong terminology in relation soap/webservices etc apologies confusion.

var varvalidationcode = "validationcode"; var email = document.getelementbyid('email').value; //alert(email); $.ajax( { url: 'http://www.domain.com/file.asmx', type: "post", data: "{email:'" + email + "',validationcode:'" + varvalidationcode + "'}", datatype: "json", contenttype: "application/json; charset=utf-8", cache: false, success: function(data) { alert(data.d); }, error: function() { alert("fail"); } }); //alert("function called successfully"); }

i tried create curl function post values below, got post on stackoverflow error - "soap:receiverserver unable process request. ---> info @ root level invalid. line 1, position 1."

// here info sending service $data = array( 'email' => 'test@test.com', 'validationcode' => 'somevalidationcode' ); $curl = curl_init('http://www.domainname.com/file.asmx'); curl_setopt($curl, curlopt_post, 1); //choosing post method curl_setopt($curl, curlopt_url, 'http://www.domainname.com/file.asmx'); // set url path want phone call curl_setopt($curl, curlopt_returntransfer, true); // create info coming set string curl_setopt($curl, curlopt_postfields, $data); // insert info // send request $result = curl_exec($curl); // free resources $curl using curl_close($curl); echo $result;

the file posting looks this:

<?xml version="1.0" encoding="utf-8"?> <soap12:envelope xmlns:xsi="htt{://www.w3.org/2001/xmlschema-instance" xmlns:xds="http://www.w3.org/2001/xmlschema" xmlns:xds="http://www.w3.org/2001/05/soap-envelope"> <soap:body> <paymentvalidationinfo xmlns="http://tempuri.org/"> <email>string</email> <validationcode>string</validationcode> </paymentvalidationinfo> <soap12:body> </soap12:envelope>

i hope makes sense. help much appreciated. regards

i'm not sure if people interested managed work how wanted working below.

$url = "http://www.domain.com/webservices/ccpwebservice.asmx/method?"; $data = array( 'email' => 'email', '&validationcode' => '4946565', ); foreach($data $key=>$value) { $content .= $key.'='.$value; } $curl = curl_init($url); curl_setopt($curl, curlopt_header, false); curl_setopt($curl, curlopt_returntransfer, true); curl_setopt($curl, curlopt_post, true); curl_setopt($curl, curlopt_postfields, $content); $json_response = curl_exec($curl); $status = curl_getinfo($curl, curlinfo_http_code); /* debug purposes if(!curl_errno($curl)) { $info = curl_getinfo($curl); echo 'took ' . $info['total_time'] . ' seconds send request ' . $info['url'].'<br/><br/>'; echo "curl error no : ".curl_errno($curl); //returns 7 echo "<br />curl status : ".curl_getinfo($curl, curlinfo_http_code); //returns 0 echo "<br />curl error : ".curl_error($curl); //returns "couldn't connect host" echo "<br />strings posted: ";print_r($content); echo "<br />curl info : ";print_r($info); }*/ curl_close($curl);

if can recommend additions/best practices much appreciated. regards

php web-services curl soap

sql server - Import data into tables from an SQL file -



sql server - Import data into tables from an SQL file -

i want move info 1 db another. both source , destination database servers aren't connected cannot tasks export destination tables, far have done following.

1) tasks/generate scripts, scheme only, generated sql.

2) went destination db , opened sql file , created database schema.

3) went source database , did tasks /generate scripts time info alternative , generated sql data.

4) went destination db , tried opening sql info script of size 1.4 gb @ point getting error exception of type out of memory.

how can import info sql file?

i getting same issue , solution insert go statement every 100 lines in script file. achieved 1 line of powershell so:

gc script.sql | % {$i=0}{$i++;$_ + $(if($i % 100 -eq 0){"`ngo"}else{''})} set-content mew_script.sql

sql-server sql-server-2008

awk - Unexpected result comparing values of rows and columns in two text files -



awk - Unexpected result comparing values of rows and columns in two text files -

this related 1 of previous question: how compare values of rows , columns of 2 text files in bash?

file1.txt (with special characters: cat -vet file1.txt)

name col1 col2 col3^m$ -----------------------^m$ row1 1 4 7^m$ row2 2 5 8^m$ row3 3 6 9$

file2.txt (with special characters: cat -vet file2.txt)

name col1 col2 col3^m$ -----------------------^m$ row1 1 4 7^m$ row2 2 5 999$

i have figured out way compare 2 files. reason not giving me result want. bare me beginner. here code utilize compare files.

awk ' fnr < 2 { next } fnr == nr { (i = 2; <= nf; i++) { a[i,$1] = $i; } b[$1]; next; } ($1 in b) { (i = 2; <= nf; i++) { if (a[i,$1] == $i) printf("%s->col%d: %d vs %d: equal\n", $1, i-1, a[i,$1], $i); else printf("%s->col%d: %d vs %d: not equal\n", $1, i-1, a[i,$1], $i); } } ' file1.txt file2.txt

expected result:

row2->col1: 1 vs 1: equal row2->col2: 4 vs 4: equal row2->col3: 7 vs 7: equal row1->col1: 2 vs 2: equal row1->col2: 5 vs 5: equal row1->col3: 8 vs 999: not equal

actual result:

row2->col1: 1 vs 1: equal row2->col2: 4 vs 4: equal row2->col3: 0 vs 7: not equal row1->col1: 2 vs 2: equal row1->col2: 5 vs 5: equal row1->col3: 0 vs 999: not equal

does know why lines 3 , 6 of actual result comparing 0 (not supposed so)?

** apologies in advance cross post still have bug , can't find it

special @jaypal helping me solve problem. problem these text files created in ms-dos , had converted unix format in order executed in linux or unix environment. before executing segment of code question above, had utilize command: dos2unix file1.txt

awk scripting comparison

c - Inline-Assembly : prevent HLT from being stopped by windows -



c - Inline-Assembly : prevent HLT from being stopped by windows -

i seek asm("hlt"); on win8 windows error window prompted.

is there way maintain hlt running sometime?

unless writing device driver, can't phone call hlt. privileged instruction.

c gcc inline-assembly

javascript - Multitouch in HTML5 Canvas / DOM for AngularJS -



javascript - Multitouch in HTML5 Canvas / DOM for AngularJS -

i started creating little remote command app using angular. created joystick directive using canvas.

i wrapped in angular directive , works quite nice. can see illustration here (note: touch, no mouse events yet):

http://jsfiddle.net/wje2b/3/

what want command auto basicall means maintain joystick dragged time , additionally want command button e.g. horn. prefer using simple button here.

but handlers ng-click stop working if drag joystick around. can hear other touch events (e.g. add together joystick, works independently) on canvas , of course of study other canvas, can hear other events touch somehow? how accomplish angular / simplest way?

here code fiddle:

angular.module('myapp').directive('joystick', function() { function joystickcontroller ($scope) { } homecoming { restrict : 'e', controller : ['$scope', function ($scope) { homecoming joystickcontroller($scope); }], scope : { // using primitives here did not work, utilize object, see: http://stackoverflow.com/questions/14049480/what-are-the-nuances-of-scope-prototypal-prototypical-inheritance-in-angularjs position : '=' }, template : '<canvas class="joystickcanvas"></canvas>', link : function(scope, element) { var joystickheight = 200; var joystickwidth = 200; var center = { x : joystickheight / 2, y : joystickwidth / 2 }; var radiuscircle = 35; var radiusbound = 50; // canvas , context element var container = element[0]; var canvas = container.children[0]; var ctx = canvas.getcontext('2d'); // id of touch on cursor var cursortouchid = -1; var cursortouch = { x : center.x, y : center.y }; function resetcanvas() { canvas.height = joystickheight; canvas.width = joystickwidth; } function ontouchstart(event) { var touch = event.targettouches[0]; cursortouchid = touch.identifier; cursortouch = { x : touch.pagex - touch.target.offsetleft, y : touch.pagey - touch.target.offsettop }; } function ontouchmove(event) { // prevent browser doing default thing (scroll, zoom) event.preventdefault(); for(var = 0; < event.changedtouches.length; i++){ var touch = event.changedtouches[i]; if(cursortouchid === touch.identifier) { cursortouch = { x : touch.pagex - touch.target.offsetleft, y : touch.pagey - touch.target.offsettop }; var scalex = radiusbound / (cursortouch.x - center.x); var scaley = radiusbound / (cursortouch.y - center.y); if(math.abs(scalex) < 1) { cursortouch.x = math.abs(cursortouch.x - center.x) * scalex + center.x; } if (math.abs(scaley) < 1) { cursortouch.y = math.abs(cursortouch.y - center.y) * scaley + center.y; } scope.$apply( scope.position = { x : math.round(((cursortouch.x - center.x)/radiusbound) * 100), y : math.round(((cursortouch.y - center.y)/radiusbound) * -100) } ); break; } } } function ontouchend() { cursortouchid = -1; scope.$apply( scope.position = { x : 0, y : 0 } ); cursortouch.x = center.x; cursortouch.y = center.y; } function draw() { // clear canvas ctx.clearrect(0, 0, canvas.width, canvas.height); ctx.beginpath(); ctx.strokestyle = 'cyan'; ctx.linewidth = 5; ctx.arc(center.x, center.y, radiuscircle, 0, math.pi*2, true); ctx.stroke(); ctx.beginpath(); ctx.strokestyle = 'cyan'; ctx.linewidth = 2; ctx.arc(center.x, center.y, radiusbound, 0, math.pi*2, true); ctx.stroke(); ctx.beginpath(); ctx.strokestyle = 'cyan'; ctx.linewidth = 2; ctx.arc(cursortouch.x, cursortouch.y, radiuscircle, 0, math.pi*2, true); ctx.stroke(); requestanimframe(draw); } // check if touch enabled var touchable = true; if(touchable) { canvas.addeventlistener( 'touchstart', ontouchstart, false ); canvas.addeventlistener( 'touchmove', ontouchmove, false ); canvas.addeventlistener( 'touchend', ontouchend, false ); window.onorientationchange = resetcanvas; window.onresize = resetcanvas; } // bind values outside scope.$watch('position', function(newval) { cursortouch = { x : ((newval.x * radiusbound) / 100) + center.x, y : ((newval.y * radiusbound) / -100) + center.y }; }); resetcanvas(); draw(); } }; });

javascript html5 angularjs canvas multi-touch

objective c - Use for-loop instead of repeating -



objective c - Use for-loop instead of repeating -

xcode noob here. can please guide me how create list below done in for-loops? if possible? have working such lists takes much time , can cause error due repetition.

_monkey1.center = cgpointmake(_monkey1.center.x, _monkey1.center.y); _monkey2.center = cgpointmake(_monkey2.center.x, _monkey2.center.y); _monkey3.center = cgpointmake(_monkey3.center.x, _monkey3.center.y); _monkey4.center = cgpointmake(_monkey4.center.x, _monkey4.center.y); _monkey5.center = cgpointmake(_monkey5.center.x, _monkey5.center.y); etc.

i have started with:

for (int k = 1; k < 20; k++){ // prep? [[_monkeys objectatindex: k] setcenter: .... }

is there possible way this? other suggestions appreciated.

monkeys uiimageviews. thanks.

nsarray *monkies = @[ _monkey1, _monkey2, _monkey3, _monkey4, _monkey5 ]; (uiimageview *monkey in monkies) { monkey.center = cgpointmake(monkey.center.x, monkey.center.y); }

(note, i've assumed these objects of type monkey, might incorrect).

objective-c for-loop

node.js - Running "foreman" task Fatal error: spawn ENOENT -



node.js - Running "foreman" task Fatal error: spawn ENOENT -

running grunt on yeoman angular project resulted:

running "foreman" task fatal error: spawn enoent

log file: https://gist.github.com/kwakwak/da949e17a99367acfc7e

what meaning of this?

node.js angularjs gruntjs yeoman foreman

java - I cannot acces modelmap values in my JSP page -



java - I cannot acces modelmap values in my JSP page -

i refactoring code , ended deleting bean altogether. modelmap values getting passed correctly , displayed on jsp page presence of bean. however, pulling info straight database, cannot access values on jsp page though info getting read correctly.

i have like:-

public string viewdata(@modelattribute("") modelmap model) { connection conn = null; resultset rs = null; string driver = "com.mysql.jdbc.driver"; statement statement = null; try{ class.forname(driver); conn = drivermanager.getconnection("jdbc:mysql://localhost:3306/testing1234","root","root"); statement = conn.createstatement(); string sql = "select * testdata"; rs = statement.executequery(sql); while (rs.next()) { model.addattribute("test", rs.getstring(1)); model.addattribute("test1", rs.getstring(2)); model.addattribute("test2", rs.getstring(3)); model.addattribute("test3", rs.getstring(4)); model.addattribute("test4" ,rs.getdate(5)); } } grab (sqlexception e) { e.printstacktrace(); } grab (classnotfoundexception e) { e.printstacktrace(); }finally { seek { if (rs != null) { rs.close(); } if (statement != null) { statement.close(); } if (conn!= null) { conn.close(); } } grab (sqlexception e) { e.printstacktrace(); } } homecoming "jsppage"; }

however, in jsp page when seek accessing ${test}, empty string. there alternate way around this, can display info on jsp page?

spring handles handler method arguments handlermethodargumentresolver interface. implementation handles @modelattribute, servletmodelattributemethodprocessor, has higher priority (is registered before) implementation handles modelmap, mapmethodprocessor.

what means spring create modelmap object , set model key "". can access attribute empty key jsp , access elements through (the nested attributes add together resultset).

the best solution imo rid of @modelattribute annotation method parameter.

java jsp spring-mvc

datetime - Get system clock/time in C# without using any objects? -



datetime - Get system clock/time in C# without using any objects? -

i'm developing application in c# requires many function calls (100-1000 per second) happen @ specific times. however, there extremely tight specs on latency of application, , due latency increment associated garbage collection, it's not feasible me utilize datetime or timer objects. there way can access scheme time primitive type, without having create datetime objects?

tl;dr: there analogue java's system.currenttimemillis() c#?

what makes think datetime allocates objects? it's value type. no need heap allocation, , no need garbage collection. (as tomtom says, if have hard latency requirements, you'll need real-time operating scheme etc. if have "low" latency requirements, that's different matter.)

you should able utilize datetime.now or datetime.utcnow without issues - utcnow faster, doesn't perform time zone conversions.

as example, time 100 1000000 calls datetime.utcnow , using hour property, , on laptop takes 3.5 seconds. using ticks property (which doesn't involve much computation) takes 1.2 seconds. without using property, takes 1 second.

so if you're performing 1000 calls per second, it's going irrelevant.

c# datetime time

python - Shortening HTML files -



python - Shortening HTML files -

is there library (preferably python one) shortens html page? mean produce perchance smaller (in terms of number of characters, including line breaks <- think length of string) html page rendered same original one?

for instance:

<b> silly illustration </b>

could changed to:

<b>silly example</b>

and final result same:

silly example

you can utilize beautifulsoup prettify (not minify) html or xml code in python.

from bs4 import beautifulsoup soup = beautifulsoup('file.html') prettified = soup.prettify(encoding="utf8")

for minifying html in python can utilize htmlmin. more parameters htmlmin.minify can found in documentation.

import htmlmin open('file.html', 'r') f: content = f.read() minified = htmlmin.minify(content, remove_empty_space=true)

python html

php - String not works with special chars -



php - String not works with special chars -

after update cant rename categories. in string must fault:

if utilize

$categoryname = (!empty($categorylang[$cat_details['category_id']])) ? $categorylang[$cat_details['category_id']] : $cat_details['name']; $category_lang .= ($table_name == 'reverse_categories') ? '$reverse_category_lang' : '$category_lang'; $category_lang .= '['; $category_lang .= $cat_details['category_id']; $category_lang .= ']="'; $category_lang .= $db->rem_special_chars($categoryname); $category_lang .= '";'; $category_lang .= "\n"; }

i cant update categories special chars. if rename $categoryname $cat_details['name'], works, can update now, categories special chars not working.

anyone idea, how can split string? thx 4 ...

i don't know if $category_lang defined but, have tried define $category_lang?

$categoryname = (............. ... //define variable allow add together more text text string $category_lang = ''; // can utilize .= $category_lang .= ($table_name == 'reverse_categories') ? '$reverse_category_lang' : '$category_lang'; $category_lang .= '['; $category_lang .= $cat_details['category_id']; $category_lang .= ']="'; $category_lang .= $db->rem_special_chars($categoryname); $category_lang .= '";'; $category_lang .= "\n"; } // <-- } part of function x(){ ?

php mysql string replace special-characters

scala - Can't resolve jar library in InteliJ when adding to libraries in SBT project -



scala - Can't resolve jar library in InteliJ when adding to libraries in SBT project -

i want add together apache commons library scala project. before moving sbt worked adding library or global library setting within intelij project. moved sbt doesn't resolve anymore , i'm getting errors.

how add together local jar library sbt dependency within intelij?

you need create sure sbt able find dependency. follow standard way of adding unmanaged dependencies project described here. citing reference:

unmanaged dependencies

most people utilize managed dependencies instead of unmanaged. unmanaged can simpler when starting out.

unmanaged dependencies work this: add jars lib , placed on project classpath. not much else it!

you can place test jars such scalacheck, specs, , scalatest in lib well.

dependencies in lib go on classpaths (for compile, test, run, , console). if wanted alter classpath 1 of those, adjust dependencyclasspath in compile or dependencyclasspath in runtime example.

there’s nil add together build.sbt utilize unmanaged dependencies, though alter unmanagedbase key if you’d utilize different directory rather lib.

to utilize custom_lib instead of lib:

unmanagedbase := basedirectory.value / "custom_lib"

basedirectory project’s root directory, here you’re changing unmanagedbase depending on basedirectory using special value method explained in more kinds of setting.

there’s unmanagedjars task lists jars unmanagedbase directory. if wanted utilize multiple directories or else complex, might need replace whole unmanagedjars task 1 else.

to test if works run sbt externally (outside of intellij cmd) , execute update or compile tasks. if library used in code , no errors sbt happy. afterwards utilize "import project" in intellij , select "use auto-import" alternative in 1 of wizard steps.

scala sbt

javascript - Is there any way to store xml string into cookie? -



javascript - Is there any way to store xml string into cookie? -

is possible store xml string cookie via javascript?

i tried store xml,

var xml = response; document.cookie = xml;

and did read cookey

var x = document.cookie; alert(x);

i expecting whole xml document, store first tag.

<?xml version="1.0"?>

is there way store whole xml document? lot...

javascript xml

linux - RHEL mysql cannot connect through the socket, permissions and locations are set properly, curious about the reasons -



linux - RHEL mysql cannot connect through the socket, permissions and locations are set properly, curious about the reasons -

i had problem on weekend. mysql started giving "can't connect local mysql server through socket '/var/lib/mysql/mysql.sock'" error on weekend.

as suggested, checked location of socket file, , in right spot.

then checked permission of folders, , set 0755.

then checked disk space , there plenty of it.

then performed graceful server restart. solved problem.

my question, these given, can cause issue? our production server , need due diligence root of prevent happening.

edit:

i not attempting resolve issue, attempting investigate cause.

my.cnf has set:

datadir=/var/lib/mysql socket=/var/lib/mysql/mysql.sock

thank you.

the lastly time ran issue, able around setting host parameter (-h127.0.0.1).

i'm not sure why worked though, or rather, i'm not sure specific configuration issues lead it. there can different mysql.sock files @ same time, or in unexpected places (for example, on lastly work machine accidentally had 3 instances in different directories).

mysql linux

How to maintain timezones in multi datacenter replication of mysql -



How to maintain timezones in multi datacenter replication of mysql -

we want new set of multi-datacenter replication mysql, placed in 2 different time zones. in scenario, right maintain single time zone in datacenters or not?

you should utilize utc ie. timestamp can used displaying right time accordig timezone.

whenever referring particular moment in time, persist time according unified standard not affected daylight savings. gmt , utc have been mentioned different people, though utc seems mentioned often. ?? include local time offset (including dst offset) when storing timestamps. ?? store timestamps utc or epochs(number of seconds since 1970) without time zone or offset. include original time zone name, can reconstruct original time @ later point , display right offsets if needed.

please refer below link, helpful

daylight saving time , time zone best practices

mysql

haskell - Symbolic name as type constructor -



haskell - Symbolic name as type constructor -

sorry, newbie's question haskell...

what have utilize infix-symbol type constructor? i've found next piece of code, ghc , ghci complain "unexpected type `~>' type variable expected"...

class category (~>) (.) :: (a ~> b) -> (b ~> c) -> (a ~> c) id :: ~>

how can done? lot in advance!

as of ghc 7.6, all typeoperators constructors. i'm not sure why is, guess breaking alter avoid breaking older code. more info in mailing list.

haskell

Attach a pre-exising SQLite database in Android -



Attach a pre-exising SQLite database in Android -

this question has reply here:

how ship android application database? 11 answers

i have sqlite database created , has info in it.

now want attach database existing tables , keys without changes android application , utilize it.

most of samples sqlite databases in android involve creating database in application, like link. database file exists.

after searching, found this link database attachment isn't clear , don't understand should set database file , how phone call attachment query it.

just utilize sqllite asset helper

it's best lib out there serves purpouse. wrote blogpost preloading sqllite info (and other stuff) here

android database sqlite

How to prevent sbt from running a task multiple times in a session? -



How to prevent sbt from running a task multiple times in a session? -

i'd prevent next task getting run multiple times when sbt running:

val mytask = somesettings map {s => if !s.isdone dosomethingandsettheflag}

so what's expected when mytask run first time, isdone false , gets done in task, , task sets flag true. when task run sec time, since isdone flag true, skips actual execution block.

the expected behavior similar compile -> when source compiled, task doesn't compile code 1 time again next time it's triggered until watchsource task says code has been changed.

is possible? how?

this done sbt, task evaluated 1 time within single run. if want have value evaluated once, @ project load time, can alter settingkey.

this documented in sbt documentation (highlighting mine):

as mentioned in introduction, task evaluated on demand. each time sampletask invoked, example, print sum. if username changes between runs, stringtask take different values in separate runs. (within run, each task evaluated @ once.) in contrast, settings evaluated 1 time on project load , fixed until next reload.

sbt