Posts

Showing posts from April, 2012

php - My MySQL database is not updating? -

i'm trying update datebase php archive can't: before ask: names db written correctly , if works too... <?php if(isset($_get["ans"]) && isset($_get["name"])) { include("con.php"); $con = con(); $answer = $_get["ans"]; $nam = $_get["name"]; if($answer="firefly" ||$answer="firefly" ||$answer="firefly") { $le=2; $sc=50; $update = "update user set level='$le', score='$sc' name = '$nam'"; mysql_query($update,$con); // header("location: lv1b.php?n=$nam"); } else { echo "try again..." ; } } ?>* this con.php... <?php function con() { $server="localhost"; $user="root"; $pass=""; $con= mysql_connect($server, $user,$pass); mysql_select_db("games"); return $con; } your if statement assigning values, not testing

java - Fragment compatibility issues: -

i following tutorial on android website on how have button switch fragment. receiving conflict between android.support.v4.app.fragment , android.app.fragment . tried changing fragments on page 1 or other seams both needed process although isn't possible. to elaborate, first thing has create fragment manager so: fragmentmanager fragmentmanager = getfragmentmanager(); the problem have down line line of code wants android.support.v4.app.fragment while default generated 1 on brand new activity android.app.fragment . tried switching default generated 1 on , gives me different conflict. helpful if show me or link me tutorial present fragment class use. if you're using import android.support.v4.app.fragment; import android.support.v4.app.fragmentmanager; must use getsupportfragmentmanager(); instead of getfragmentmanager(); . source: http://developer.android.com/reference/android/support/v4/app/fragmentactivity.html

c# - Read from a txt file and write to a disconnected recordset -

i have reached point of confusion when researching topic... i have read fixed-length text file , write disconnected recordset in c#. i'm following example: public static recordset createdisconnectedrecordset() { var rs = new recordset(); // create new recordset // add updatable fields rs.fields.append( "name", datatypeenum.advarchar, 20, fieldattributeenum.adfldupdatable, missing.value); rs.fields.append( "country", datatypeenum.advarchar, 20, fieldattributeenum.adfldupdatable, missing.value); rs.open( missing.value, missing.value, cursortypeenum.adopenunspecified, locktypeenum.adlockunspecified, 0); // add data rs.addnew(missing.value, missing.value); rs.fields["name"].value = "anders"; rs.fields["country"].value = "sweden"; rs.update(missi

Program extraction using native integers/words (not bignums) from Isabelle theory -

this question comes in context isabelle used formal software development in mind more pure maths theorization in mind (and standalone developer's context). seems @ best, sml programs generated isabelle theory, use sml's intinf.int , not native integer type, int.int ; if code_target_int , code_binary_nat or code_target_nat used. investigation of these theories sources seems confirm it's can do. native platform integers may required multiple reasons, including efficiency , case sml imperative program optionally translated imperative language subset (ex. c or ada), relevant when theory relies on imperative_hol theory. codegen.pdf document comes isabelle distribution, did not it, except in suggesting first of options below. options may be: not using isabelle's int , nat , re‑create new numeric type scratch, use code_printing commands (with type_constructor , constant ) give native platform representation , operations (implies inclusion of range limitation

Uploading Image to Google Form Errors -

i've been struggling this. very new writing code, bear me. i want create form file submission parsers responses google spreadsheet , places file specific folder in my gdrive, not uploader's gdrive . i've have tried debugging , asking around, no 1 can seem figure out error or how place uploaded files own folder, can have access them/see them. here link code: https://script.google.com/d/appid/edit?usp=sharing i can't figure out what's wrong. here can offer simple script copy fileupload in folder wish , write value textfield sheet. it written simple can give first steps. copy code in scripts file , run google apps script. before run scripts have change in code uloadfolder id , id sheet. find own id's when browse these elements in googledrive , read id's urlpath in browser. function doget() { var app = uiapp.createapplication(); var text_lbl = app.createlabel('text: *'); var text = app.createtextbox().

python - Multiple monitors with Kivy -

i'm looking @ using kivy create program needs display window on each monitor, there way accomplish this? i'd prefer not have single window spanning across. if not, there (good looking, windows/linux) gui toolkit can accomplish this? you can have 2 separate windows running 2 separate kivy apps controlling/communicating each other via osc/twisted/... 1 "app" instance limited 1 app window process. can launch process(subprocess.popen) has new window though.

hyperlink - How to Modify url in php.. i want to add some extra text at the end of output url -

$this->settings[''].'extractvideoid($groups[2]).'&type=download" target="_blank"class="vidscrab"title="download video">download here code , result http://vidscrab.com/getvideo.php?videoid=yyukp7spj1y i want add words after link eg &type=download i need output http://vidscrab.com/getvideo.php?videoid=yyukp7spj1y&type=download please help i think need this $("a").click(function() { $(this).prop("href", $(this).prop("href") + "&type=download"); });

mysql - Add FULLTEXT index to Primary Key -

i need run search query through fulltext index mechanism. now faced issue, 1 of columns in above search query primary key, should add fulltext index it? any suggestion appreciated...

cordova - Best approach to store pages for an offline application -

this first mobile application experience. client of ours has requested developing application displays static data website in mobile application. planning use phonegap. the application contain listings (ex: city attractions list) , pages (city attraction page). should use database or export pages html? suggestions? from wikipedia : phonegap applications use html5 , css3 rendering, , javascript logic what mean have 2 possibilities, whether client's data in application meant modified without application update or not. since cannot determine information gave in question, i'm going detail answer each case. if client's data not need updated (without update of application) in case, consider client's data static. provenance of data not relevant, include in application data, other text or image (or other asset), before distributing application. means listings of client tied application, , modifying them require update application. technically mea

cryptography - What crypto algorithms does Android support? -

i have been googling hours , cannot find solid answers lots of hearsay. does know documentation defines encryption/signature/hash algorithms android os supports. i have heard forums not phones support same algorithms looking common algorithms every android phone supports. try list security providers: provider[] providers = security.getproviders(); (provider provider : providers) { log.i("crypto","provider: "+provider.getname()); set<provider.service> services = provider.getservices(); (provider.service service : services) { log.i("crypto"," algorithm: "+service.getalgorithm()); } } update here list nexus s (os 2.3.4): provider: androidopenssl algorithm: sha-384 algorithm: sha-1 algorithm: sslv3 algorithm: md5 algorithm: ssl algorithm: sha-256 algorithm: tls algorithm: sha-512 algorithm: tlsv1 algorithm: default provider: drlcertfactory algorithm: x509 provider: bc algorithm: pkcs

java - Maven ArtifactNotFoundException troubleshooting -

problem: i'm trying google protocol buffers dependencies work. no result. maven can't pull protocol buffers dependencies. question1: understand dependency absent in standard maven repositories, need indicate repositories. am right? question2: if answer first question yes, how can url of repository? here reference maven dependency. error: [error] plugin com.google.protobuf.tools:maven-protoc-plugin:0.3.2 or 1 of dependencies not resolved: failure find com.google.protobuf.to ols:maven-protoc-plugin:jar:0.3.2 in http://repo.maven.apache.org/maven2 cached in local repository, resolution not reattempted until u pdate interval of central has elapsed or updates forced -> [help 1] org.apache.maven.plugin.pluginresolutionexception: plugin com.google.protobuf.tools:maven-protoc-plugin:0.3.2 or 1 of dependencies not resol ved: failure find com.google.protobuf.tools:maven-protoc-plugin:jar:0.3.2 in http://repo.maven.apache.org/maven2 cached in local repository, res ol

Using a C++ dll from C# - not getting expected results -

int jpeg_codec_api jpeg_decompress(unsigned char *jpeg_buf, unsigned long jpeg_len, eimage_s** * img); * @param jpeg_buf [in] jpeg buffer * @param jpeg_len [in] jpeg buffer length * @param img [out] decompress data internal struct eimage_s { public byte[] imagedata; public int image_size; public int width; public int height; public int widthstep; }; i declared this; [dllimport("jpeglib.dll", callingconvention = callingconvention.cdecl)] internal static extern int jpeg_decompress(byte[] jpeg_buf, uint jpeg_len, ref intptr img); eimage_s obj = (eimage_s)marshal.ptrtostructure(ptr, typeof(eimage_s)); when call ptrtostructure, give error "managed debugging assistant 'fatalexecutionengineerror' has detected problem". i'm not sure wrong! you can, , should, remove unsafe keyword. not necessary here. the firs

c - The use of "if (strcmp(URL, "/") == 0)" in Arduino network sketches -

i'm trying understand "if (strcmp(url, "/") == 0)" line in arduino sketch below (see sendmypage function halfway down): #include <wiserver.h> #define wireless_mode_infra 1 #define wireless_mode_adhoc 2 #define aref_voltage 5 const int tmppin = a0; int tmpreading = 0; // wireless configuration parameters ---------------------------------------- unsigned char local_ip[] = {192,168,31,199}; // ip address of wishield unsigned char gateway_ip[] = {192,168,1,1}; // router or gateway ip address unsigned char subnet_mask[] = {255,255,255,0}; // subnet mask local network const prog_char ssid[] progmem = {"mercury_7f3f70"}; // max 32 bytes unsigned char security_type = 3; // 0 - open; 1 - wep; 2 - wpa; 3 - wpa2 // wpa/wpa2 passphrase const prog_char security_passphrase[] progmem = {"11163127"}; // max 64 characters // wep 128-bit keys // sample hex keys prog_uchar wep_keys[] progmem = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x

c# - Can a python callback call a .NET method? -

i've got beaglebone black running debian, 480x272-pixel cape (touch screen) attached. i'm using wicd wired/wireless interface, because has nice python/gtk-based solution ready end users set various network configurations. the problem end users not have access physical keyboard, in order enter wifi settings, need virtual keyboard. my main project mono-based (c#), , i've got virtual keyboard written in gtksharp (c#). can call other c# project files fine, can't open python module. i call wicd client with: private void callwicddialaog() { process proc = new process { startinfo = new processstartinfo { filename = "/usr/bin/wicd-client", arguments = "-n", useshellexecute = false, redirectstandardoutput = false, createnowindow = true } }; proc.start(); } this starts python process i

r - How to insert output into command line / function -

i have output ("1b" "2b" "3b" ... "40b") values inserted function further calculations. prepping values following code. # delete column names names(profile.ab) <- null # insert comma between values (profile.ab<-sub("([[:digit:]]{1,1})$", "\\1,", profile. ab)) # remove comma last item profile.ab [50] = "2" # remove quotations noquote(profile. ab) # delete leading bracketed numbers cat(profile.ab, "\n") at point cutting , pasting laborious task. need list redirected function automatically. thank you

mysql - Match value in multiple rows -

i have table 3 columns. image ppid cpid 1st_image.jpg 10395 10019 1st_image.jpg 10395 10371 1st_image.jpg 10395 10311 2nd_image.jpg 10395 10019 2nd_image.jpg 10395 10371 how can select 1st_image.jpg ppid 10395 , cpid 10019, 10371 , 10311? basically, want select image if cpids match because spread on several rows, cannot select them simple statement. edit: forgot explicitly mention 2nd_image.jpg should not selected because not match cpid's (10019, 10371, 10311) select image mytable ppid=10395 , cpid in (10019, 10371 , 10311)

Does the aiohttp Python library in Windows support HTTPS? -

when make https request using aiohttp library asyncio , python 3.4 in windows 7, request fails notimplementederror in _make_ssl_transport function in base_events.py shown in traceback. on windows, use proactoreventloop. think have use 1 asyncio work. tried same request in debian 7 vm compiled version of python 3.4, , same request works. don't use proactoreventloop in debian, default though. any ideas or workarounds? or, should give aiohttp https on windows now? not able use linux project, needs on windows.

ios - UIWebView Login form and Dismiss modal -

i using oauth2 log instagram. this, need webview, loads webpage login fields , login button. how detect if login button pressed in webview can dismiss modal webview presented in? is there way catch request after press login in webview? can use isviewloaded? i use detect whether user logins successfully: - (bool)webview:(uiwebview *)webview shouldstartloadwithrequest:(nsurlrequest *)request navigationtype:(uiwebviewnavigationtype)navigationtype { nsstring *urlstr = login_ok_url; nsstring *urlstr1 = login_ok_url_1; if([urlstring hasprefix:urlstr] || [urlstring hasprefix:urlstr1]){ // login successfully, dismiss view } else if ([urlstring hasprefix:url_login_cancel] == 1 || [urlstring isequaltostring:url_logout_cancel]) { // user presses cancel button, dismiss view } // processing login page return yes } detect login button pressed: how intercept button click inside uiwebview on ios?

azure - How to get web role input endpoint in worker role? -

we have azure application, has worker role , web role, , worker role has know web role address exposed outside. that's because, web role include web api worker role can use, need know url address of web role. any way that? you should role , roleinstance , roleinstanceendpoint classes in microsoft.windowsazure.serviceruntime namespace. using these should able find ip address , port of role instances.

python - Moving a Sprite Back and Forth in pygame -

i have sprite going on end of screen other, want go , forth forever. ideas? u = 1 #u x coordinate if u < 430: #480 window siz, want stop @ 430 u += 5 # move 5 should add whole code easier? you can use delta variable: delta = 5 u = 1 and have adjusted switch directions: u += delta if u >= 430: delta = -5 elif u < 50: delta = 5

How to avoid hanging wget in bash -

i have .sh script that, among other things, wgets currency exchange rates google follows: printf 'bash: going exchange rates' echo wget -qo- "http://www.google.com/finance/converter?a=1&from=usd&to=aud" | sed '/res/!d;s/<[^>]*>//g' > exrates wget -qo- "http://www.google.com/finance/converter?a=1&from=usd&to=jpy" | sed '/res/!d;s/<[^>]*>//g' >> exrates wget -qo- "http://www.google.com/finance/converter?a=1&from=usd&to=hkd" | sed '/res/!d;s/<[^>]*>//g' >> exrates wget -qo- "http://www.google.com/finance/converter?a=1&from=usd&to=nzd" | sed '/res/!d;s/<[^>]*>//g' >> exrates wget -qo- "http://www.google.com/finance/converter?a=1&from=usd&to=eur" | sed '/res/!d;s/<[^>]*>//g' >> exrates wget -qo- "http://www.google.com/finance/converter?a=1&from=usd&to=gbp&q

amazon web services - Connecting to AWS EC2 Win8 Instance from Ubuntu with Remmina -

i'm real beginner in subject. job wants me connect our server on aws - have created win8 server there. i have dns, username , password - thats all. understand easy if have win machine (like of workers here) i'm running ubuntu 12.04. how on earth connect instance? dns have is: ec2-<server>.eu-west-1.compute.amazonaws.com do need remmina or can terminal? i'd connect server, , see gui version of server's desktop. if linux server it'd enough me connect console, windows figure need gui... when try putting dns,username,password in remmina message: unable connect rdp server <server>.eu-west-1.compute.amazonaws.com do need know else server? need .pem key? - i've read posts , written check/delete in ~/.freerdp/certs file - file doesn't exist on computer, when ls in ~/.freerdp/ directory -> empty. please don't know how connet remote server, , sadly couldn't find info on connection ubuntu win8 on aws. bonus help: how ins

javascript - upload form file with ajax -

this question has answer here: is possible use ajax file upload? 7 answers i want upload file , save on server jquery ajax. i've tried didn't work. doesn't want process it. do: html code <form action="" method="post" enctype="multipart/form-data"> <input type="file" name="submit_file" id="submit_file" required > <input type="text" name="submit_message" id="submit_message"> </form> <a href="javascript:upload();" ><img src="img/join_btn.png" /></a> validation , ajax <script type="text/javascript"> function upload() { var $submit_file = $("#submit_file").val(); var $submit_message = $("#submit_message").val();

symfony - Symfony2, Trailing slash -

i'm facing issue don't know how solve. have route: www.mysite.com/news/{news} on local machine, don't have problem accessing it, on live-server trailing slash gets added, , ofc route doesn't exist = error. why slash added? how prevent it? other routes work fine, no "/" added there. happens in app.php ... app_dev.php works fine. i've tried remove trailing slash via mod_rewrite, route doesn't work. ( fosuserbundle /register 1 ....). does know, why there's trailing slash on live-server, not on local machine? same .htacces , 000-default.conf . , stated above app_dev.php works fine well. regards

c# - How to place one form just above another in winforms? -

im creating winforms application notified every , of messages or occurrences. notification style i'm expecting of gtalk, if user sends message shows notification on bottom right of screen, , if there message user @ same time new notification window shown above previous one. new window wont overlap or eclipse older one. so far have achieved few things getting window on bottom right of screen wasnt big task using code in constructor rectangle workingarea = screen.getworkingarea(this); this.location = new point(workingarea.right - size.width, workingarea.bottom - size.height); but once form named "notify" opened @ bottom right of screen. when new notification comes overlaps previous form. there can that. missing obvious? this parent form button, creates new notification forms: public partial class parent_form : form { public static list<form> activenotifications = new list<form>(); public parent_form() { initial

c# - REST - Good design practice -

i new in windows phone development , trying write app retrieves data server , displays them user. have several resources on server, lets user, quest , activity. use restsharp lib retrieve data server. example of user: public void get(string id, lifehunt.mainpage.userready userready) { var client = new restclient(deployd.rest_url); var request = new restrequest(resource + "/{id}", method.get); request.addurlsegment("id", id); client.executeasync<user>(request, response => { if (response.statuscode == system.net.httpstatuscode.ok) { userready(callback.data); } }); } once user retrieved, call userready method passed callback , user mainpage display it. now, have repeat whole process crud (insert, get, getall, update, delete) functions users, quest , activity. means need 15 different callback methods, think not software design. the other way 1 callback method , check type of parameter passed in callb

sql server - playframework 2.X JPA to MSSQL Unable to build Hibernate SessionFactory -

i want using jpa connect mssql,using sample computer-database-jpa can access h2 sql ,but when change mssql ,it's put error message "persistenceexception: [persistenceunit: defaultpersistenceunit] unable build hibernate sessionfactory" can me thanks! my application.conf # database configuration # ~~~~~ # can declare many datasources want. # convention, default datasource named `default` db.default.driver=net.sourceforge.jtds.jdbc.driver db.default.url="jdbc:jtds:sqlserver://127.0.0.1:1433;databasename=tcgw;selectmethod=cursor:sendstringasunicode=true" db.default.user=qqqq db.default.password=qqqq #db.default.driver=org.h2.driver #db.default.url="jdbc:h2:mem:play" db.default.jndiname=defaultds applyevolutions.default=true hibernate.use_sql_comments=true my persistence.xml <persistence-unit name="defaultpersistenceunit" > <provider>org.hibernate.ejb.hibernatepersistence</provider> <non-jta-data-source>

php - How to set application version for Symfony WebProfiler? -

according this commit can set own application name , version webprofiler. i'm asking myself (and ^^) what's intended way this? /** * constructor. * * @param string $name name of application using web profiler * @param string $version version of application using web profiler */ public function __construct($name = null, $version = null) { $this->name = $name; $this->version = $version; } the collector defined in configdatacollector of httpkernel component , constructor has 2 parameters defaulting null . service configured in collectors.xml of frameworkbundle , there's no way set parameters. i've overriden collector class setting data_collector.config.class in app/config/config.yml , injecting application's version way... totally feels wrong. do miss something? the commit message says (emphasis mine): [webprofiler] added possibility override application name/version in wdt i presume way way did it, is, use

cordova - _gwt$exception : Cannot read property 'uuid' of undefined -

i working on mgwt-phonegap application. i using code: final phonegap phonegap = gwt.create(phonegap.class); phonegap.addhandler(new phonegapavailablehandler() { @override public void onphonegapavailable(phonegapavailableevent event) { //start app - phonegap ready window.alert("phonegap ready"); }}); phonegap.addhandler(new phonegaptimeouthandler() { @override public void onphonegaptimeout(phonegaptimeoutevent event) { //can not start phonegap - setup window.alert("can not start phonegap"); }}); phonegap.initializephonegap(); when using compiled code target folder, phonegap i.e assets/www folder , running phonegap application. giving me error: _gwt$exception : cannot read property 'uuid' of undefined this script using on index.html page: <script type="text/javascript" language="javascript" src="cordova.js"></script> <sc

block - Avoid people from entering my site using anonymous proxy -

avoid people entering site using anonymous proxy. possible? have wannabe hacker trying enter joomla site. joomla site has plugin warns me email every login attempt , shows me ip of computer trying enter. ip different every 5 or attempts. check similar topic joomla forum http://forum.joomla.org/viewtopic.php?f=267&t=295854 in short suggests is if(isset($_server['http_x_forwarded_for']) || ($_server['http_user_agent']=='') || ($_server['http_via']!='')){ die(" "); this code put in index.php under joomla root, right after line define( '_valid_mos', 1 ); you see more information on topic in article http://www.wikihow.com/block-proxy-servers in last one, there suggested following .htaccess rule rewriteengine on rewritecond %{http:via} !^$ [or] rewritecond %{http:forwarded} !^$ [or] rewritecond %{http:useragent_via} !^$ [or] rewritecond %{http:x_forwarded_for} !^$ [or] rewritecond %{http:pro

linux - Qemu install make failed, lost .deps/pixman-access.Tpo -

this met when install qemu-1.7.1 on ubuntu 13.04. configure right, failed in make section. the last error is making in pixman /usr/bin/perl ./make-combine.pl 8 < ./pixman-combine.h.template > pixman-combine32.h || ( pixman-combine32.h; exit 1) /usr/bin/perl ./make-combine.pl 8 < ./pixman-combine.c.template > pixman-combine32.c || ( pixman-combine32.c; exit 1) /usr/bin/perl ./make-combine.pl 16 < ./pixman-combine.h.template > pixman-combine64.h || ( pixman-combine64.h; exit 1) /usr/bin/perl ./make-combine.pl 16 < ./pixman-combine.c.template > pixman-combine64.c || ( pixman-combine64.c; exit 1) make all-am cc pixman-access.lo mv: can not get".deps/pixman-access.tpo" file status(stat): cannot file or directory make[4]: *** [pixman-access.lo] error 1 make[3]: *** [all] errot 2 make[2]: *** [all-recursive] error 1 make[1]: *** [all] error 2 make: *** [subdir-pixman] error 2 please me out of this. don't know fault is.

ajax - How to get response of Python Script in Sencha Touch? -

i have written python script named abc.py prints json array. code given below import urllib2 import json json_object={"key":"value"} print json_object the output follows: {'key': 'value'} now want retrive json in sencha touch application. making ajax call. code written below: ext.ajax.request({ url: 'resources/startup/abc.py', contenttype: 'application/json', reader: { type: 'json', }, success: function(response) { console.log(response); }, } }); but when running application, not getting json object. instead getting raw code written inside abc.py. output: import urllib2 import json json_object={"key":"value"} print json_object where doing mistake??? appreciated. this python bug. rename abc.py filename.

formula - Algorithm for this format -

i trying develop program compute tax given base salary, believe given format of income tax table have, there should formula or algorithm calculate tax given base salary. below sample format of income tax table. can lookups think algorithm or formula might best approach. annual salary monthly ranges tax due 18,000.00 0.00 1,500.00 0.00 18,060.00 1,500.01 1,505.00 0.25 18,120.00 1,505.01 1,510.00 0.50 18,180.00 1,510.01 1,515.00 0.75 18,240.00 1,515.01 1,520.00 1.00 ..... 27,960.00 2,325.01 2,330.00 41.50 --last line of first format 28,020.00 2,330.01 2,335.00 41.83 -- start of second format 28,080.00 2,335.01 2,340.00 42.33 28,140.00 2,340.01 2,345.00 42.83 i able find formula first part , working find in program can't make second part work. the formula first part below : the tax 0.25 on every 5.00 or

php - Input data from android to database in mysql -

i have code: <?php include('konek.php'); $entid=$_post['entid']; $entsender=$_post['entsender']; $enttitle=$_post['enttitle']; $entdate=$_post['entdate']; $entsagrade=$_post['entsagrade']; $entreason=$_post['entreason']; $entproblem=$_post['entproblem']; $enttime=$_post['enttime']; if($row_num != 0) { $ins=mysql_query("insert tblentry(entid,entsender,enttitle,enttime,entsagrade,entreason,entproblem) values('$entid','$entsender','$enttitle',curtime(),'$entsagrade','$entreason','$‌​entproblem')"); echo "added"; } else { echo "added."; } ?> my problem is, when input data in android simulator, not adding. problem in code? and here code in android: public class addentry extends activity { button buttonsave; edittext ent1, ent2, ent3, ent4, ent5, ent6 ; httppost httppost; httpresponse response; httpclient httpclient; li

bash - Output Shell Script Variable to HTML -

rather new coding, looking little having variable output local html file. both script , html on same machine. script pulls signal level modem , have displayed local html loading screen. signal script: #!/bin/bash modem=/dev/ttyusb3 modemcmd=at+csq { echo -ne "$modemcmd"'\r\n' > "$modem" if [ $? -eq 1 ] echo "error"; exit; fi { while read -t 1 if [[ $reply == +csq* ]] arr1=$(echo "$reply" | cut -d' ' -f2) arr2=$(echo "$arr1" | cut -d',' -f1) echo "$arr2" exit; fi done echo "error"; } <"$modem" } 2>/dev/null would output of display in table on html. thanks! when host own web server, cgi protocol allows server-side programming in any language like; including bash. here's simple example serves web page displays current date , time, , refreshes every 10 seconds. pu

asp.net - mvc pagedlist page number not incrementing -

i'm using mvc 5 along pagedlist.mvc 4.5.0.0, have data coming , displaying on table, along pager controls showing up. when click next though, pager continues send page = 1 function, see while debugging. my page has: <div class="pagedlist" data-otf-target="#contractlist"> @html.pagedlistpager(model, page => url.action("index", new { page }), pagedlistrenderoptions.minimalwithitemcounttext) </div> my method sends data action is public ipagedlist<contractviewmodel> getallcontracts(int page = 1) { var lstcontractviewmodel = new list<contractviewmodel>(); using (contractrepository contractrepos = new contractrepository(new unitofwork())) { var activecontractlist = contractrepos.all.orderbydescending(x => x.id); foreach (var activecontract in activecontractlist) { mapper.createmap<d

ruby - Paperclip Rails error when trying to refresh -

my user model: class user < activerecord::base has_attached_file :avatar, :styles => { :profile => "200x200>", :collab => "300x200>", :msg => "50x50>" }, :default_url => "missing.png" validates_attachment_content_type :avatar, :content_type => /\aimage\/.*\z/ ... i have added :msg , :profile styles , i'm trying refresh them show in views. i've tried running: rake paperclip:refresh class=user and error: rake aborted! argumenterror: wrong number of arguments (0 1) /home/jrile/rails/cs480/app/models/user.rb:44:in `hash' /home/jrile/.rvm/gems/ruby-2.1.0/gems/paperclip-4.1.1/lib/paperclip/attachment_registry.rb:42:in `names_for' /home/jrile/.rvm/gems/ruby-2.1.0/gems/paperclip-4.1.1/lib/paperclip/attachment_registry.rb:16:in `names_for' /home/jrile/rails/cs480/lib/tasks/paperclip.rake:15:in `obtain_attachments' here's line 44 of user.rb (not sure why has paperclip) def

gdb - How to get Control Register (CR2) value? -

do have way find value of cr2 core of x86-64 ? info registers doesn't show it. (gdb) info registers rax 0x7fc9ca854000 140504662884352 rbx 0x119ad58 18459992 rcx 0xa0000 655360 rdx 0x7fca99045300 140508127318784 rsi 0x1 1 rdi 0x120 288 rbp 0x7fc9d0104e40 0x7fc9d0104e40 rsp 0x7fc9d0104c70 0x7fc9d0104c70 r8 0x0 0 r9 0xc0 192 r10 0x0 0 r11 0x7fca1432b2e0 140505898988256 r12 0x7fc9c95e5d80 140504643558784 r13 0x800a0003 2148139011 r14 0x0 0 r15 0x7fc94537d198 140502426440088 rip 0x666831 0x666831 eflags 0x10206 [ pf if rf ] cs 0x33 51 ss 0x2b 43 ds 0x0 0 es 0x0 0 fs 0x0 0 gs 0x0 0 st0 0 (raw 0x00000000000000000000

c++ - Namespace function linker error when used in multiple classes -

i writing function want use in code debugging without throwing exceptions. want defined variable debug_mode when set true causes function print given message , when set false prints nothing. want available class imports file without having create class, i.e. include "debug.h" , can call debug::log(string message). i read advantages of using namespace functions wrote such perhaps don't understand proper usage of namespace functions. when include header file namespace function in 1 class works great, when use in 2 classes in 2 different files linker error: error 1 error lnk2005: "void __cdecl debug::log(char const *)" (?log@debug@@yaxpbd0@z) defined in foo.obj... here code namespace functions: #pragma once #include <cstdio> // important: set true if want debug logging, false otherwise #define debug_mode true namespace debug { void log(const char* message) { if (debug_mode) printf(message); } void log(co

sql - MySQL LOAD DATA Error (Errcode: 2 - "No such file or directory") -

i trying load data table of mysql database, , getting error. load data local infile 'c:\users\myself\desktop\blah blah\load data\week.txt' table week; reference: this the path hundred percent correct, copied pressing shift , clicking "copy path as" , checked many times. so tips on appreciated . . my research: seeing this answer, tried changing c:\users c:\\users . did not work me. secondly, is there way use kind of relative path (rather absolute path) here? i don't know version of mysql using quick google search found possible answers both questions. below excerpts mysql 5.1 reference manual : the file name must given literal string. on windows, specify backslashes in path names forward slashes or doubled backslashes the local keyword affects file expected found: if local specified, file read client program on client host , sent server. file can given full path name specify exact location. if given relative path n

How to get MAC Address of device using Wifi in Android -

i want access mac address of phone using wifi. somehow not right. have written following code. context=this; setcontentview(r.layout.activity_main); try{ wifimanager wifi=(wifimanager)this.context.getsystemservice(context.wifi_service); wifi.setwifienabled(true); wifiinfo info=wifi.getconnectioninfo(); string address=info.getmacaddress(); if(address==null){ toast.maketext(context, "null", toast.length_long).show(); } else{ new asyncclass(mainactivity.this,address).execute(); } }catch(exception e){ toast.maketext(context, e.tostring(), toast.length_long).show(); } when run on phone, give me error "unfortunately application stopped" when run program on imulator, gives address null. please me rid of it. in advance. my manifest file below: <uses-permission android:required=&

php - Username MUST exist in database to create login -

i created login page of dreamweaver, , want make username field must match username in sql database in order create password. not familiar , unsure on need require existing username , add password username row in database. here php code created dreamweaver: connection database exists, know not present in below code. works fine normal registration page, don't want being able register. <?php if (!function_exists("getsqlvaluestring")) { function getsqlvaluestring($thevalue, $thetype, $thedefinedvalue = "", $thenotdefinedvalue = "") { if (php_version < 6) { $thevalue = get_magic_quotes_gpc() ? stripslashes($thevalue) : $thevalue; } $thevalue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($thevalue) : mysql_escape_string($thevalue); switch ($thetype) { case "text": $thevalue = ($thevalue != "") ? "'" . $thevalue . "'" : "null"

time - achartengine - timechart or linechart? -

i visualize achartengine series of measurements. have double values ​​in compare results , still string time. use line graph results , number. replace time number. unfortunately, not know how , find no suitable examples. edit okay, have found example , work. how can make flexible normal label? there plenty examples of using achartengine apis in official demo application. see these instructions in order figure out how download demo source code.

gruntjs - Disable tag completion in (grunt-contrib-)htmlmin -

i have rather typical php project in header/footer parts of pages reused , therefore placed in separate files require main file. this means, however, _header.php -file ends in open <article> tag (which "closed" @ beginning of _footer.php ). the problem htmlmin interprets error on part , adds closing article , body , html tags in _header.php . how 'disable' that? i've read through github pages of grunt-contrib-htmlmin and html-minifier without luck. my task config htmlmin: { dist: { options: { minifyjs: true, removecomments: true, collapsewhitespace: true }, files: { 'staging/index.php': 'index.php', 'staging/support/index.php': 'support/index.php', 'staging/inc/_header.php': 'inc/_header.p

c# - The name 'HttpUtility' does not exist in the current context (winform) -

iget following error: the name 'httputility' not exist in current context i building winform app code using framework 4 client profile , can't find system.web reference: string longurl = "https://test.com/currentaccount/pages/current.aspx"; var uribuilder = new uribuilder(longurl); var query = httputility.parsequerystring(uribuilder.query);//error query["ltfrom"] = fromdate; query["ltto"] = todate; query["ltfilterselected"] = "none"; uribuilder.query = query.tostring(); longurl = uribuilder.tostring(); what problem? httputility cannot accepted clientprofile - change .net version full.