Posts

Showing posts from June, 2013

android - Creating File With String Object -

im writing socket program send , receive strings. im trying build file using received strings sending other side. done text files in others such image file doesn't work , when complete, image not open! in receiver: file = new file(dir,filename); fout = new fileoutputstream(file); dos = new dataoutputstream(fout); and when msg received: dos.write(msg.getbytes("utf-8")); in sender: file file = new file(filepath); inputstream = new fileinputstream(file); inputstreamreader isr = new inputstreamreader(is); ... isr.read(inputbuffer); i have tried solution problem didn't fixed: changing utf-8 iso-8859-1 using output stream writer instead of data output stream. trying smaller pictures text file. bytearrayoutputstream useful converting bitmap byte array. after then, using bitmapfactory, decodebytearray converting byte bitmap.

sql - How to link these two tables with the entity relationship model? -

if have 2 entities, "courses" , "course_offerings", , both have key called "course number" , how relate these 2 entities? relationship table not make sense because mapping same course number same course number, redundant. leaving them unlinked seems wrong. correct way er model? what er diagram like?

javascript - Flip toggle switch (jQuery) on change not firing -

i need fire event (which sends post data external script) when state of toggle switch changes, cannot basic example work... can please tell me doing wrong? html: <label for="flipswitch">option:</label> <select name="flipswitch" id="flipswitch" data-role="slider"> <option value="off">off</option> <option value="on">on</option> </select>` javascript (in <head> section): <script> $('#flipswitch').change(function(){ console.log("flipswitch"); }); </script> the code works me. sure you're looking @ console output? have code in $('document').ready(function() { )};

java - Replace backslash with forward slash -

this question has answer here: string not replacing characters 4 answers how replace backward slash forward slash using java? 3 answers i have following path: com/teama/merc/test/restest , want convert this: com\teama\merc\test\restest i trying append above path path: c:\users\toby\git\mercury\mercury\ str.replace('/', '\\'); when append both of strings together, output: c:\users\toby\git\mercury\mercury\com/teama/merc/test/restest here code in question: string home = system.getproperty("user.dir"); path.replace('/', '\\'); system.out.println(path); string folder = home + file.separatorchar + path; system.out.println(folder); file file = new file(folder); if(file.isdirectory()) { system

java - Read from file inside Eclipse Project -

Image
i want make application splits big text file inside inputfolder several small xml files put inside outputfolder . this project outline: the following code works fine when comes getting file outside folder, when modified read folder inside project, gave me error: exception in thread "main" java.lang.nullpointerexception @ com.zakaria.cut.xmlcutter.cut(xmlcutter.java:45) @ com.zakaria.cut.main.main(main.java:8) [xmlcutter.java] package com.zakaria.cut; import java.io.bufferedreader; import java.io.file; import java.io.fileinputstream; import java.io.fileoutputstream; import java.io.ioexception; import java.io.inputstreamreader; import java.io.outputstreamwriter; import java.text.messageformat; import java.util.logging.consolehandler; import java.util.logging.handler; import java.util.logging.level; import java.util.logging.logger; public class xmlcutter { private static final string output_file_name = "/file"; //private static string user_home =

java - Openfire VOIP Client, How To Use Media Proxy -

i developed voip app on android device. lacks of acrossing wlan capability. 1 udp connection established between 2 client phone in same lan. 2 phone client communicated via ipv4 address directly. i'm wandering how talk each other on wlan? maybe stay behind firewall. talked openfire has media proxy functionality agent transfer data. cannot find example of feature. please give me advice? much. sincerely. i assume have implemented jingle client. in order make work should make sure that: openfire (acting media proxy well) running on computer public ip, each client behind nat can "talk" it your client media engine support symmetric rtp to enable media proxy in openfire simple going openfire server web console (usually @ openfirehost:9090/index.jsp), select tab "media services", set option "enabled" @ "media proxy settings" , click on "save settings". ps: openfire version 3.9.1

Javascript undefined, truthy vs typeof operator -

considering following code: //the var test has not been declared yet console.log((typeof test)); // "undefined" console.log(test); //"uncaught referenceerror: test not defined" why second console.log statement throw referenceerror , first displays undefined. because test undefined. in first console.log you're asking system tell type of variable. looks through current scope chain find reference variable may infer type. when doesn't find variable, receives undefined primitive. has type, i'm sure you've guessed, of undefined . the second time you're asking print out value of undefined variable. since variable not defined (there no reference in current scope chain), error you're trying access data doesn't exist, not infer type.

php - Encoding and corrupted characters appearing -

i having trouble corrupted characters appearing on form. have code in notepad++. seen in following image happens when code encoded utf8 without bom. http://i.stack.imgur.com/ggxyd.png http://puu.sh/7pbgq.png second image happens when saved utf8. however, follow problems. warning : session_start() [function.session-start]: cannot send session cache limiter - headers sent (output started @ /home/.../event.php:1) in /home/.../validation.php on line 6 event.php starts off like: <?php require 'validation.php'; require 'member_header.php'; require 'member_header_vevent.php'; ?> <html> <head> <!-- utf-8 recommended encoding pages --> <meta http-equiv="content-type" content="text/xml; charset=utf-8" /> <title>special event</title> <link rel='shortcut icon' href='images/vyico.ico'> validation.php starts off like: <?php $page_title = "validation"; //

Javafx 8 3d Heightmap from TriangleMesh -

Image
just made little app , wanted share ... i took code several samples , adapted suit needs can source here: github source here couple screenshots ya ... if find interesting or useful or want improve it... feel free or so! edit: ok, seems on images introduce lot of lag, tried implementing timeline push of processing gpu.. (i believe thats how works).. can think of better way create update thread ? timeline defaulttimeline = new timeline(); defaulttimeline.getkeyframes().addall(new keyframe(new duration(14 - (system.currenttimemillis() % 14)), (actionevent t) -> { timeline everysecond = new timeline(); everysecond.setcyclecount(timeline.indefinite); everysecond.getkeyframes().addall(new keyframe(duration.valueof(14 + "ms"), (actionevent event) -> { update(); })); everysecond.play(); system.err.println("playing"); })); defaulttimeline.play(); and update m

database - connect to sql server 2005 -

this question has answer here: can't connect localhost on sql server express 2012 / 2016 9 answers i've been trying connect sql server 2005 on localhost , can not connect... server name textbox empty , tried type different names doesn't work , choose authentication =sql server authentication i receive following message: title: connect server cannot connect localhost\sqlexpress. additional information: property login not set. ( microsoft.sqlserver.express.connectioninfo ) should type in server name textbox??? please alot.. if server name (textbox) empty, probably, may have installed sql server incorrectly.... i think have same problem guy, check thread: how find server name sql server 2005

html - VS2012: Page inspector/"view in browser" won't work -

i new website development, , having trouble viewing webpage in browser. when try open webpage in page inspector/ choose "view in browser" following error. page inspector: "the attached page not running in compatible internet explorer standards mode. use latest document mode add following meta tag html page: <meta http-equiv="x-ua-compatible" content="ie=edge" > try dynamically add meta tag session click here." view in browser: "uh-oh, went wrong! error code: 500" i've tried adding meta tag source html , still doesn't work. also, following step-by-step tutorials on youtube, doing same, yet still won't work. if open asp.net webforms site can view in browser, i'm having trouble viewing them when start empty website form. hope makes sense , thank you.

class - How to fix error C2511: overloaded member function not found in C++? -

i have problem pass own class parameter. here codes: payloadcontainer.h namespace project { namespace c { namespace helper { class payloaditem { public: string key; string value; char type; char mode; char isarray; int fieldcount; char fieldtype; int rowcount; }; class payloadcontainer { public: payloadcontainer( const char *command ); payloadcontainer(void); ~payloadcontainer(void); public: vector<payloaditem> payloaditems; }; } } } parsebinary.h namespace project { namespace c { namespace helper { class parsebinary { public: parsebinary(void);

javascript - How to use Jasmine spies on an object created inside another method? -

given following code snippet, how create jasmine spyon test confirm dosomething gets called when run myfunction ? function myfunction() { var foo = new mycoolobject(); foo.dosomething(); }; here's test looks like. unfortunately, error when spyon call evaluated: describe("myfunction", function () { it("calls dosomething", function () { spyon(mycoolobject, "dosomething"); myfunction(); expect(mycoolobject.dosomething).tohavebeencalled(); }); }); jasmine doesn't appear recognize dosomething method @ point. suggestions? when call new mycoolobject() invoke mycoolobject function , new object related prototype. means when spyon(mycoolobject, "dosomething") you're not setting spy on object returned new call, on possible dosomething function on mycoolobject function itself. you should able like: it("calls dosomething", function() { var originalconstructor

java - Heroku App Crashing with NoClassDefFoundError: org/eclipse/jetty/server/Handler -

i trying run app on heroku. doing ci on travis , deploying it. code @ https://github.com/santoshkt/cdetsd123 when went through logs in heroku, see following 2014-03-10t03:14:08.180220+00:00 heroku[web.1]: starting process command `j ava $java_opts -cp target/classes:target/dependency/* mytest.main` 2014-03-10t03:14:10.692378+00:00 app[web.1]: picked java_tool_options: -djav a.rmi.server.usecodebaseonly=true -djava.rmi.server.usecodebaseonly=true 2014-03-10t03:14:11.217814+00:00 app[web.1]: exception in thread "main" java.lan g.noclassdeffounderror: org/eclipse/jetty/server/handler 2014-03-10t03:14:11.286992+00:00 app[web.1]: caused by: java.lang.classnotfounde xception: org.eclipse.jetty.server.handler 2014-03-10t03:14:11.287150+00:00 app[web.1]: @ java.net.urlclassloader$1.run (urlclassloader.java:217) 2014-03-10t03:14:11.287380+00:00 app[web.1]: @ java.net.urlclassloader.findc lass(urlclassloader.java:205) 2014-03-10t03:14:11.287271+00:00 app[web.1]: @ jav

mouseevent - Get mouse pointer without connecting usb mouse in android -

hi writing application sending mouse movements server client application via wifi using http.here client application runs in smartphone , server runs in smart stick can connect stick monitor.the server os android.i want control the mose movements smart phone want use smart phone mouse. problem getting mouse movements , can send server.for mouse cursor know can connecting usb mouse want know there way mouse pointer without connecting usb mouse. thanks help..

java - Android App has unfortunately stopped Error -

i've started build first android app , 1st time errors bugging me since 2 days. finding no solution had come here. have been following androids official tutorial first app , can't open app. error: "unfortunately "app name" has stopped" here manisfest file, <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="app2.android" android:versioncode="1" android:versionname="1.0" > <uses-sdk android:minsdkversion="17" android:targetsdkversion="19" /> <application android:allowbackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/apptheme" > <activity android:name="mainactivity" > <intent-filter> <action android:name="android.intent.action.main" /> <category android:nam

javascript - Alert filtered words using Jquery -

i have this jsfiddle . i have words which, when user types them, needs alerted user. right when type line, example, i love ants alerts me full line i love ants , want ants alerted me. (in example ants word need filtered. refer jsfiddle.) var filter = ['ants', 'words'], reg = new regexp("(" + filter.join("|") + ")", "g"); $('#texta').keyup(function(){ $("#dest").html( $(this).val().replace(reg, "<mark>$1</mark>") ); if(reg.test($(this).val())==true) { alert($(this).val()); } }); you can change show matched part using this: alert($(this).val().match(reg)); here's jsfiddle . if want separate alert each match have loop. edit: here's version alerts once each time user types word in list. edit: , here's version demonstrates optional use of regexes instead of words. note slashes must double-escaped. so, ex

php - mysql error 1064 when changing structure of date from datetime to VARCHAR -

there issue when try change structure of 1 of table in mysql user db table , has many fields , 1 of them register date field it set datetime , trying change varchar using phpmyadmin best way know using limited mysql / phpmyadmin expertise. alter table abnhd_user change registerdate registerdate varchar not null default '0000-00-00 00:00:00' when try change datetime varchar, following error #1064 - have error in sql syntax; check manual corresponds mysql server version right syntax use near 'not null default '0000-00-00 00:00:00'' @ line 1 you executed query alter table abnhd_user change registerdate registerdate varchar not null default '0000-00-00 00:00:00' but mysql doesn't have default value '0000-00-00 00:00:00' varchar use below sql change varchar alter table abnhd_user modify registerdate varchar(30);

c - Segmentation Fault when getting the max of three numbers in Assembly x86 -

i trying max of 3 numbers using c call method in assembly 32 bit @ & t. when program runs, segmentation fault(core dumped) error , cannot figure out why. input has been mix of positive/negative numbers , 1,2,3, both same error result. assembly # %eax - first parameter # %ecx - second parameter # %edx - third parameter .code32 .file "maxofthree.s" .text .global maxofthree .type maxofthree @function maxofthree: pushl %ebp # old ebp movl %esp, %ebp # skip on movl 8(%ebp), %eax # grab first value movl 12(%ebp), %ecx # grab second value movl 16(%ebp), %edx # grab third value #test first cmpl %ecx, %eax # compare first , second jl firstsmaller # first smaller second, exit if cmpl %edx, %eax # compare first , third jl firstsmaller # first smaller third, exit if leave # reset stack pointer , pop old base pointer ret # return since first > second , first > third firstsmaller: # first smaller second or third, res

database - When should use 3NF design in data warehouse field -

i have 1 confusion 3nf design , dimensional design in data warehouse field. i don't want cause quarrel between inmon , kimball's idea, dimensional design causes less time query , easy understand, don't know when normalized design should used, give me detail example using normalized design better denormalized one? in understanding, data warehouse built query, should order more read write, more query insert, i'd know when should use normalized model, lot. i creating data-warehouse should have denormalized schema. optimise selects, allows better reporting using bi, cubes, star schemas etc. warehouses reporting puposes need better performance selects on inserts/updates. needs able store historic data on dimensions such time. you normalize data model , use 3nf when working operational database. has updates, inserts, deletes , selects. not want have duplicate data stored make data consistancy difficult maintain.

Does assigning a function handler in JavaScript create a copy or just a reference? -

i'd make sure can use function handler without generating copy every time assigned handler. i have class handler such as: snapwebsites.editor.prototype._someprivatefunctionhandler = function(e) { ... } then read blob file received drag & drop: ... .on("drop", function(e) { // [...snip...] -- have tests , loop through files , // on each file: r = new filereader; r.onload = snapwebsites.editor.prototype._someprivatefunctionhandler; r.readasarraybuffer(e.originalevent.datatransfer.files[0]) } ... when assign _someprivatefunctionhandler function onload handler of filereader, creating full copy of function or reference? you creating reference. demonstrate: var xyz = function() {}; var abc = xyz; xyz.someproperty = 1; abc.someproperty; /=> 1

multithreading - How to use keyboard keys in background when application is minimized in JAVA -

i working in java application requires - keys pressed user in separate txt file. - keys in background when application minimized. i have no idea how working in following code. public class keychecker1 extends jframe { public static jlabel keylabel = new jlabel("hit key"); public keychecker1() { super("hit key"); keymonitor1 monitor = new keymonitor1(this); addkeylistener(monitor); setfocusable(true); setvisible(true); } public static void main(string[] arguments) { new keychecker1(); } } class keymonitor1 extends keyadapter { keychecker1 display; public static thread t1key, t2; keymonitor1(keychecker1 display) { this.display = display; } public void keypressed(final keyevent event) { t1key = new thread() { @override public void run() { try {

3d - Cesium Cartesian3 creating instance and getting into it's method -

i have point: point: n x: 1250625.1650299462 y: -5015983.5669022305 z: 3730748.0432948116 and i'm trying create cartesian3 instance from point = new cesium.cartesian3(point.x, point.y, point.z) but not right since can't access add method of cartesian3... randomoffset suppose new cesium.cartesian3 instance, i'm getting 'n' result object 'new cesium.cartesian3'. point = point.add(randomoffset) what doing wrong here? i got it.. incredibly silly question! static means access directly cesium.cartesian3.add(first_cartesian3, second_cartesian3) without using instance.

Android: Top and bottom padding of text in listview item -

Image
i developing application in using custom list view. xml code follows : <?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@drawable/loginbg" > <relativelayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_margin="15sp" android:background="@android:color/white" > <listview android:id="@+id/listview" android:layout_width="fill_parent" android:layout_height="fill_parent" android:divider="#000000" android:dividerheight=".5sp" > </listview> </relativelayout> </relativelayout>

android - send raw image or binary data directly to the other application -

i ask if there possibility send raw data other application? example: taking pictures custom camera , send other application. observe using intent sending data saved storage, want let 2nd application decided either save image or discard. in tutorial of on how make custom camera in instance, 1 application running , startactivityforresult , listener onresultactivity. in case, want custom camera, pass raw data other application , let other application manage raw image receive. call raw image because image in buffer , not on storage. possible pass raw image/data other application? you need save file , pass uri file via intent. uri image = uri.parse(filename); intent myintent = new intent(intent.action_view, image); myintent.settype("image/*"); intent chooserintent = intent.createchooser(myintent, "open image"); startactivity(chooserintent);

Android ExpanableListView getChildView does not get called -

i working on following code. contains multiple expandable listview. works fine except getchildview of subchild not called. getting groupcount, groupview, , childcount correctly. import java.util.arraylist; import java.util.hashmap; import java.util.list; import com.vera.r.color; import com.vera.navdrawer.navdraweritem; import android.content.context; import android.content.res.typedarray; import android.graphics.color; import android.graphics.typeface; import android.util.log; import android.view.layoutinflater; import android.view.view; import android.view.view.onclicklistener; import android.view.viewgroup; import android.widget.baseexpandablelistadapter; import android.widget.expandablelistview; import android.widget.imageview; import android.widget.relativelayout; import android.widget.textview; import android.widget.expandablelistview.onchildclicklistener; import android.widget.expandablelistview.ongroupclicklistener; import android.widget.expandablelistview.ongroupcollapse

Get Combine Records from SQL SERVER with Distinct and comma Separated columns -

Image
i have 3 tables. group extension extention_group (is middle table having groupid , extensionid reference ids) i have 3 queries i'm using right now, query getting distinct items extention_group table on basis of groupid select distinct groupid extention_group order groupid query getting required required columns tables select g.id groupid, g.name groupname, eg.extentionid [group] g inner join extention_group eg on eg.groupid = g.id inner join userprofile on eg.extentionid = up.userprofileid and query getting extensions csv (comma separated values) select substring( (select ',' + up.extension userprofile order up.extension xml path('')),2,200000) csvextension what want combine of these results single table. how can combine these 3 results in 1 single table, can use easily. have tried unions no success. it can combine this, select g.id groupid, g.name groupname, up.extension, eg.extentionid ,stuff((select ',' + up.ext

web services - How to use the User Defined Datatypes found in the WSDL file in our java code? -

i trying consume remote web service using wsimport tool. generates necessary client side code. in found return type of method user defined using xml complex type. how can use complex types in java code. here code try import net.restfulwebservices.servicecontracts._2008._01.weatherforecastservice; import net.restfulwebservices.servicecontracts._2008._01.iweatherforecastservice; import com.microsoft.schemas._2003._10.serialization.arrays.arrayofstring; public class weatherforecastclient { public static void main(string args[])throws net.restfulwebservices.servicecontracts._2008._01.iweatherforecastservicegetcitiesbycountrydefaultfaultcontractfaultfaultmessage { try { weatherforecastservice wf=new weatherforecastservice(); iweatherforecastservice iw=wf. getbasichttpbindingiweatherforecastservice(); arrayofstring as=new arrayofstring(); as=iw.getcitiesbycountry("us"); system.out.printl

uitableview - iOS7 UITapGestureRecognizer method is not called -

i working on uipickerview multi selection in ios7 , used uitapgesturerecognizer multi selection. in ios6 working fine in ios7 toggleselection: (uitapgesturerecognizer) method not called. so please give me idea or suggestion resolve issue. please see below code. - (uiview *)pickerview:(uipickerview *)pickerview viewforrow:(nsinteger)row forcomponent:(nsinteger)component reusingview:(uiview *)view { uitableviewcell *cell = (uitableviewcell *)view; if (cell == nil) { cell = [[uitableviewcell alloc] initwithstyle:uitableviewcellstyledefault reuseidentifier:nil]; [cell setbackgroundcolor:[uicolor clearcolor]]; [cell setbounds: cgrectmake(0, 0, cell.frame.size.width -20 , 44)]; uitapgesturerecognizer *gesturerecog = [[uitapgesturerecognizer alloc] initwithtarget:self action:@selector(toggleselection:)]; [gesturerecog setdelegate:self]; gesturerecog.numberoftapsrequired = 1; [gesturerecog.view setbackgroundcolor:[ui

Bootstrap session timeout - reset counter on mousemove -

bootstrap's session timeout plugin doesn't seem support resetting count towards session end, whenever user moves mouse. so, instance, default 15 mins warnafter value pop message 15 mins afters login, regardless of user activity. $.sessiontimeout({ logouturl:appdata.paths.apppath + "/logout", redirurl:appdata.paths.apppath + "/logout", warnafter:10000 // trigger popup after 10 secs regardless of user activity }); i haven't found option might tackle issue. there way overcome it? checkout orange hill's fork created because of same problem. http://www.orangehilldev.com/?p=101 https://github.com/orangehill/bootstrap-session-timeout

Issue on Install Dual Boot Android and Ubuntu Touch on Nexus-4 -

i trying install ubuntu on nexus-4 follow https://wiki.ubuntu.com/touch/dualbootinstallation . when execute ./dualboot.sh full it's responding connect device install ubuntu installer to. . checked adb device, showing device online. more on: according android debug bridge ..adb wait-for-device wait untill device not online. anyway able access adb shell log. that's mean device online. why not respoding device status..any idea/suggestion, if missing something?? usb-debugging must enabled. therefor have tab buildno several times until developer. afterwards go developer menu , enable usb-debugging

Supervisord with django writing separate logs for each program -

i'm using supervisord (through django-supervisor thin wrapper around supervisor) run multiple processes django installation. problem logs written supervisord log file (in example out.log) instead of different log files. the conf file (cleaned up): [supervisord] logfile=/var/log/server/ourserver/out.log [rpcinterface:supervisor] supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface [supervisorctl] serverurl=unix:///var/run/supervisor.sock ; use unix:// url unix socket [program:webserver] command=uwsgi uwsgi.ini stout_logfile = /var/log/server/ourserver/django.log redirect_stderr = true ;autostart = true ;autorestart = true [program:celery] command=celery worker -b -a server.celery --loglevel=info --concurrency=4 ;autostart = true ;autorestart = true stout_logfile = /var/logs/server/ourserver/celery.log redirect_stderr = true [program:updater] command=python -u updater.py ;directory=/home/ubuntu/server/ourserver ;autostart = true ;autores

c++ - Compilation error when moving to Qt5 : 'Type' has not been declared -

use qt 5.2.1 compile old qt project (maybe created qt 4.8): lan messenger open source: #ifndef qtsingleapplication_h #define qtsingleapplication_h #include <qapplication> class qtlocalpeer; #if defined(q_ws_win) || defined(q_os_win32) # if !defined(qt_qtsingleapplication_export) && !defined(qt_qtsingleapplication_import) # define qt_qtsingleapplication_export # elif defined(qt_qtsingleapplication_import) # if defined(qt_qtsingleapplication_export) # undef qt_qtsingleapplication_export # endif # define qt_qtsingleapplication_export __declspec(dllimport) # elif defined(qt_qtsingleapplication_export) # undef qt_qtsingleapplication_export # define qt_qtsingleapplication_export __declspec(dllexport) # endif #else # define qt_qtsingleapplication_export #endif class qt_qtsingleapplication_export qtsingleapplication : public qapplication { q_object public: qtsingleapplication(int &argc, char **argv, bool guienabled = true); qtsingleappli

html - How to keep content on page on new page load -

i want know, how can page reload while loading page keep conten on page visiable. in real senario, google or facebook load new page or chages part of page(not using ajax) there header or footer not change means stick page , visible through-out process page load start , end. can tell me how has done? well, examples don't reload page. load new content ajax, while loading can execute scipts , display current content. after can append new blocks page , change url using html5 history api.

vb.net - How can i retrieve date time available per second in one day? -

my input date. but, i'm stuck on how retrieve date time in every second. need put each second date time in 2d array.so array(0,0) should equal 2/10/2014 00:00:00 , array(86399,0) equal 2/10/2014 23:59:59 pm. i tried looping per below code: dim twodarray(86399, 1) string dim dtinput date dtinput= #2/10/2014# i=0 86399 twodarray(i, 0) = dtinput dtinput = dtinput +second 'i know not right next i don't know how increase date time every second in right way. please help. have thought along lines of using datetime (msdn datetime ) dtinput= new datetime(2014,10,2) i=0 86399 twodarray(i, 0) = dtinput dtinput = dtinput.addseconds(1) next or dtinput= new datetime(2014,10,2) i=0 86399 twodarray(i, 0) = dtinput.addseconds(i+1) next

node.js - Remove csrf protecteion on API post calls -

i remove csrf express 3.0 application don't need there. use oauth validate clients. middleware whitelist api urls when using express.csrf()? you can in 2 ways. 1.) create small middleware of own allow white list url patterns not blocked csrf like; var express = require("express"); var expresscsrf = express.csrf(); var app = express.createserver(); var customcsrf = function (req, res, next) { // assume exact match, can use regex match here var csrfenabled = true; var whitelist = new array("/pattern1/param1","/pattern2/param2","/pattern3/param3"); if (whitelist.indexof(req.path) != -1) { csrfenabled = false; } if (csrfenabled) { expresscsrf(req, res, next); } else { next(); } } app.use(customcsrf); app.listen(3000); 2.) use csrf middleware on controllers want enable. example, want use csrf check on profile save controller; app.post("/profile/save", express.csrf(), function(req, r

c# - How do I get a const string from Web.config? -

for authorization in entity framework application, i've written class check's whether current user in specified role. public class authorizedesignatedroles : authorizeattribute { public const string delete = system.configuration.configurationmanager.appsettings["groupauthorizedfordeleteaction"].tostring(); public string designatedroles { get; set; } protected override bool isauthorized(system.web.http.controllers.httpactioncontext actioncontext) { bool isauthorizedbase = base.isauthorized(actioncontext); if (!isauthorizedbase) return false; string[] roles = designatedroles.split(';'); // multiple roles can seperated semicolon ; foreach (string role in roles) { if (system.web.security.roles.isuserinrole(role)) return true; } return false; } } now can allow controller actions carried out use

Trying to use doubles in C++. Not sure where I'm going wrong -

so i'm writing program takes input , tries input 1 either dividing 2 if it's even, or multiplying 3 , adding 1. it's giving me error when try compile it: bigbeno37@vm-0:~/github2$ g++ numbergenerator1.cpp numbergenerator1.cpp:1:2: warning: #import deprecated gcc extension [-wdeprecated] numbergenerator1.cpp: in function ‘int main()’: numbergenerator1.cpp:13:5: error: ‘inputnumberclone’ not declared in scope numbergenerator1.cpp:16:26: error: invalid operands of types ‘double’ , ‘int’ binary ‘operator%’ numbergenerator1.cpp:19:26: error: cannot convert ‘int(int (*)(void*), void*, int, void*, ...)throw ()’ ‘double’ in assignment numbergenerator1.cpp:24:26: error: cannot convert ‘int(int (*)(void*), void*, int, void*, ...)throw ()’ ‘double’ in assignment this code #import <iostream> using namespace std; int main(){ cout << "please enter number: " << endl; double inputnumber = 0; double inputernumberclone = 0; double stepsclone =

sql - PHP, Oracle and ODBC: How to check if result set is empty? -

dear nerds , forumianers, i have delicious problem php on oracle database odbc driver. first code: $ora_conn = odbc_connect($ora_dsn, $ora_user, $ora_pass, sql_cur_use_odbc); $ora_data = odbc_exec($ora_conn,$sql); //echo "test: ".odbc_num_rows( $ora_data ); //exit; if(odbc_num_rows( $ora_data ) > 0){ // in case no result came } if($ora_data){ // in case result came } if uncomment test, -1! no matter if statement results in 0, 1 or 5 rows... so code never can information if there no result, 1 result or more results coming back. do have idea on how solve issue? thank very in advance help! best regards, ingmar odbc_num_rows seems reliable insert, update, , delete queries only. the manual says: using odbc_num_rows() determine number of rows available after select return -1 many drivers. one way around behaviour count(*) in sql instead. see here example.