Daily Archives

Articles indexed Thursday October 18 2012

Page 3/17 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Why am I getting a "network is unreachable" error on Ubuntu Server?

    - by jason328
    I'm a completely new to Ubuntu server and am having a hard time connecting the server to the internet. I first ran ping -n 8.8.8.8 connect:Network is unreachable Then I ran ifconfig Link encap:Local Loopback inet addr:127.0.0.1 Mask 255.0.0.0 inet6 addr: ::1/28Scope:host UP LOOPBACK RUNNING MTU:16436 RX packets:192 errors:0 dropped:0 overruns:0 frame:0 TX packets:192 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:15360 (15.2KB) TX bytes:15360 (15.3KB) Here is ouput for sudo lspci -n 00:00.0 0600: 8086:2580 (rev 04) 00:02.0 0300: 8086:2582 (rev 04) 00:1d.0 0c03: 8086:2658 (rev 03) 00:1d.1 0c03: 8086:2659 (rev 03) 00:1d.0 0c03: 8086:265a (rev 03) 00:1d.0 0c03: 8086:265b (rev 03) 00:1d.0 0c03: 8086:265c (rev 03) 00:1e.0 0604: 8086:244e (rev d3) 00:1e.0 0401: 8086:266e (rev 03) 00:1f.0 0601: 8086:2640 (rev 03) 00:1f.0 0101: 8086:2651 (rev 03) 00:1f.0 0c05: 8086:266a (rev 03) 00:0b.0 0200: 8086:1654 (rev 03) lshw-c network returns WARNING: you should run this program as super-user. *-network DISABLED description:Ethernet interface product: NetXtreme BCM5705_2 Gigabit Ethernet vender: Broadcom Corporation physical id:b bus info:pci@0000:0a:0b.0 logical name: eth0 capabilities: bus_master_cap_list ethernet physical tp 10bt 10bt-fd 100bt 100bt-fd 1000bt 1000bt-fd autonegotiation configuration: autonegotiation=on broadcast=yes driver=tg3 driverversion= 3.121 firmware=5705-v3.18 latency=32 mingnt=64 multicast=yes port=twister pair lsmod code returned this Module Size Used By e100 37213 0 dm_crypt 23125 1 ppdev 17113 0 psmouse 87603 0 snd_intel8x0 38570 0 snd_ac97_codec 134826 1 snd_intel8x0 ac97_bus 12730 1 snd_ac97_codec snd_pcm 97188 2 snd_intel8x0, snd_ac97_codec serio_raw 13211 0 snd_timer 29990 1 snd_pcm snd 78855 4 snd_intel8x0, snd_ac97_codec, snd_pcm,snd_timer soundcore 15091 1 snd snd_page_alloc 18529 2 snd_intel8x0, snd_pcm ext2 73795 1 parport_pc 32866 1 mac_hid 13253 0 lp 17799 0 parport 46562 3 ppdev, parport_pc,lp usbhid 47199 0 hid 99559 1 usbhid tg3 152032 0 i915 468651 1 floppy 70365 0 drm_kms_helper 46978 1 i915 drm 242038 2 i915,drm_kms_helper i2c_algo_bit 13423 1 i915 video 19596 1 i915 Again there is more but it's giving info on the driver itself. I know it works, I've used it. I assume then that my network got disabled when I installed Ubuntu Server. How do I enable it? I checked and the internet cable is connected to the D-link router. I have also used this same computer for internet access when I had Ubuntu Desktop installed so internet does work.

    Read the article

  • What are some tablets that can run Ubuntu?

    - by tacozmeister
    I can't believe I'm actually asking this, but what are some good, cheap tablets that can run Ubuntu? I'm considering getting a tablet, but I don't really want an expensive one like an iPad. And I love Ubuntu. So what tablets are out there that are cheap, but can also run Ubuntu 12.04 without much lag if it's installed after purchase? Personal anecdotes would be appreciated! Note: I'm not asking you to help me shop, just to formulate a list of tablets (+personal preference) that can use Ubuntu.

    Read the article

  • How does Lastpass recognize actual login?

    - by Pan.student
    We are currently working on simple school project using Codeigniter where we need login page. It would be very useful if Lastpass could recognise and save logins. We have several accounts with different roles and manual insert of login is pretty slow. So I was wondering what needs to be done and where in files (view, controller?) for Lastpass to work as it does on every website. For example this is our login form: <?php echo form_open('login'); ?> <input type="text" id="username" name="username"/> <input type="text" id="password" name="password"/> <input type="submit" value="Login"/> </form> Thanks for help. (could not create new tag "Lastpass" due to low reputation) [SOLVED] changed <input type="text" id="password" name="password"/> to <input type="password" id="password" name="password"/>

    Read the article

  • Why Google skips page title

    - by Bob
    I have no idea why this is happening. An example http://www.londonofficespace.com/ofdj17062004934429t.htm Title tag is: Unfurnished Office Space Wimbledon – Serviced Office on Lombard Road SW19 But is indexed as: Lombard Road – SW19 - London Office Space If you look in the source code and search for this portion ‘Lombard Road – SW19’ You then find that it's next to an office image alt=’Lombard Road – SW19’. The only thing I could think of is that the spider somehow ‘skips’ our title tag and grabs this bit, and then inserts the name of the site (but WHY?) Is there anything I can do with this? or is this a Google behaviour?

    Read the article

  • How to store and update data table on client side (iOS MMO)

    - by farseer2012
    Currently i'm developing an iOS MMO game with cocos2d-x, that game depends on many data tables(excel file) given by the designers. These tables contain data like how much gold/crystal will be cost when upgrade a building(barracks, laboratory etc..). We have about 10 tables, each have about 50 rows of data. My question is how to store those tables on client side and how to update them once they have been modified on server side? My opinion: use Sqlite to store data on client side, the server will parse the excel files and send the data to client with JSON format, then the client parse the JOSN string and save it to Sqlite file. Is there any better method? I find that some game stores csv files on client side, how do they update the files? Could server send a whole file directly to client?

    Read the article

  • My first flash game bot, in java

    - by Dylan
    Okay so i love coming up with new programming challenges and ive discovered a new challenge. I would love to create a bot for a game that requires the user to click on a character and drag the mouse like a slingshot. Upon releasing the mouse the character flys across the game and hopefully lands in a scored spot(in my bot the highest score). the game looks like this an image of the game is here. http://i.stack.imgur.com/fThnG.jpg How would i go about calculating the location of the character and then the physics to know exactly where to drag the mouse to?

    Read the article

  • PHP Battle System for RPG game

    - by Jay
    I posted this a while ago on stackoverflow, they thought it would be better place here, I agree. Essentially I know what I want to accomplish, and I have something to the effect of what I want but I am not satisfied with it. Here's the problem. Each user has some states: STR (how hard they hit), DEF (dodging/blocking attacks), SPD (when they can strike), and STAMINA (basically their endurance in game, if this runs out they can no longer fight and lose) What I need is something like this: UserA Stats: STR: 1,000 DEF: 2500 SPD: 2000 (HP: 1000/1000) UserB Stats: STR: 1,500 DEF: 500 SPD: 4000 (HP: 1000/1000) Because the second user has double the speed, he lands twice the amount of hits on the first user, before he gets hit. Because he has less strength than the first users defence, he will do no, to little damage. This is how the battle would theoretically go: UserB strikes UserA for 0 damage UserB strikes UserA for 0 damage UserA strikes UserB for 500 damage UserB strikes UserA for 0 damage UserB strikes UserA for 0 damage UserA strikes UserB for 500 damage, and sends him to the hospital! I was using this code, which is buggy, and not efficient, I just need a better way to do this: http://pastebin.com/15LiQQuJ Oh, and if anyone has some good ideas on how to improve the concept that would be cool too! It's not that elaborate so I'll be thinking of all sorts of things to make it more dynamic. Thanks.

    Read the article

  • runtime error: invalid memory address or nil pointer dereference

    - by Klink
    I want to learn OpenGL 3.0 with golang. But when i try to compile some code, i get many errors. package main import ( "os" //"errors" "fmt" //gl "github.com/chsc/gogl/gl33" //"github.com/jteeuwen/glfw" "github.com/go-gl/gl" "github.com/go-gl/glfw" "runtime" "time" ) var ( width int = 640 height int = 480 ) var ( points = []float32{0.0, 0.8, -0.8, -0.8, 0.8, -0.8} ) func initScene() { gl.Init() gl.ClearColor(0.0, 0.5, 1.0, 1.0) gl.Enable(gl.CULL_FACE) gl.Viewport(0, 0, 800, 600) } func glfwInitWindowContext() { if err := glfw.Init(); err != nil { fmt.Fprintf(os.Stderr, "glfw_Init: %s\n", err) glfw.Terminate() } glfw.OpenWindowHint(glfw.FsaaSamples, 1) glfw.OpenWindowHint(glfw.WindowNoResize, 1) if err := glfw.OpenWindow(width, height, 0, 0, 0, 0, 32, 0, glfw.Windowed); err != nil { fmt.Fprintf(os.Stderr, "glfw_Window: %s\n", err) glfw.CloseWindow() } glfw.SetSwapInterval(1) glfw.SetWindowTitle("Title") } func drawScene() { for glfw.WindowParam(glfw.Opened) == 1 { gl.Clear(gl.COLOR_BUFFER_BIT) vertexShaderSrc := `#version 120 attribute vec2 coord2d; void main(void) { gl_Position = vec4(coord2d, 0.0, 1.0); }` vertexShader := gl.CreateShader(gl.VERTEX_SHADER) vertexShader.Source(vertexShaderSrc) vertexShader.Compile() fragmentShaderSrc := `#version 120 void main(void) { gl_FragColor[0] = 0.0; gl_FragColor[1] = 0.0; gl_FragColor[2] = 1.0; }` fragmentShader := gl.CreateShader(gl.FRAGMENT_SHADER) fragmentShader.Source(fragmentShaderSrc) fragmentShader.Compile() program := gl.CreateProgram() program.AttachShader(vertexShader) program.AttachShader(fragmentShader) program.Link() attribute_coord2d := program.GetAttribLocation("coord2d") program.Use() //attribute_coord2d.AttribPointer(size, typ, normalized, stride, pointer) attribute_coord2d.EnableArray() attribute_coord2d.AttribPointer(0, 3, false, 0, &(points[0])) //gl.DrawArrays(gl.TRIANGLES, 0, len(points)) gl.DrawArrays(gl.TRIANGLES, 0, 3) glfw.SwapBuffers() inputHandler() time.Sleep(100 * time.Millisecond) } } func inputHandler() { glfw.Enable(glfw.StickyKeys) if glfw.Key(glfw.KeyEsc) == glfw.KeyPress { //gl.DeleteBuffers(2, &uiVBO[0]) glfw.Terminate() } if glfw.Key(glfw.KeyF2) == glfw.KeyPress { glfw.SetWindowTitle("Title2") fmt.Println("Changed to 'Title2'") fmt.Println(len(points)) } if glfw.Key(glfw.KeyF1) == glfw.KeyPress { glfw.SetWindowTitle("Title1") fmt.Println("Changed to 'Title1'") } } func main() { runtime.LockOSThread() glfwInitWindowContext() initScene() drawScene() } And after that: panic: runtime error: invalid memory address or nil pointer dereference [signal 0xb code=0x1 addr=0x0 pc=0x41bc6f74] goroutine 1 [syscall]: github.com/go-gl/gl._Cfunc_glDrawArrays(0x4, 0x7f8500000003) /tmp/go-build463568685/github.com/go-gl/gl/_obj/_cgo_defun.c:610 +0x2f github.com/go-gl/gl.DrawArrays(0x4, 0x3, 0x0, 0x45bd70) /tmp/go-build463568685/github.com/go-gl/gl/_obj/gl.cgo1.go:1922 +0x33 main.drawScene() /home/klink/Dev/Go/gogl/gopher/exper.go:85 +0x1e6 main.main() /home/klink/Dev/Go/gogl/gopher/exper.go:116 +0x27 goroutine 2 [syscall]: created by runtime.main /build/buildd/golang-1/src/pkg/runtime/proc.c:221 exit status 2

    Read the article

  • cocos2d/OpenGL multitexturing problem

    - by Gajoo
    I've got a simple shader to test multitextureing the problem is both samplers are using same image as their reference. the shader code is basically just this : vec4 mid = texture2D(u_texture,v_texCoord); float g = texture2D(u_guide,v_guideCoord); gl_FragColor = vec4(g , mid.g,0,1); and this is how I'm calling draw function : int last_State; glGetIntegerv(GL_ACTIVE_TEXTURE, &last_State); glActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE_2D, getTexture()->getName()); glActiveTexture(GL_TEXTURE1); glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, mGuideTexture->getName()); ccGLEnableVertexAttribs( kCCVertexAttribFlag_TexCoords |kCCVertexAttribFlag_Position); glVertexAttribPointer(kCCVertexAttrib_Position, 2, GL_FLOAT, GL_FALSE, 0, vertices); glVertexAttribPointer(kCCVertexAttrib_TexCoords, 2, GL_FLOAT, GL_FALSE, 0, texCoord); glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); glDisable(GL_TEXTURE_2D); I've already check mGuideTexture->getName() and getTexture()->getName() are returning correct textures. but looking at the result I can tell, both samplers are reading from getTexture()->getName(). here are some screen shots showing what is happening : The image rendered Using above codes The image rendered when I change textures passed to samples I'm expecting to see green objects from the first picture with red objects hanging from the top.

    Read the article

  • Why circles are not created if small?

    - by Suzan Cioc
    I have changed the scale to my own and now I cant create any object, including circle, if it is of the size which is normal for my scale. I am to create big object first and then modify it to smaller size. Looks like minimal size protection is set somewhere. Where? UPDATE While creating a circle, if I drag for 0.04m circle disappears after drag end. If I drag for 0.08m circle also disappears. If I drag for more than 0.1m, circle persists after drag end. How to set so that it persist after 0.01m too?

    Read the article

  • A better understanding of the relations beetween database tables

    - by Nistor Alexandru
    Hi I am trying to get a better understanding of relational databases and there is something that I keep bumping into and don't understand.Let's take this two tables: In this case Login.ID is the primary key with auto_increment set and Profile.ID_LOGIN is the Foreign KEY.When a user is created and it's username and password is stored in the login database does the ID coresponding to the curesnt username and password get automaticly added into ID_LOGIN or do I have to create an SQL statement to do this? If I have to create a SQL statement how should I aproach adding the ID_LOGIN to make sure I am adding it corectly?

    Read the article

  • Matlab: How to find the right-most point of a white line within the imrect?

    - by mchlfchr
    i've got a question regarding the imrect() function, which is part of the image processing toolbox in MatLab. I'd like to find a starting point within an image. I use the imrect function for setting a region to limit and specify the lookup area, but I can't get the point where the ROI mask is getting back mapped to the original size of the image. As you can see on the image there is a specified rectangle (cyan-colored), which I want to inspect for the white line, especially the nearest point to the right edge of the rectangle. I experimentated with only looking up on the last column of the rectangle, but as I mentioned before, the re-mapping onto the global image coordinates failed. So in this example, the white point I'd like to get would be around (98,302) The original (x,y) coordinates are relevant, so a cropping of the image to the rectangle is not acceptable. So, do you have any ideas? Thanks for any helping comments. Kind regards,

    Read the article

  • Slide div content from left to right

    - by Inuka Rathnayake
    I'm beginner in to jquery and i wonder always how do developers do like this. Can someone give me a simple example..? http://static.livedemo00.template-help.com/wt_37928/#!/home What i need is there is a menubar and when you click a link from it that link's content should come to center of the screen by left and when you click another link that visible content should go to right and recently clicked link's content come to the screen as i mentioned. Can anyone help me out...? It will be a great relieve to me. Thank you.

    Read the article

  • Header Div Position Edit according to Content Div

    - by Melih Mucuk
    I want to design my web site. I have two main div, one of them "header", other "content". I want to set width property:80% and I set center for both of them. But I don't do that. Other question about header div. I uploaded an image and I want to design like this. How can I do all of them? My CSS: #main { margin:0px auto; margin-left:50px; margin-right:50px; margin-top:25px; margin-bottom:25px; height:auto; text-align:center;} #content { width:80%; height:auto; margin:0px auto; } #header { width:80%; height:100px; top:20px; } #header_left { float:left ; height: 100px; text-align: center; } #header_right { margin:0px auto; height:30px; text-align:center; margin-top:35px; } #header_social { float:right; height:30px; text-align:center; margin-top:35px;} My client code: <div id="main"> <div id="content"> <div id="header"> <div id="header_left"> <asp:Image ID="Image1" runat="server" /> </div> <div id="header_right"> <asp:LinkButton ID="LinkButton5" runat="server" ForeColor="Gray"></asp:LinkButton>&nbsp;| <asp:LinkButton ID="LinkButton4" runat="server" ForeColor="Gray" ></asp:LinkButton>&nbsp;| <asp:LinkButton ID="LinkButton3" runat="server" ForeColor="#FF3300" ></asp:LinkButton>&nbsp;| <asp:LinkButton ID="LinkButton2" runat="server" ForeColor="Gray" ></asp:LinkButton>&nbsp;| <asp:LinkButton ID="LinkButton1" runat="server" ForeColor="Gray" ></asp:LinkButton> </div> <div id="header_social"> <asp:ImageButton ID="ImageButton1" runat="server"/> <asp:ImageButton ID="ImageButton2" runat="server"/> </div> </div> ******CONTENT FIELD***** </div> </div>

    Read the article

  • Rails: authentication system based on external API

    - by Slevin
    i'm building a Rails application to extend features of an existing online Rails app. The existing Rails app provides an API for authentication. My approach: user X have an account at the existing Rails app. With these login data the user X should authenticate on my Rails app. The existing app offers a gem to connect to the API after login. Whats the best method to store the information about a successful login? Should i use sessions? Or does Rails offer better methods for this?

    Read the article

  • css issue when resize windows

    - by zlippr
    hi i am having issue with css as when i resize the windows the div is not placed properly as below this is css involving the div .similar_story_block_form { background-color: white; border: 1px solid #CCCCCC; border-radius: 0 0 12px 12px; box-shadow: 0 4px 14px 0 rgba(0, 0, 0, 0.8); font-size: 13px; left: 337px; position: absolute; top: 105px; width: 337px; z-index: 100; } currently i use chrome which give me the same issue. What am i missing here? Thank for your help

    Read the article

  • Android FTP seek Bar issue

    - by Androi Developer
    I am trying to Upload & Download file to server using FTP and Download File using HTTP i am able to do this, my problem is when i am trying to show seek bar with Upload status of file using ftp then it's not showing. In this attached image Using HTTP it's showing seekbar with Network spped like this i need to display seek bar & Network sppeed in FTP. Below code i wrote for FTP to upload file into server. Code:-- // Upload System.out.println("upload test is called"); //Toast.makeText(con, "upload FTP test is called", Toast.LENGTH_SHORT).show(); //ContextWrapper context = null; //assetManager= context.getAssets(); assetManager = getResources().getAssets(); input1 = assetManager.open("hello.txt"); final long started = System.currentTimeMillis(); int size = input1.available(); //byte[] buffer = new byte[size]; byte dataByte[] = new byte[1024]; //input1.read(buffer); //String data = "ZK DATA TESTER TEST DATA1sdfsdf"; String data = input1.toString(); System.out.println("dat value is........"+data); final int lenghtOfFile = data.getBytes().length; //final int lenghtOfFile = input1.getBytes().length; System.out.println("length of file....."+lenghtOfFile); ByteArrayInputStream in = new ByteArrayInputStream( data.getBytes()); //toast("Uploading /test.txt"); //Toast.makeText(con,"File Size : " +data.getBytes().length + " bytes",Toast.LENGTH_SHORT).show(); //byte b[] = new byte[1024]; long total = 0; long sleepingTime= 0; System.out.println("started time --"+started); updateUI(status, "Uploading"); while ((count = in.read(dataByte)) != -1) { System.out.println("read value is...."+in.read(dataByte)); while (sleep1) { Thread.sleep(1000); System.out.println("ftp upload is in sleeping mode"); sleepingTime +=1000; } System.out.println("Total count --"+count); total += count; System.out.println("Only Total --"+total); final int progress = (int) ((total * 100) / lenghtOfFile); final long speed = total; //duration = ((System.currentTimeMillis() - started)-sleepingTime) / 1000; boolean result = ObjFtpCon.storeFile("/test.txt", input1); //boolean result = ObjFtpCon.storeFile(map.get("file_address").toString()+"/test.txt", input1); duration = ((System.currentTimeMillis() - started)-sleepingTime) / 1000; /* runOnUiThread(new Runnable() { public void run() { bar.setProgress(progress); // trans.setText("" + progress); //duration = ((System.currentTimeMillis() - started)-sleepingTime) / 1000; //duration = ((System.currentTimeMillis() - started)-sleepingTime) / 1000; //real_time.setText(duration + " secs"); if (duration != 0) { test_avg.setText((((speed / duration)*1000)*0.0078125) + " kbps"); if (pk <= (speed / duration) / 1024) { pk = (speed / duration) / 1024; } if (pk <= ((speed / duration)*1000)*0.0078125) { pk = (long)(((speed / duration)*1000)*0.0078125); } //peak.setText(pk + " kbps"); } } });*/ //in.close(); if (result) { updateUI(status, "Uploaded"); // toast("Uploading succeeded"); // toast("Uploaded at /test.txt"); //duration = ((System.currentTimeMillis() - started)-sleepingTime) / 1000; System.out.println("curreent time..... "+System.currentTimeMillis()); System.out.println("started time --"+started); System.out.println("sleep tome...."+sleepingTime); System.out.println("duration is....."+duration); runOnUiThread(new Runnable() { public void run() { bar.setProgress(progress); // trans.setText("" + progress); //duration = ((System.currentTimeMillis() - started)-sleepingTime) / 1000; real_time.setText(duration + " secs"); if (duration != 0) { test_avg.setText((speed / duration) / 1024 + " kbps"); if (pk <= (speed / duration) / 1024) { pk = (speed / duration) / 1024; } peak.setText(pk + " kbps"); } } }); } /*while(!result){Thread.sleep(1000);}*/ } in.close();

    Read the article

  • My dialog box below does not work, Please correct

    - by Mukul Shukla
    pbutton.setOnClickListener(new OnClickListener() { private AlertDialog show; public void onClick(View arg0) { if ((input1.getText().length() == 0) || (input1.getText().toString().equals(" ")) || (input2.getText().length() == 0) || (input2.getText().toString().equals(" "))|| (input1.getText().toString().equals(""))||(input2.getText().toString().equals(""))) { show = new AlertDialog.Builder(MainActivity.this).setTitle("Error").setMessage("Some inputs are empty").setPositiveButton("OK", null).show(); } double result = new Double(input1.getText().toString())+ new Double(input2.getText().toString()); output.setText(Double.toString(result)); } I've also tried passing the context which also doesn't work

    Read the article

  • Warning: non-integer #successes in a binomial glm! (survey packages)

    - by longrob
    I am using the twang package to create propensity scores, which are used as weigtings in a binomial glm using survey::svyglm. The code looks something like this: pscore <- ps(ppci ~ var1+var2+.........., data=dt....) dt$w <- get.weights(pscore, stop.method="es.mean") design.ps <- svydesign(ids=~1, weights=~w, data=dt,) glm1 <- svyglm(m30 ~ ppci, design=design.ps,family=binomial) This produces the following warning: Warning message: In eval(expr, envir, enclos) : non-integer #successes in a binomial glm! Does anyone know what I could be doing wrong ? I wasn't sure if this message would be better on stats.SE, but on balance I thought I would try here first.

    Read the article

  • Imap cyrillic mail

    - by atredis
    I use the mailsystem.NET library to put a message in my inbox. This is my code: Imap4Client imap = new Imap4Client(); imap.ConnectSsl("imap.gmail.com", 993); imap.Login(mylogin, mypassword); Mailbox mails; mails = imap.SelectMailbox("INBOX"); Message commomMessage = new Message(); commomMessage.From = new Address("someAddress", "someName"); commomMessage.To.Add(mylogin, "myName"); commomMessage.Subject = "someSubject"; commomMessage.BodyHtml.Text = "?????? ???";//or some cyrillic text commomMessage.Date = DateTime.Now; mails.Append(commomMessage); When I open my gmail inbox, I see this mail, but the body contains ????? ??? rather than "?????? ???". If commomMessage.BodyHtml.Text contains only Latin characters, there is no problem.

    Read the article

  • How to tell endianness from this output?

    - by Nick Rosencrantz
    I'm running this example program and I'm suppossed to be able to tell from the output what machine type it is. I'm certain it's from inspecting one or two values but how should I perform this inspection? /* pointers.c - Test pointers * Written 2012 by F Lundevall * Copyright abandoned. This file is in the public domain. * * To make this program work on as many systems as possible, * addresses are converted to unsigned long when printed. * The 'l' in formatting-codes %ld and %lx means a long operand. */ #include <stdio.h> #include <stdlib.h> int * ip; /* Declare a pointer to int, a.k.a. int pointer. */ char * cp; /* Pointer to char, a.k.a. char pointer. */ /* Declare fp as a pointer to function, where that function * has one parameter of type int and returns an int. * Use cdecl to get the syntax right, http://cdecl.org/ */ int ( *fp )( int ); int val1 = 111111; int val2 = 222222; int ia[ 17 ]; /* Declare an array of 17 ints, numbered 0 through 16. */ char ca[ 17 ]; /* Declare an array of 17 chars. */ int fun( int parm ) { printf( "Function fun called with parameter %d\n", parm ); return( parm + 1 ); } /* Main function. */ int main() { printf( "Message PT.01 from pointers.c: Hello, pointy World!\n" ); /* Do some assignments. */ ip = &val1; cp = &val2; /* The compiler should warn you about this. */ fp = fun; ia[ 0 ] = 11; /* First element. */ ia[ 1 ] = 17; ia[ 2 ] = 3; ia[ 16 ] = 58; /* Last element. */ ca[ 0 ] = 11; /* First element. */ ca[ 1 ] = 17; ca[ 2 ] = 3; ca[ 16 ] = 58; /* Last element. */ printf( "PT.02: val1: stored at %lx (hex); value is %d (dec), %x (hex)\n", (long) &val1, val1, val1 ); printf( "PT.03: val2: stored at %lx (hex); value is %d (dec), %x (hex)\n", (long) &val2, val2, val2 ); printf( "PT.04: ip: stored at %lx (hex); value is %ld (dec), %lx (hex)\n", (long) &ip, (long) ip, (long) ip ); printf( "PT.05: Dereference pointer ip and we find: %d \n", *ip ); printf( "PT.06: cp: stored at %lx (hex); value is %ld (dec), %lx (hex)\n", (long) &cp, (long) cp, (long) cp ); printf( "PT.07: Dereference pointer cp and we find: %d \n", *cp ); *ip = 1234; printf( "\nPT.08: Executed *ip = 1234; \n" ); printf( "PT.09: val1: stored at %lx (hex); value is %d (dec), %x (hex)\n", (long) &val1, val1, val1 ); printf( "PT.10: ip: stored at %lx (hex); value is %ld (dec), %lx (hex)\n", (long) &ip, (long) ip, (long) ip ); printf( "PT.11: Dereference pointer ip and we find: %d \n", *ip ); printf( "PT.12: val1: stored at %lx (hex); value is %d (dec), %x (hex)\n", (long) &val1, val1, val1 ); *cp = 1234; /* The compiler should warn you about this. */ printf( "\nPT.13: Executed *cp = 1234; \n" ); printf( "PT.14: val2: stored at %lx (hex); value is %d (dec), %x (hex)\n", (long) &val2, val2, val2 ); printf( "PT.15: cp: stored at %lx (hex); value is %ld (dec), %lx (hex)\n", (long) &cp, (long) cp, (long) cp ); printf( "PT.16: Dereference pointer cp and we find: %d \n", *cp ); printf( "PT.17: val2: stored at %lx (hex); value is %d (dec), %x (hex)\n", (long) &val2, val2, val2 ); ip = ia; printf( "\nPT.18: Executed ip = ia; \n" ); printf( "PT.19: ia[0]: stored at %lx (hex); value is %d (dec), %x (hex)\n", (long) &ia[0], ia[0], ia[0] ); printf( "PT.20: ia[1]: stored at %lx (hex); value is %d (dec), %x (hex)\n", (long) &ia[1], ia[1], ia[1] ); printf( "PT.21: ip: stored at %lx (hex); value is %ld (dec), %lx (hex)\n", (long) &ip, (long) ip, (long) ip ); printf( "PT.22: Dereference pointer ip and we find: %d \n", *ip ); ip = ip + 1; /* add 1 to pointer */ printf( "\nPT.23: Executed ip = ip + 1; \n" ); printf( "PT.24: ip: stored at %lx (hex); value is %ld (dec), %lx (hex)\n", (long) &ip, (long) ip, (long) ip ); printf( "PT.25: Dereference pointer ip and we find: %d \n", *ip ); cp = ca; printf( "\nPT.26: Executed cp = ca; \n" ); printf( "PT.27: ca[0]: stored at %lx (hex); value is %d (dec), %x (hex)\n", (long) &ca[0], ca[0], ca[0] ); printf( "PT.28: ca[1]: stored at %lx (hex); value is %d (dec), %x (hex)\n", (long) &ca[1], ca[1], ca[1] ); printf( "PT.29: cp: stored at %lx (hex); value is %ld (dec), %lx (hex)\n", (long) &cp, (long) cp, (long) cp ); printf( "PT.30: Dereference pointer cp and we find: %d \n", *cp ); cp = cp + 1; /* add 1 to pointer */ printf( "\nPT.31: Executed cp = cp + 1; \n" ); printf( "PT.32: cp: stored at %lx (hex); value is %ld (dec), %lx (hex)\n", (long) &cp, (long) cp, (long) cp ); printf( "PT.33: Dereference pointer cp and we find: %d \n", *cp ); ip = ca; /* The compiler should warn you about this. */ printf( "\nPT.34: Executed ip = ca; \n" ); printf( "PT.35: ca[0]: stored at %lx (hex); value is %d (dec), %x (hex)\n", (long) &ca[0], ca[0], ca[0] ); printf( "PT.36: ca[1]: stored at %lx (hex); value is %d (dec), %x (hex)\n", (long) &ca[1], ca[1], ca[1] ); printf( "PT.37: ip: stored at %lx (hex); value is %ld (dec), %lx (hex)\n", (long) &ip, (long) ip, (long) ip ); printf( "PT.38: Dereference pointer ip and we find: %d \n", *ip ); cp = ia; /* The compiler should warn you about this. */ printf( "\nPT.39: Executed cp = ia; \n" ); printf( "PT.40: cp: stored at %lx (hex); value is %ld (dec), %lx (hex)\n", (long) &cp, (long) cp, (long) cp ); printf( "PT.41: Dereference pointer cp and we find: %d \n", *cp ); printf( "\nPT.42: fp: stored at %lx (hex); value is %ld (dec), %lx (hex)\n", (long) &fp, (long) fp, (long) fp ); printf( "PT.43: Dereference fp and see what happens.\n" ); val1 = (*fp)(42); printf( "PT.44: Executed val1 = (*fp)(42); \n" ); printf( "PT.45: val1: stored at %lx (hex); value is %d (dec), %x (hex)\n", (long) &val1, val1, val1 ); return( 0 ); } Output Message PT.01 from pointers.c: Hello, pointy World! PT.02: val1: stored at 21e50 (hex); value is 111111 (dec), 1b207 (hex) PT.03: val2: stored at 21e54 (hex); value is 222222 (dec), 3640e (hex) PT.04: ip: stored at 21eb8 (hex); value is 138832 (dec), 21e50 (hex) PT.05: Dereference pointer ip and we find: 111111 PT.06: cp: stored at 21e6c (hex); value is 138836 (dec), 21e54 (hex) PT.07: Dereference pointer cp and we find: 0 PT.08: Executed *ip = 1234; PT.09: val1: stored at 21e50 (hex); value is 1234 (dec), 4d2 (hex) PT.10: ip: stored at 21eb8 (hex); value is 138832 (dec), 21e50 (hex) PT.11: Dereference pointer ip and we find: 1234 PT.12: val1: stored at 21e50 (hex); value is 1234 (dec), 4d2 (hex) PT.13: Executed *cp = 1234; PT.14: val2: stored at 21e54 (hex); value is -771529714 (dec), d203640e (hex) PT.15: cp: stored at 21e6c (hex); value is 138836 (dec), 21e54 (hex) PT.16: Dereference pointer cp and we find: -46 PT.17: val2: stored at 21e54 (hex); value is -771529714 (dec), d203640e (hex) PT.18: Executed ip = ia; PT.19: ia[0]: stored at 21e74 (hex); value is 11 (dec), b (hex) PT.20: ia[1]: stored at 21e78 (hex); value is 17 (dec), 11 (hex) PT.21: ip: stored at 21eb8 (hex); value is 138868 (dec), 21e74 (hex) PT.22: Dereference pointer ip and we find: 11 PT.23: Executed ip = ip + 1; PT.24: ip: stored at 21eb8 (hex); value is 138872 (dec), 21e78 (hex) PT.25: Dereference pointer ip and we find: 17 PT.26: Executed cp = ca; PT.27: ca[0]: stored at 21e58 (hex); value is 11 (dec), b (hex) PT.28: ca[1]: stored at 21e59 (hex); value is 17 (dec), 11 (hex) PT.29: cp: stored at 21e6c (hex); value is 138840 (dec), 21e58 (hex) PT.30: Dereference pointer cp and we find: 11 PT.31: Executed cp = cp + 1; PT.32: cp: stored at 21e6c (hex); value is 138841 (dec), 21e59 (hex) PT.33: Dereference pointer cp and we find: 17 PT.34: Executed ip = ca; PT.35: ca[0]: stored at 21e58 (hex); value is 11 (dec), b (hex) PT.36: ca[1]: stored at 21e59 (hex); value is 17 (dec), 11 (hex) PT.37: ip: stored at 21eb8 (hex); value is 138840 (dec), 21e58 (hex) PT.38: Dereference pointer ip and we find: 185664256 PT.39: Executed cp = ia; PT.40: cp: stored at 21e6c (hex); value is 138868 (dec), 21e74 (hex) PT.41: Dereference pointer cp and we find: 0 PT.42: fp: stored at 21e70 (hex); value is 69288 (dec), 10ea8 (hex) PT.43: Dereference fp and see what happens. Function fun called with parameter 42 PT.44: Executed val1 = (*fp)(42); PT.45: val1: stored at 21e50 (hex); value is 43 (dec), 2b (hex)

    Read the article

  • not work jquery for for input value

    - by Mohammad
    main code : var clone = div.clone(); clone.attr('id', sabad_kala_id); $('.content').append(clone); $('div#'+sabad_kala_id).replaceWith('<tr id='+sabad_kala_id+'><td width="50"><a class="del_kala" id='+sabad_kala_id+'><img src="images/delete.png" alt="delete" /></a></td><td width="50">1.</td><td width="388">'+title+'</td><td width="80" clas="mm"><input class="count" type="text" value='+count+' /></td><td width="100">'+price+' $</td><td width="120">'+price_count+' $</td></tr>'); and this code run perfect after append and replace , user can edit input.count in table and below code have run : ('input.count').keyup(function(e){ alert(test); }); but this code not work :(

    Read the article

  • How to check volume is mounted or not using python with a dynamic volume name

    - by SR query
    import subprocess def volumeCheck(volume_name): """This function will check volume name is mounted or not. """ volume_name = raw_input('Enter volume name:') volumeCheck(volume_name) print 'volume_name=',volume_name p = subprocess.Popen(['df', '-h'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) p1, err = p.communicate() pattern = p1 if pattern.find(volume_name): print 'volume found' else: print 'volume not found' While running i always got wrong result "volume found". root@sr-query:/# df -h Filesystem Size Used Avail Use% Mounted on rootfs 938M 473M 418M 54% / /dev/md0 938M 473M 418M 54% / none 250M 4.9M 245M 2% /dev /dev/md2 9.7M 1.2M 8.0M 13% /usr/config /dev/md7 961M 18M 895M 2% /downloads tmpfs 250M 7.9M 242M 4% /var/volatile tmpfs 250M 0 250M 0% /dev/shm tmpfs 250M 0 250M 0% /media/ram **/dev/mapper/vg9-lv9 1016M 65M 901M 7% /VolumeData/sp /dev/mapper/vg10-lv10 1016M 65M 901M 7% /VolumeData/cp** root@sr-query:/# root@sr-query:/# root@sr-query:/# python volume_check.py Enter volume name:raid_10volume volume_name= raid_10volume **volume found** root@sr-query:/# I enterd raid_10volume its not listed here please check the df -h command out put(only 2 volume there sp and cp) , then how it reached else part. what is wrong in my code? Thanks in advance. is there any other way to do this work ! ?

    Read the article

  • Retrieving a single Guid in CRM 4.0

    - by user1746560
    I'm new to CRM (version 4.0) and i'm trying to return a 'yearid' guide based on a given year (which is also stored in the entity).So far i've got: public static Guid GetYearID(string yearName) { ICrmService service = CrmServiceFactory.GetCrmService(); // Create the query object. QueryExpression query = new QueryExpression("year"); ColumnSet columns = new ColumnSet(); columns.AddColumn("yearid"); query.ColumnSet = columns; FilterExpression filter = new FilterExpression(); filter.FilterOperator = LogicalOperator.And; filter.AddCondition(new ConditionExpression { AttributeName = "yearName", Operator = ConditionOperator.Equal, Values = new object[] { yearName} }); query.Criteria = filter; } But my questions are: A) What code do in addition to this to actually store the Guid? B) Is using a QueryExpression the most efficient way to do this?

    Read the article

  • How to parse json with fromJson method

    - by Ankit HTech
    I want to parse my json by fromJson class but I am unable to understand what should be the structure of my class if my json is like below: String json = "{"Result":{"Status":"SUCCESS","Message":""},"Response":{"Token":"ca0d7507-3907-4eed-af19-ad256bc71088","ZoneUrl":"https:\/\/qa.tritononline.com\/","CustomerID":1,"UserID":29,"DefaultLanguageID":1,"ZoneID":1,"IsTritonIntegrated":false,"Language":[{"LanguageId":1,"Language":"English","IsSelected":false}]}}" This is what I want to do Response res = new Response(); Gson gson = new Gson(); res = gson.fromJson(json, Response.class); I want to know what all variable should I take in Response class.

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >