What's the default weight of a form's submit element? –
drupal.stackexchange.com
The following code is fairly standard for adding a submit button to the
bottom of a form: // Submit button. $form['submit'] = array( '#type' =>
'submit', '#value' => t('Save'), ); It …
Monday, 30 September 2013
Wifi issue. Dell Latitude E6400 Ubuntu 12.04
Wifi issue. Dell Latitude E6400 Ubuntu 12.04
Fresh install of 12.04 on a Dell LAtitude E6400 and came up with the
wireless issues. I'm fairly new to linux command line, but have been using
ubuntu for several years now on a dell D630 so I researched, sudo'd,
reinstalled and now the light turns on and off with the external switch
and Im able to enable the wireless option in the connectivity settings but
it still wont see any wifi networks.
Anyhow I obviously need help to get it to connected.
Here's the results from the following commands:
lspci
00:00.0 Host bridge: Intel Corporation Mobile 4 Series Chipset Memory
Controller Hub (rev 07)
00:02.0 VGA compatible controller: Intel Corporation Mobile 4 Series
Chipset Integrated Graphics Controller (rev 07)
00:02.1 Display controller: Intel Corporation Mobile 4 Series Chipset
Integrated Graphics Controller (rev 07)
00:19.0 Ethernet controller: Intel Corporation 82567LM Gigabit Network
Connection (rev 03)
00:1a.0 USB controller: Intel Corporation 82801I (ICH9 Family) USB UHCI
Controller #4 (rev 03)
00:1a.1 USB controller: Intel Corporation 82801I (ICH9 Family) USB UHCI
Controller #5 (rev 03)
00:1a.2 USB controller: Intel Corporation 82801I (ICH9 Family) USB UHCI
Controller #6 (rev 03)
00:1a.7 USB controller: Intel Corporation 82801I (ICH9 Family) USB2 EHCI
Controller #2 (rev 03)
00:1b.0 Audio device: Intel Corporation 82801I (ICH9 Family) HD Audio
Controller (rev 03)
00:1c.0 PCI bridge: Intel Corporation 82801I (ICH9 Family) PCI Express
Port 1 (rev 03)
00:1c.1 PCI bridge: Intel Corporation 82801I (ICH9 Family) PCI Express
Port 2 (rev 03)
00:1c.2 PCI bridge: Intel Corporation 82801I (ICH9 Family) PCI Express
Port 3 (rev 03)
00:1c.3 PCI bridge: Intel Corporation 82801I (ICH9 Family) PCI Express
Port 4 (rev 03)
00:1d.0 USB controller: Intel Corporation 82801I (ICH9 Family) USB UHCI
Controller #1 (rev 03)
00:1d.1 USB controller: Intel Corporation 82801I (ICH9 Family) USB UHCI
Controller #2 (rev 03)
00:1d.2 USB controller: Intel Corporation 82801I (ICH9 Family) USB UHCI
Controller #3 (rev 03)
00:1d.7 USB controller: Intel Corporation 82801I (ICH9 Family) USB2 EHCI
Controller #1 (rev 03)
00:1e.0 PCI bridge: Intel Corporation 82801 Mobile PCI Bridge (rev 93)
00:1f.0 ISA bridge: Intel Corporation ICH9M-E LPC Interface Controller
(rev 03)
00:1f.2 IDE interface: Intel Corporation 82801IBM/IEM (ICH9M/ICH9M-E) 2
port SATA Controller [IDE mode] (rev 03)
00:1f.3 SMBus: Intel Corporation 82801I (ICH9 Family) SMBus Controller
(rev 03)
00:1f.5 IDE interface: Intel Corporation 82801IBM/IEM (ICH9M/ICH9M-E) 2
port SATA Controller [IDE mode] (rev 03)
03:01.0 FireWire (IEEE 1394): Ricoh Co Ltd R5C832 IEEE 1394 Controller
(rev 04)
03:01.1 SD Host controller: Ricoh Co Ltd R5C822 SD/SDIO/MMC/MS/MSPro Host
Adapter (rev 21)
03:01.2 System peripheral: Ricoh Co Ltd R5C843 MMC Host Controller (rev 11)
0c:00.0 Network controller: Broadcom Corporation BCM4322 802.11a/b/g/n
Wireless LAN Controller (rev 01)
lsusb
Bus 005 Device 002: ID 0a5c:5800 Broadcom Corp. BCM5880 Secure
Applications Processor
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 008 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
ifconfig
eth0 Link encap:Ethernet HWaddr 00:26:b9:c1:6a:60
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:99 errors:0 dropped:0 overruns:0 frame:0
TX packets:165 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:31276 (31.2 KB) TX bytes:18964 (18.9 KB)
Interrupt:22 Memory:f6ae0000-f6b00000
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:44 errors:0 dropped:0 overruns:0 frame:0
TX packets:44 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:4684 (4.6 KB) TX bytes:4684 (4.6 KB)
wlan0 Link encap:Ethernet HWaddr 78:e4:00:12:08:39
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
iwconfig
wlan0 IEEE 802.11bg ESSID:off/any
Mode:Managed Access Point: Not-Associated Tx-Power=20 dBm
Retry long limit:7 RTS thr:off Fragment thr:off
Power Management:off
lo no wireless extensions.
eth0 no wireless extensions.
lshw -C network
*-network
description: Ethernet interface
product: 82567LM Gigabit Network Connection
vendor: Intel Corporation
physical id: 19
bus info: pci@0000:00:19.0
logical name: eth0
version: 03
serial: 00:26:b9:c1:6a:60
capacity: 1Gbit/s
width: 32 bits
clock: 33MHz
capabilities: pm msi bus_master cap_list ethernet physical tp 10bt
10bt-fd 100bt 100bt-fd 1000bt-fd autonegotiation
configuration: autonegotiation=on broadcast=yes driver=e1000e
driverversion=2.1.4-k firmware=1.7-7 latency=0 link=no
multicast=yes port=twisted pair
resources: irq:44 memory:f6ae0000-f6afffff memory:f6adb000-f6adbfff
ioport:efe0(size=32)
*-network
description: Network controller
product: BCM4322 802.11a/b/g/n Wireless LAN Controller
vendor: Broadcom Corporation
physical id: 0
bus info: pci@0000:0c:00.0
version: 01
width: 64 bits
clock: 33MHz
capabilities: pm msi pciexpress bus_master cap_list
configuration: driver=b43-pci-bridge latency=0
resources: irq:17 memory:f69fc000-f69fffff
*-network
description: Wireless interface
physical id: 2
logical name: wlan0
serial: 78:e4:00:12:08:39
capabilities: ethernet physical wireless
configuration: broadcast=yes driver=b43
driverversion=3.8.0-30-generic firmware=508.1084 link=no
multicast=yes wireless=IEEE 802.11bg
nm-tool
NetworkManager Tool
State: disconnected
- Device: wlan0
----------------------------------------------------------------
Type: 802.11 WiFi
Driver: b43
State: disconnected
Default: no
HW Address: 78:E4:00:12:08:39
Capabilities:
Wireless Properties
WEP Encryption: yes
WPA Encryption: yes
WPA2 Encryption: yes
Wireless Access Points
- Device: eth0
-----------------------------------------------------------------
Type: Wired
Driver: e1000e
State: unavailable
Default: no
HW Address: 00:26:B9:C1:6A:60
Capabilities:
Carrier Detect: yes
Speed: 100 Mb/s
Wired Properties
Carrier: off
Laptop connects no problems through the wire, if you look at nm-tools it
says the wireless is disconnected. So how do I get it to say connected?
Fresh install of 12.04 on a Dell LAtitude E6400 and came up with the
wireless issues. I'm fairly new to linux command line, but have been using
ubuntu for several years now on a dell D630 so I researched, sudo'd,
reinstalled and now the light turns on and off with the external switch
and Im able to enable the wireless option in the connectivity settings but
it still wont see any wifi networks.
Anyhow I obviously need help to get it to connected.
Here's the results from the following commands:
lspci
00:00.0 Host bridge: Intel Corporation Mobile 4 Series Chipset Memory
Controller Hub (rev 07)
00:02.0 VGA compatible controller: Intel Corporation Mobile 4 Series
Chipset Integrated Graphics Controller (rev 07)
00:02.1 Display controller: Intel Corporation Mobile 4 Series Chipset
Integrated Graphics Controller (rev 07)
00:19.0 Ethernet controller: Intel Corporation 82567LM Gigabit Network
Connection (rev 03)
00:1a.0 USB controller: Intel Corporation 82801I (ICH9 Family) USB UHCI
Controller #4 (rev 03)
00:1a.1 USB controller: Intel Corporation 82801I (ICH9 Family) USB UHCI
Controller #5 (rev 03)
00:1a.2 USB controller: Intel Corporation 82801I (ICH9 Family) USB UHCI
Controller #6 (rev 03)
00:1a.7 USB controller: Intel Corporation 82801I (ICH9 Family) USB2 EHCI
Controller #2 (rev 03)
00:1b.0 Audio device: Intel Corporation 82801I (ICH9 Family) HD Audio
Controller (rev 03)
00:1c.0 PCI bridge: Intel Corporation 82801I (ICH9 Family) PCI Express
Port 1 (rev 03)
00:1c.1 PCI bridge: Intel Corporation 82801I (ICH9 Family) PCI Express
Port 2 (rev 03)
00:1c.2 PCI bridge: Intel Corporation 82801I (ICH9 Family) PCI Express
Port 3 (rev 03)
00:1c.3 PCI bridge: Intel Corporation 82801I (ICH9 Family) PCI Express
Port 4 (rev 03)
00:1d.0 USB controller: Intel Corporation 82801I (ICH9 Family) USB UHCI
Controller #1 (rev 03)
00:1d.1 USB controller: Intel Corporation 82801I (ICH9 Family) USB UHCI
Controller #2 (rev 03)
00:1d.2 USB controller: Intel Corporation 82801I (ICH9 Family) USB UHCI
Controller #3 (rev 03)
00:1d.7 USB controller: Intel Corporation 82801I (ICH9 Family) USB2 EHCI
Controller #1 (rev 03)
00:1e.0 PCI bridge: Intel Corporation 82801 Mobile PCI Bridge (rev 93)
00:1f.0 ISA bridge: Intel Corporation ICH9M-E LPC Interface Controller
(rev 03)
00:1f.2 IDE interface: Intel Corporation 82801IBM/IEM (ICH9M/ICH9M-E) 2
port SATA Controller [IDE mode] (rev 03)
00:1f.3 SMBus: Intel Corporation 82801I (ICH9 Family) SMBus Controller
(rev 03)
00:1f.5 IDE interface: Intel Corporation 82801IBM/IEM (ICH9M/ICH9M-E) 2
port SATA Controller [IDE mode] (rev 03)
03:01.0 FireWire (IEEE 1394): Ricoh Co Ltd R5C832 IEEE 1394 Controller
(rev 04)
03:01.1 SD Host controller: Ricoh Co Ltd R5C822 SD/SDIO/MMC/MS/MSPro Host
Adapter (rev 21)
03:01.2 System peripheral: Ricoh Co Ltd R5C843 MMC Host Controller (rev 11)
0c:00.0 Network controller: Broadcom Corporation BCM4322 802.11a/b/g/n
Wireless LAN Controller (rev 01)
lsusb
Bus 005 Device 002: ID 0a5c:5800 Broadcom Corp. BCM5880 Secure
Applications Processor
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 008 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
ifconfig
eth0 Link encap:Ethernet HWaddr 00:26:b9:c1:6a:60
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:99 errors:0 dropped:0 overruns:0 frame:0
TX packets:165 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:31276 (31.2 KB) TX bytes:18964 (18.9 KB)
Interrupt:22 Memory:f6ae0000-f6b00000
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:44 errors:0 dropped:0 overruns:0 frame:0
TX packets:44 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:4684 (4.6 KB) TX bytes:4684 (4.6 KB)
wlan0 Link encap:Ethernet HWaddr 78:e4:00:12:08:39
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
iwconfig
wlan0 IEEE 802.11bg ESSID:off/any
Mode:Managed Access Point: Not-Associated Tx-Power=20 dBm
Retry long limit:7 RTS thr:off Fragment thr:off
Power Management:off
lo no wireless extensions.
eth0 no wireless extensions.
lshw -C network
*-network
description: Ethernet interface
product: 82567LM Gigabit Network Connection
vendor: Intel Corporation
physical id: 19
bus info: pci@0000:00:19.0
logical name: eth0
version: 03
serial: 00:26:b9:c1:6a:60
capacity: 1Gbit/s
width: 32 bits
clock: 33MHz
capabilities: pm msi bus_master cap_list ethernet physical tp 10bt
10bt-fd 100bt 100bt-fd 1000bt-fd autonegotiation
configuration: autonegotiation=on broadcast=yes driver=e1000e
driverversion=2.1.4-k firmware=1.7-7 latency=0 link=no
multicast=yes port=twisted pair
resources: irq:44 memory:f6ae0000-f6afffff memory:f6adb000-f6adbfff
ioport:efe0(size=32)
*-network
description: Network controller
product: BCM4322 802.11a/b/g/n Wireless LAN Controller
vendor: Broadcom Corporation
physical id: 0
bus info: pci@0000:0c:00.0
version: 01
width: 64 bits
clock: 33MHz
capabilities: pm msi pciexpress bus_master cap_list
configuration: driver=b43-pci-bridge latency=0
resources: irq:17 memory:f69fc000-f69fffff
*-network
description: Wireless interface
physical id: 2
logical name: wlan0
serial: 78:e4:00:12:08:39
capabilities: ethernet physical wireless
configuration: broadcast=yes driver=b43
driverversion=3.8.0-30-generic firmware=508.1084 link=no
multicast=yes wireless=IEEE 802.11bg
nm-tool
NetworkManager Tool
State: disconnected
- Device: wlan0
----------------------------------------------------------------
Type: 802.11 WiFi
Driver: b43
State: disconnected
Default: no
HW Address: 78:E4:00:12:08:39
Capabilities:
Wireless Properties
WEP Encryption: yes
WPA Encryption: yes
WPA2 Encryption: yes
Wireless Access Points
- Device: eth0
-----------------------------------------------------------------
Type: Wired
Driver: e1000e
State: unavailable
Default: no
HW Address: 00:26:B9:C1:6A:60
Capabilities:
Carrier Detect: yes
Speed: 100 Mb/s
Wired Properties
Carrier: off
Laptop connects no problems through the wire, if you look at nm-tools it
says the wireless is disconnected. So how do I get it to say connected?
VB.net How to Compare difference in years
VB.net How to Compare difference in years
New VB coder here, trying to check if todays date is more then 10 years
past a date from a grabbed database entry, and display a message if it is.
The Database is already imported and set up in the VB application H ave
made, and working, I made a report to display the information.
I am guessing I need to use the Datediff but I can't seem to get it to
work, Thanks.
I will give my variable name here
Dim Custsince as Date
'From the Database here
CustSince = CustListodr("Custsince")
Thanks in advance, working with dates is not my strong point.
New VB coder here, trying to check if todays date is more then 10 years
past a date from a grabbed database entry, and display a message if it is.
The Database is already imported and set up in the VB application H ave
made, and working, I made a report to display the information.
I am guessing I need to use the Datediff but I can't seem to get it to
work, Thanks.
I will give my variable name here
Dim Custsince as Date
'From the Database here
CustSince = CustListodr("Custsince")
Thanks in advance, working with dates is not my strong point.
Wrong scaling on phone - Site with half width/height = full screen
Wrong scaling on phone - Site with half width/height = full screen
So a little followup on my previous thread, but with quite new content..
And changes of the situation.
So i'm creating an Android app, writing in Adobe Muse normally by notepad,
but find Muse this time more easy and configured all files as a Phone,
with a resolution of 1280x720. And my test device is a HTC one X, with a
screen resolution of 1280x720. Once all code is done, I compile it at
Adobe Phonegap into an APK and install that one on my phone.
So in fact, what I write in muse (site @ 1280x720) should be 1:1 on my
phones screen. However, that's not the case. In fact, it shows everything
at 2times the size. I can scroll on my screen..
In fact, I've created a second version *with just an homepage and one
image on it, using whole the canvas, but I've made this one exactly half
the size of the original; thus a canvas of 360x760. Compiled and installed
again, and indeed, guess what: No scrolling and the image takes up the
full screen.
By other meanings: Somewhere on the road, my phone thinks it has a screen
size of half (360x640) the dimensions it actually is (1280x720).
I did a quick test with
<meta name="viewport" content="user-scalable=no, width=device-width,
initial-scale=0.5, minimum-scale=0.5, maximum-scale=0.5"/>
Hoping that it would somehow fit "half" to whole my screen, But without luck.
So guys: Here I am, all lost and got no clue anymore. Who can help me with
a working HTML/CSS/JS configuration, or if the problem lies at the phone
gap configuration, help me over there?
Click here to download the site files and the compiled APK to test for
yourself. Note: If you install the APK on your phone (instead of an
emulator) and you got a different screen size than 1280x720, of course
scrolling occurs.
I would be so grateful for the solution! Thanks!
p.s. I've made a second test version, with just an home page at a
resolution of 480x800 and with only an image on it, and tested it on the
Samsung S3 mini too (with a screen res. of 480x800), and also the whole
thing seems at 2x scaled.. I'm really lost.
p.p.s. Someone else said "Remember, you still got the statusbar". For
those of you thinking the same: I've set it to full screen, hiding the
statusbar and using the full screen.
So a little followup on my previous thread, but with quite new content..
And changes of the situation.
So i'm creating an Android app, writing in Adobe Muse normally by notepad,
but find Muse this time more easy and configured all files as a Phone,
with a resolution of 1280x720. And my test device is a HTC one X, with a
screen resolution of 1280x720. Once all code is done, I compile it at
Adobe Phonegap into an APK and install that one on my phone.
So in fact, what I write in muse (site @ 1280x720) should be 1:1 on my
phones screen. However, that's not the case. In fact, it shows everything
at 2times the size. I can scroll on my screen..
In fact, I've created a second version *with just an homepage and one
image on it, using whole the canvas, but I've made this one exactly half
the size of the original; thus a canvas of 360x760. Compiled and installed
again, and indeed, guess what: No scrolling and the image takes up the
full screen.
By other meanings: Somewhere on the road, my phone thinks it has a screen
size of half (360x640) the dimensions it actually is (1280x720).
I did a quick test with
<meta name="viewport" content="user-scalable=no, width=device-width,
initial-scale=0.5, minimum-scale=0.5, maximum-scale=0.5"/>
Hoping that it would somehow fit "half" to whole my screen, But without luck.
So guys: Here I am, all lost and got no clue anymore. Who can help me with
a working HTML/CSS/JS configuration, or if the problem lies at the phone
gap configuration, help me over there?
Click here to download the site files and the compiled APK to test for
yourself. Note: If you install the APK on your phone (instead of an
emulator) and you got a different screen size than 1280x720, of course
scrolling occurs.
I would be so grateful for the solution! Thanks!
p.s. I've made a second test version, with just an home page at a
resolution of 480x800 and with only an image on it, and tested it on the
Samsung S3 mini too (with a screen res. of 480x800), and also the whole
thing seems at 2x scaled.. I'm really lost.
p.p.s. Someone else said "Remember, you still got the statusbar". For
those of you thinking the same: I've set it to full screen, hiding the
statusbar and using the full screen.
Sunday, 29 September 2013
ERROR/GeckoGLController(2190): Unable to create window surface in Android
ERROR/GeckoGLController(2190): Unable to create window surface in Android
this is the error log from Logcat
09-30 03:05:08.836: ERROR/GeckoGLController(2190): Unable to create window
surface
java.lang.IllegalArgumentException
at com.google.android.gles_jni.EGLImpl._eglCreateWindowSurface(Native
Method)
at
com.google.android.gles_jni.EGLImpl.eglCreateWindowSurface(EGLImpl.java:92)
at org.mozilla.gecko.gfx.GLController$1.run(GLController.java:145)
at android.os.Handler.handleCallback(Handler.java:730)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5103)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
09-30 03:05:08.846: ERROR/GeckoGLController(2190): EGL window surface
could not be created: Error 12288
09-30 03:09:33.766: DEBUG/GeckoMemoryMonitor(2190): Decreased memory
pressure to 1
in my main.xml.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/app_name" />
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button" >
</Button>
<ListView
android:id="@id/android:list"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
</ListView>
</LinearLayout>
I'm not sure put all code here is a good idea. This Error start before my
activity onCreate,and happens several times later. I could put my code
here if helpful.
this is the error log from Logcat
09-30 03:05:08.836: ERROR/GeckoGLController(2190): Unable to create window
surface
java.lang.IllegalArgumentException
at com.google.android.gles_jni.EGLImpl._eglCreateWindowSurface(Native
Method)
at
com.google.android.gles_jni.EGLImpl.eglCreateWindowSurface(EGLImpl.java:92)
at org.mozilla.gecko.gfx.GLController$1.run(GLController.java:145)
at android.os.Handler.handleCallback(Handler.java:730)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5103)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
09-30 03:05:08.846: ERROR/GeckoGLController(2190): EGL window surface
could not be created: Error 12288
09-30 03:09:33.766: DEBUG/GeckoMemoryMonitor(2190): Decreased memory
pressure to 1
in my main.xml.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/app_name" />
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button" >
</Button>
<ListView
android:id="@id/android:list"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
</ListView>
</LinearLayout>
I'm not sure put all code here is a good idea. This Error start before my
activity onCreate,and happens several times later. I could put my code
here if helpful.
How to add a cookie to my browser?
How to add a cookie to my browser?
I currently am in the programming challenge Picoctf. On one of the
challenges, I have to access a website however the site says I am not
authorized to view the page. Naturally, I looked through the source code
and found:
DEBUG: Expected Cookie: "authorization=administrator"
Then it shows the actual received cookie. So my question is how can I
change what cookie I send to the website so that
authorization=administrator? (BTW, i'm not too sure if the browser matters
but I am using google chrome).
The link to the website is HERE.
I currently am in the programming challenge Picoctf. On one of the
challenges, I have to access a website however the site says I am not
authorized to view the page. Naturally, I looked through the source code
and found:
DEBUG: Expected Cookie: "authorization=administrator"
Then it shows the actual received cookie. So my question is how can I
change what cookie I send to the website so that
authorization=administrator? (BTW, i'm not too sure if the browser matters
but I am using google chrome).
The link to the website is HERE.
I can't see html components in xhtml file
I can't see html components in xhtml file
I couldn't see neither primefaces nor html components in my page. I can
see only "sdaf" string. What can be the problem? At index.xhtml page
autocomplete works good I mean when I write
My index.xhtml file;
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:p="http://primefaces.org/ui">
<h:head>
</h:head>
<h:body>
<h:button value="html button"> </h:button>
sdaf
<p:spinner />
</h:body>
</html>
my pom.xml file;
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven- v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>5454</groupId>
<artifactId>45454</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>45454 Maven Webapp</name>
<url>http://maven.apache.org</url>
<repositories>
<repository>
<id>prime-repo</id>
<name>PrimeFaces Maven Repository</name>
<url>http://repository.primefaces.org</url>
<layout>default</layout>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.primefaces</groupId>
<artifactId>primefaces</artifactId>
<version>3.5</version>
</dependency>
<dependency>
<groupId>javax.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>2.1</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<finalName>45454</finalName>
</build>
</project>
I couldn't see neither primefaces nor html components in my page. I can
see only "sdaf" string. What can be the problem? At index.xhtml page
autocomplete works good I mean when I write
My index.xhtml file;
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:p="http://primefaces.org/ui">
<h:head>
</h:head>
<h:body>
<h:button value="html button"> </h:button>
sdaf
<p:spinner />
</h:body>
</html>
my pom.xml file;
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven- v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>5454</groupId>
<artifactId>45454</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>45454 Maven Webapp</name>
<url>http://maven.apache.org</url>
<repositories>
<repository>
<id>prime-repo</id>
<name>PrimeFaces Maven Repository</name>
<url>http://repository.primefaces.org</url>
<layout>default</layout>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.primefaces</groupId>
<artifactId>primefaces</artifactId>
<version>3.5</version>
</dependency>
<dependency>
<groupId>javax.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>2.1</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<finalName>45454</finalName>
</build>
</project>
Saturday, 28 September 2013
While loop wont repeat itself
While loop wont repeat itself
I need to let the user input an operand, input 2 integers, display the
result, and repeat. It wont repeat and when you input an integer to
continue, it terminates. Any help would be appreciated, Ive been stuck for
a while now! Thanks.
package lab03;
import java.util.Scanner;
import javax.swing.JOptionPane;
/**
*
*/
public class Lab03 {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
int n, p, q = 1;
boolean run = true;
String operator;
while (run == true) {
operator = JOptionPane.showInputDialog("Enter one of + - * / ");
String trimOperator = operator.trim();
char m = trimOperator.charAt(0);
String firstOperand = JOptionPane
.showInputDialog("Enter first integer operand: ");
n = Integer.parseInt(firstOperand);
String secondOperand = JOptionPane
.showInputDialog("Enter second integer operand: ");
p = Integer.parseInt(secondOperand);
switch (m) {
case '+':
System.out.println(n + " plus " + p + " is " + (n + p));
run = false;
break;
case '-':
System.out.println(n + " minus " + p + " is " + (n - p));
run = false;
break;
case '*':
System.out
.println(n + " multiplied by " + p + " is " + (n * p));
run = false;
break;
case '/':
System.out.println(n + " divided by " + p + " is " + (n / p)
+ " with remainder " + (n % p));
run = false;
break;
default:
System.out.println("Invalid character");
run = false;
break;
}
String lastInteger = JOptionPane
.showInputDialog("Enter 0 to quit, or any other integer to
continue. ");
q = Integer.parseInt(lastInteger);
System.out.println(q);
System.exit(0);
continue;
}
}
Sorry for lack of comments.
I need to let the user input an operand, input 2 integers, display the
result, and repeat. It wont repeat and when you input an integer to
continue, it terminates. Any help would be appreciated, Ive been stuck for
a while now! Thanks.
package lab03;
import java.util.Scanner;
import javax.swing.JOptionPane;
/**
*
*/
public class Lab03 {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
int n, p, q = 1;
boolean run = true;
String operator;
while (run == true) {
operator = JOptionPane.showInputDialog("Enter one of + - * / ");
String trimOperator = operator.trim();
char m = trimOperator.charAt(0);
String firstOperand = JOptionPane
.showInputDialog("Enter first integer operand: ");
n = Integer.parseInt(firstOperand);
String secondOperand = JOptionPane
.showInputDialog("Enter second integer operand: ");
p = Integer.parseInt(secondOperand);
switch (m) {
case '+':
System.out.println(n + " plus " + p + " is " + (n + p));
run = false;
break;
case '-':
System.out.println(n + " minus " + p + " is " + (n - p));
run = false;
break;
case '*':
System.out
.println(n + " multiplied by " + p + " is " + (n * p));
run = false;
break;
case '/':
System.out.println(n + " divided by " + p + " is " + (n / p)
+ " with remainder " + (n % p));
run = false;
break;
default:
System.out.println("Invalid character");
run = false;
break;
}
String lastInteger = JOptionPane
.showInputDialog("Enter 0 to quit, or any other integer to
continue. ");
q = Integer.parseInt(lastInteger);
System.out.println(q);
System.exit(0);
continue;
}
}
Sorry for lack of comments.
Populating razor DropDownList from view model
Populating razor DropDownList from view model
I have a custom model (let's say CustomModel) for populating my razor
DropDownList in the view:
namespace MyNamespace.Models
{
public class SelectListItem
{
public string Value { get; set; }
public string Text { get; set; }
}
public class ComponentTypeModel
{
private readonly List<ComponentType> componentTypes;
[Display(Name = "Component Type")]
public int SelectedCompTypeId { get; set; }
public IEnumerable<SelectListItem> CompTypeItems
{
get
{
var allCompTypes = componentTypes.Select(f => new
SelectListItem
{
Value = f.Id.ToString(),
Text = f.Name
});
return allCompTypes;
}
}
public IEnumerable<SelectListItem> DefaultCompTypeItem
{
get
{
return Enumerable.Repeat(new SelectListItem
{
Value = "-1",
Text = "Select a
component type"
},
count: 1);
}
}
}
}
Then in my view I do the following using razor:
@model MyNamespace.Models.CustomModel
@Html.LabelFor(m => m.SelectedCompTypeId);
@Html.DropDownListFor(m => m.SelectedCompTypeId, Model.CompTypeItems);
but the second argument Model.CompTypeItems in line:
@Html.DropDownListFor(m => m.SelectedCompTypeId, Model.CompTypeItems);
is generating a compilation error saying that it is not valid. Any ideas?
I have a custom model (let's say CustomModel) for populating my razor
DropDownList in the view:
namespace MyNamespace.Models
{
public class SelectListItem
{
public string Value { get; set; }
public string Text { get; set; }
}
public class ComponentTypeModel
{
private readonly List<ComponentType> componentTypes;
[Display(Name = "Component Type")]
public int SelectedCompTypeId { get; set; }
public IEnumerable<SelectListItem> CompTypeItems
{
get
{
var allCompTypes = componentTypes.Select(f => new
SelectListItem
{
Value = f.Id.ToString(),
Text = f.Name
});
return allCompTypes;
}
}
public IEnumerable<SelectListItem> DefaultCompTypeItem
{
get
{
return Enumerable.Repeat(new SelectListItem
{
Value = "-1",
Text = "Select a
component type"
},
count: 1);
}
}
}
}
Then in my view I do the following using razor:
@model MyNamespace.Models.CustomModel
@Html.LabelFor(m => m.SelectedCompTypeId);
@Html.DropDownListFor(m => m.SelectedCompTypeId, Model.CompTypeItems);
but the second argument Model.CompTypeItems in line:
@Html.DropDownListFor(m => m.SelectedCompTypeId, Model.CompTypeItems);
is generating a compilation error saying that it is not valid. Any ideas?
why are all goroutines deadlocked?
why are all goroutines deadlocked?
I am new to Go and also looked abit on the thread "throw: all goroutines
are asleep", but I am still wondering why this piece of code deadlock. I
believe that I put a number in namesInDir, and should be able to print it
afterwards. It seems that I can not add the number to the channel - which
confuses me. Anyone that can help me?
type uniprot struct
{
namesInDir chan int
}
func main(){
u := uniprot{}
u.namesInDir = make(chan int)
u.namesInDir <- 1
//u.readFilenames(os.Args[1])
u.printName()
}
func (u* uniprot) printName(){
name := <-u.namesInDir
fmt.Println(name)
}
I am new to Go and also looked abit on the thread "throw: all goroutines
are asleep", but I am still wondering why this piece of code deadlock. I
believe that I put a number in namesInDir, and should be able to print it
afterwards. It seems that I can not add the number to the channel - which
confuses me. Anyone that can help me?
type uniprot struct
{
namesInDir chan int
}
func main(){
u := uniprot{}
u.namesInDir = make(chan int)
u.namesInDir <- 1
//u.readFilenames(os.Args[1])
u.printName()
}
func (u* uniprot) printName(){
name := <-u.namesInDir
fmt.Println(name)
}
My Code is giving error
My Code is giving error
My Jquery code is below, but it is always giving 'Failed to load the
content', i need to make an ajax call to get the data using rest api. Any
help please.
<script
src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"
type="text/javascript"></script>
<script type="text/javascript">
$(function () {
var cat_id = ${coreNode.ancestors[0].id};
var restUrl = "http://xyz./restapi/vc/categories/id/"+cat_id+"/boards";
$.ajax({
type: "POST",
url: 'restUrl',
contentType: "text/xml; charset=utf-8",
data: "DATA",
success: function (response) {
alert(restUrl);
$(response).find("board > title").each(function () {
href = $(this).text();
alert(href);
});
},
error: function (response) {
$('#float-threads').html('Failed to load the content');
}
});
});
</script>
<div id="float-threads">
</div>
My Jquery code is below, but it is always giving 'Failed to load the
content', i need to make an ajax call to get the data using rest api. Any
help please.
<script
src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"
type="text/javascript"></script>
<script type="text/javascript">
$(function () {
var cat_id = ${coreNode.ancestors[0].id};
var restUrl = "http://xyz./restapi/vc/categories/id/"+cat_id+"/boards";
$.ajax({
type: "POST",
url: 'restUrl',
contentType: "text/xml; charset=utf-8",
data: "DATA",
success: function (response) {
alert(restUrl);
$(response).find("board > title").each(function () {
href = $(this).text();
alert(href);
});
},
error: function (response) {
$('#float-threads').html('Failed to load the content');
}
});
});
</script>
<div id="float-threads">
</div>
Friday, 27 September 2013
Binary Tree. Identify element v in T such that k-1 elements in T are smaller than v
Binary Tree. Identify element v in T such that k-1 elements in T are
smaller than v
I have this problem I need to solve. I am not looking for an answer, but a
hint towards where I should go. I have an algorithm, but it is not O(log
n).
Given Binary Tree T and a positive integer k that is no greater than the
number of nodes in T, write pseudocode that identifies an element v in T
such that precisely k − 1 elements in T are smaller than v. Your
code should take time at most proportional to the height of T.
The basic idea I have here is that I would first check the left tree,
checking the size of the left tree. If the size of the left tree is
greater than k-1, than I continue searching left. Else I would search
Right. If the entire left tree does not contain a node with k-1 elements
then I search the right subtree. The problem is that I know this isn't
O(log n) because worst case I would have to search every node in the tree.
Is there something I am missing? Any hints or help would be awesome, but
please don't just give me an answer.
smaller than v
I have this problem I need to solve. I am not looking for an answer, but a
hint towards where I should go. I have an algorithm, but it is not O(log
n).
Given Binary Tree T and a positive integer k that is no greater than the
number of nodes in T, write pseudocode that identifies an element v in T
such that precisely k − 1 elements in T are smaller than v. Your
code should take time at most proportional to the height of T.
The basic idea I have here is that I would first check the left tree,
checking the size of the left tree. If the size of the left tree is
greater than k-1, than I continue searching left. Else I would search
Right. If the entire left tree does not contain a node with k-1 elements
then I search the right subtree. The problem is that I know this isn't
O(log n) because worst case I would have to search every node in the tree.
Is there something I am missing? Any hints or help would be awesome, but
please don't just give me an answer.
How to make an iPhone 5s work with Xcode 5.0? dyld_shared_cache_extract_dylibs
How to make an iPhone 5s work with Xcode 5.0?
dyld_shared_cache_extract_dylibs
The Organizer window is displaying an error after Xcode registered the
device in the development portal: "dyld_shared_cache_extract_dylibs
failed".
Has anyone else encountered this problem and found a solution?
dyld_shared_cache_extract_dylibs
The Organizer window is displaying an error after Xcode registered the
device in the development portal: "dyld_shared_cache_extract_dylibs
failed".
Has anyone else encountered this problem and found a solution?
Mysql query for full text search with an OR condition
Mysql query for full text search with an OR condition
I have a dropdown list where it contains only two options And and Or.
These two options when selected will run a query however depending on the
selection. When And is selected, a change in the query will be made. My
query looks like this,
$sql =
"SELECT distinct n.node_id, n.path,
n.title_tag as node_name,
n2.title_tag as tree_name,
MATCH (n.title_tag) AGAINST ('%s') as score
FROM nodes n
join trees t on (n.tree_id=t.tree_id and t.status='A' and
t.workspace_id=%d)
join nodes n2 on (n2.node_id = t.tree_id)
left join node_links nl1 on (n.node_id=nl1.from_node_id and
nl1.to_node_id='%s')
left join node_links nl2 on (n.node_id=nl2.to_node_id and
nl2.from_node_id='%s')
WHERE n.node_id!='%s' and nl1.node_link_id is null and
nl2.node_link_id is null
HAVING score > 0
ORDER BY score DESC";
Notice the MATCH AGAINST part, that is where I would like to add my And
and Or conditions. How would I do it if when selecting the And condition
the query will match the node_name using the AND logic and when selecting
the Or condition the query will match the node_name using the OR logic.
Any help will do. Thanks.
I have a dropdown list where it contains only two options And and Or.
These two options when selected will run a query however depending on the
selection. When And is selected, a change in the query will be made. My
query looks like this,
$sql =
"SELECT distinct n.node_id, n.path,
n.title_tag as node_name,
n2.title_tag as tree_name,
MATCH (n.title_tag) AGAINST ('%s') as score
FROM nodes n
join trees t on (n.tree_id=t.tree_id and t.status='A' and
t.workspace_id=%d)
join nodes n2 on (n2.node_id = t.tree_id)
left join node_links nl1 on (n.node_id=nl1.from_node_id and
nl1.to_node_id='%s')
left join node_links nl2 on (n.node_id=nl2.to_node_id and
nl2.from_node_id='%s')
WHERE n.node_id!='%s' and nl1.node_link_id is null and
nl2.node_link_id is null
HAVING score > 0
ORDER BY score DESC";
Notice the MATCH AGAINST part, that is where I would like to add my And
and Or conditions. How would I do it if when selecting the And condition
the query will match the node_name using the AND logic and when selecting
the Or condition the query will match the node_name using the OR logic.
Any help will do. Thanks.
findViewById is not defined by Fragment
findViewById is not defined by Fragment
AutoCompleteTextView autoCompView =
(AutoCompleteTextView) findViewById(R.id.autocomplete_city);
Gives me an error
The method findViewById is undefined for the type CityFragment.
with:
public class CityFragment extends Fragment {
public CityFragment() {}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.city,
container, false);
AutoCompleteTextView autoCompView =
(AutoCompleteTextView) findViewById(R.id.autocomplete_city);
autoCompView.setAdapter(
new PlacesAutoCompleteAdapter(this,
R.layout.list_item)
);
return rootView;
}
}
I basically just copied the code from
https://developers.google.com/places/training/autocomplete-android
Any ideas why I get the error?
AutoCompleteTextView autoCompView =
(AutoCompleteTextView) findViewById(R.id.autocomplete_city);
Gives me an error
The method findViewById is undefined for the type CityFragment.
with:
public class CityFragment extends Fragment {
public CityFragment() {}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.city,
container, false);
AutoCompleteTextView autoCompView =
(AutoCompleteTextView) findViewById(R.id.autocomplete_city);
autoCompView.setAdapter(
new PlacesAutoCompleteAdapter(this,
R.layout.list_item)
);
return rootView;
}
}
I basically just copied the code from
https://developers.google.com/places/training/autocomplete-android
Any ideas why I get the error?
Composition of objects vs functions: Should I use one method interfaces or delegates?
Composition of objects vs functions: Should I use one method interfaces or
delegates?
C# is a multi paradigm language. With nesting interfaces and classes one
can get a composition of objects. This way a certain problem can be broken
down to a number of simple ones giving each component its own piece of the
puzzle to solve. The same trick can be done in a slightly different
manner, one can make a composition of functions each of which is
responsible of solving its own little task while all combined and
interconnected they give the answer to the main problem.
Following SOLID principles I found myself in a situation where 95% of my
interfaces carry just one method named do-something and the name of the
interface is something-doer. The class that implements such interfaces is
DI'ed with the a few components required to fulfill whatever that method
is supposed to do. Such approach is basically making a closure over a
function by hands. If so, why wouldn't I just go with delegates that do it
naturally and for free (no typing necessary)? If I go all the way
converting single method interfaces to delegates I will eliminate 95% of
them from my code making it look like written in functional language. But
this seems like a right thing to do unless there is some bold reason to
stick with interfaces. Is there?
delegates?
C# is a multi paradigm language. With nesting interfaces and classes one
can get a composition of objects. This way a certain problem can be broken
down to a number of simple ones giving each component its own piece of the
puzzle to solve. The same trick can be done in a slightly different
manner, one can make a composition of functions each of which is
responsible of solving its own little task while all combined and
interconnected they give the answer to the main problem.
Following SOLID principles I found myself in a situation where 95% of my
interfaces carry just one method named do-something and the name of the
interface is something-doer. The class that implements such interfaces is
DI'ed with the a few components required to fulfill whatever that method
is supposed to do. Such approach is basically making a closure over a
function by hands. If so, why wouldn't I just go with delegates that do it
naturally and for free (no typing necessary)? If I go all the way
converting single method interfaces to delegates I will eliminate 95% of
them from my code making it look like written in functional language. But
this seems like a right thing to do unless there is some bold reason to
stick with interfaces. Is there?
Making a text field uneditable and not just readonly
Making a text field uneditable and not just readonly
When i click on a textfield, i get a dropdown so the user could select a
value from the list.
After the user selects the date from the dropdown, he/she could edit the
date by even adding characters to it. So i want to find a way to prevent
this. I thought of making the field un-editable. So i used readonly but,
this prevents the user from clicking and displaying the list. So can
someone tell me how can i make the field uneditable.
<input id="datePiccc" type="text" class="dates" />
When i click on a textfield, i get a dropdown so the user could select a
value from the list.
After the user selects the date from the dropdown, he/she could edit the
date by even adding characters to it. So i want to find a way to prevent
this. I thought of making the field un-editable. So i used readonly but,
this prevents the user from clicking and displaying the list. So can
someone tell me how can i make the field uneditable.
<input id="datePiccc" type="text" class="dates" />
How to preserve grouping in subquery
How to preserve grouping in subquery
Hello i have a sql query like this:
SELECT
COUNT(*) AS total,
COUNT(referrer) AS referrer,
DATE_FORMAT(created_at, "%Y") AS YEAR,
DATE_FORMAT(created_at, "%m") AS MONTH,
DATE_FORMAT(created_at, "%d") AS DAY
FROM
users
GROUP BY
EXTRACT(DAY FROM created_at),
EXTRACT(MONTH FROM created_at),
EXTRACT(YEAR FROM created_at)
ORDER BY
created_at ASC
This gives me table with totals sorted by day (month and year). what i
need is to add a subquery to display one more count() which has a
condition. Something like:
(SELECT count(*) FROM users WHERE result = '1') as winners
the problem obviously is with the grouping of main query since i get same
result without grouping the subquery for every row.
What would be the right way to execute such query?
Hello i have a sql query like this:
SELECT
COUNT(*) AS total,
COUNT(referrer) AS referrer,
DATE_FORMAT(created_at, "%Y") AS YEAR,
DATE_FORMAT(created_at, "%m") AS MONTH,
DATE_FORMAT(created_at, "%d") AS DAY
FROM
users
GROUP BY
EXTRACT(DAY FROM created_at),
EXTRACT(MONTH FROM created_at),
EXTRACT(YEAR FROM created_at)
ORDER BY
created_at ASC
This gives me table with totals sorted by day (month and year). what i
need is to add a subquery to display one more count() which has a
condition. Something like:
(SELECT count(*) FROM users WHERE result = '1') as winners
the problem obviously is with the grouping of main query since i get same
result without grouping the subquery for every row.
What would be the right way to execute such query?
Thursday, 26 September 2013
How to place DropDownList1_selectedIndexChanged event in JSON.Parse()
How to place DropDownList1_selectedIndexChanged event in JSON.Parse()
function initialize() {
var markers = JSON.parse('<%=ConvertDataTabletoString()%>');
var mapOptions = {
center: new google.maps.LatLng(markers[0].lat, markers[0].lng),
zoom: 5,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
Please help me..how to place that event in JSON.Parse method..I already
create "ConvertDataTableString()..but i want to change the location in
dropdown list..for that i placed dropdown list..please say any one....
function initialize() {
var markers = JSON.parse('<%=ConvertDataTabletoString()%>');
var mapOptions = {
center: new google.maps.LatLng(markers[0].lat, markers[0].lng),
zoom: 5,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
Please help me..how to place that event in JSON.Parse method..I already
create "ConvertDataTableString()..but i want to change the location in
dropdown list..for that i placed dropdown list..please say any one....
Wednesday, 25 September 2013
Using sqlite in multithreaded environment
Using sqlite in multithreaded environment
I've been trying to wrap my head around SQLite docs about multithreading,
but still not quite get it. Let say I have 2 threads that read and write
from/to DB. My write consists of multiple sql statements, so I need wrap
them in explicit transaction, something like this:
sqlite3_exec (myDb, "BEGIN TRANSACTION", 0, 0, 0);
// write stuff here
sqlite3_exec (myDb, "COMMIT TRANSACTION", 0, 0, 0);
First question: do I need wrap read operations in transaction the main
requirement for me that until write transaction finishes it should not be
possible to read half written data
Second: can I use one database connection in both threads? - looks like I
can't because if both threads are writing to DB and therefore both open
transactions second "BEGIN TRANSACTION" statement will fail.
So what is right approach here: Use own locking mechanism? Use one
connection per thread? - what will happen in that case, should I worry
about SQL_BUSY/SQL_LOCKED?
Thanks!
I've been trying to wrap my head around SQLite docs about multithreading,
but still not quite get it. Let say I have 2 threads that read and write
from/to DB. My write consists of multiple sql statements, so I need wrap
them in explicit transaction, something like this:
sqlite3_exec (myDb, "BEGIN TRANSACTION", 0, 0, 0);
// write stuff here
sqlite3_exec (myDb, "COMMIT TRANSACTION", 0, 0, 0);
First question: do I need wrap read operations in transaction the main
requirement for me that until write transaction finishes it should not be
possible to read half written data
Second: can I use one database connection in both threads? - looks like I
can't because if both threads are writing to DB and therefore both open
transactions second "BEGIN TRANSACTION" statement will fail.
So what is right approach here: Use own locking mechanism? Use one
connection per thread? - what will happen in that case, should I worry
about SQL_BUSY/SQL_LOCKED?
Thanks!
Thursday, 19 September 2013
How to monkeypatch a .class file in a jar
How to monkeypatch a .class file in a jar
I have a jar file that cannot be modified, but I want to use a different
.class file in place of one of the members of the jar. How can I tell Java
to use the external .class file when the code within the jar attempts to
load it?
I have a jar file that cannot be modified, but I want to use a different
.class file in place of one of the members of the jar. How can I tell Java
to use the external .class file when the code within the jar attempts to
load it?
propogating error upwards in java
propogating error upwards in java
I have a main class where I have something like
void FooBar(String s){
try {
parseString(s);
} catch (Exception e) {
e.printStackTrace();
System.err.println("Error: " + e.getMessage());
context.getCounter(Counters.ERROR).increment(1); // this increment
doesnt increases
}
}
parseString is
void ParseString(String s){
if (matcher.matches()) {
}
else{
//throw exception
try {
throw new Exception("bad formatted N-triples");
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
But for some reason, the error is not propogated upwards...So in my FooBar
method.. the error counters are not incremented even if the function gets
bad formatted data..
How do I propagate this exception upwards?
I have a main class where I have something like
void FooBar(String s){
try {
parseString(s);
} catch (Exception e) {
e.printStackTrace();
System.err.println("Error: " + e.getMessage());
context.getCounter(Counters.ERROR).increment(1); // this increment
doesnt increases
}
}
parseString is
void ParseString(String s){
if (matcher.matches()) {
}
else{
//throw exception
try {
throw new Exception("bad formatted N-triples");
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
But for some reason, the error is not propogated upwards...So in my FooBar
method.. the error counters are not incremented even if the function gets
bad formatted data..
How do I propagate this exception upwards?
why would the included content send to client as response body when including a no-php file using _include_
why would the included content send to client as response body when
including a no-php file using _include_
here are two files:
index.php:
<?php
include 'index.txt';
?>
index.txt
Hello, Cifer.
when requesting index.php the browser will shows 'Hello, Cifer', what to
my confusion is the mechanism of include, the PHP Manual says many things
about include but does not point out that the include will cause the
included content to be sent to client as response body when the included
content are not closed by <?php ?>.
so, what the mechanism of include in detail?
including a no-php file using _include_
here are two files:
index.php:
<?php
include 'index.txt';
?>
index.txt
Hello, Cifer.
when requesting index.php the browser will shows 'Hello, Cifer', what to
my confusion is the mechanism of include, the PHP Manual says many things
about include but does not point out that the include will cause the
included content to be sent to client as response body when the included
content are not closed by <?php ?>.
so, what the mechanism of include in detail?
PC App to pass strings to android app
PC App to pass strings to android app
I am totally new in this area. I need to do the following.
PC app sends string to android app
Android app processes the string data and send string info to pc app.
PC app updates the log.
Android phone will be connected to pc via usb cable.
Kindly let me know how can I proceed for communication between pc app and
android app as above.
Regards,
Madiya
I am totally new in this area. I need to do the following.
PC app sends string to android app
Android app processes the string data and send string info to pc app.
PC app updates the log.
Android phone will be connected to pc via usb cable.
Kindly let me know how can I proceed for communication between pc app and
android app as above.
Regards,
Madiya
Format the date - on the basis of month MSACCES
Format the date - on the basis of month MSACCES
I wanted to query the msaccess database - to get the data something like
Month Count Jan 4 Feb 2
i am having columns in my database namely [ Taskdate and count ], how to
filter the date on the basis of month and get the count assoicated with
that month??
SELECT Format([Taskdate],"dd/mm/yyyy") AS MyDate , count (Taskcount)
FROM Table1 GROUP BY Format([Taskdate],"dd/mm/yyyy")
I wanted to query the msaccess database - to get the data something like
Month Count Jan 4 Feb 2
i am having columns in my database namely [ Taskdate and count ], how to
filter the date on the basis of month and get the count assoicated with
that month??
SELECT Format([Taskdate],"dd/mm/yyyy") AS MyDate , count (Taskcount)
FROM Table1 GROUP BY Format([Taskdate],"dd/mm/yyyy")
Execute task on hosts which match a pattern
Execute task on hosts which match a pattern
We use this pattern for our hosts (and linux users):
coreapp_customer_stageID@server
I want to run fabric commands on a list of hosts which match a pattern.
Example: I want to run "date" on all hosts of core app "foocms" of
customer "c1".
I could use roles, but there are a lot of customers ... A glob matching
way would be good.
We use this pattern for our hosts (and linux users):
coreapp_customer_stageID@server
I want to run fabric commands on a list of hosts which match a pattern.
Example: I want to run "date" on all hosts of core app "foocms" of
customer "c1".
I could use roles, but there are a lot of customers ... A glob matching
way would be good.
Wednesday, 18 September 2013
Unable to insert Dynamics CRM record via SOAP request for datatype "Money"
Unable to insert Dynamics CRM record via SOAP request for datatype "Money"
I am trying to send an XML SOAP request(given below) to my Microsoft
Dynamics crm . However its throwing me error. I realized that it goes
through if I avoid
<b:KeyValuePairOfstringanyType> <c:key>new_grantprojecttotalcost</c:key>
<c:value i:type='a:Money'><b:Value>1234.00</b:Value></c:value>
</b:KeyValuePairOfstringanyType><b:KeyValuePairOfstringanyType>
<c:key>new_grantprojectfundingrequired</c:key> <c:value
i:type='a:Money'><b:Value>123.00</b:Value></c:value>
</b:KeyValuePairOfstringanyType>
which is of datatype Money.
The complete request looks like this
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope"
xmlns:a="http://www.w3.org/2005/08/addressing"
xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<s:Header>
<a:Action s:mustUnderstand="1">
http://schemas.microsoft.com/xrm/2011/Contracts/Services/IOrganizationService/Create</a:Action>
<a:MessageID>
urn:uuid:6511f419-3d6d-446f-852e-ffd1169d1d14</a:MessageID>
<a:ReplyTo>
<a:Address>
http://www.w3.org/2005/08/addressing/anonymous</a:Address>
</a:ReplyTo>
<VsDebuggerCausalityData
xmlns="http://schemas.microsoft.com/vstudio/diagnostics/servicemodelsink">
uIDPozJEz+P/wJdOhoN2XNauvYcAAAAAK0Y6fOjvMEqbgs9ivCmFPaZlxcAnCJ1GiX+Rpi09nSYACQAA</VsDebuggerCausalityData>
<a:To s:mustUnderstand="1">
https://scy.crm4.dynamics.com/XRMServices/2011/Organization.svc</a:To>
<o:Security s:mustUnderstand="1"
xmlns:o="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<u:Timestamp u:Id="_0">
<u:Created>2013-09-19T05:27:01.35Z</u:Created>
<u:Expires>2013-09-19T05:32:01.35Z</u:Expires>
</u:Timestamp>
<EncryptedData Id="Assertion0"
Type="http://www.w3.org/2001/04/xmlenc#Element"
xmlns="http://www.w3.org/2001/04/xmlenc#">
<EncryptionMethod
Algorithm="http://www.w3.org/2001/04/xmlenc#tripledes-cbc">
</EncryptionMethod>
<ds:KeyInfo
xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
<EncryptedKey>
<EncryptionMethod
Algorithm="http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p">
</EncryptionMethod>
<ds:KeyInfo Id="keyinfo">
<wsse:SecurityTokenReference
xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<wsse:KeyIdentifier
EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary"
ValueType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509SubjectKeyIdentifier">
</wsse:KeyIdentifier>
</wsse:SecurityTokenReference>
</ds:KeyInfo>
<CipherData>
<CipherValue>
</CipherValue>
</CipherData>
</EncryptedKey>
</ds:KeyInfo>
<CipherData>
<CipherValue>
</CipherValue>
</CipherData>
</EncryptedData>
</o:Security>
</s:Header>
<s:Body>
<Create
xmlns='http://schemas.microsoft.com/xrm/2011/Contracts/Services'>
<entity xmlns:b='http://schemas.microsoft.com/xrm/2011/Contracts'
xmlns:i='http://www.w3.org/2001/XMLSchema-instance'>
<b:Attributes
xmlns:c='http://schemas.datacontract.org/2004/07/System.Collections.Generic'><b:KeyValuePairOfstringanyType>
<c:key>scy_name</c:key>
<c:value i:type='d:string'
xmlns:d='http://www.w3.org/2001/XMLSchema'>Business Grant
Programme Application</c:value>
</b:KeyValuePairOfstringanyType><b:KeyValuePairOfstringanyType>
<c:key>new_fullname</c:key>
<c:value i:type='d:string'
xmlns:d='http://www.w3.org/2001/XMLSchema'>Aboo Tafadar4</c:value>
</b:KeyValuePairOfstringanyType><b:KeyValuePairOfstringanyType>
<c:key>new_jobtitle</c:key>
<c:value i:type='d:string'
xmlns:d='http://www.w3.org/2001/XMLSchema'>Iquara</c:value>
</b:KeyValuePairOfstringanyType><b:KeyValuePairOfstringanyType>
<c:key>scy_accountname</c:key>
<c:value i:type='d:string'
xmlns:d='http://www.w3.org/2001/XMLSchema'>Iquara</c:value>
</b:KeyValuePairOfstringanyType><b:KeyValuePairOfstringanyType>
<c:key>scy_emailaddress</c:key>
<c:value i:type='d:string'
xmlns:d='http://www.w3.org/2001/XMLSchema'>soyeed2004@gmail.com</c:value>
</b:KeyValuePairOfstringanyType><b:KeyValuePairOfstringanyType>
<c:key>scy_contactphone</c:key>
<c:value i:type='d:string'
xmlns:d='http://www.w3.org/2001/XMLSchema'>913642225808</c:value>
</b:KeyValuePairOfstringanyType><b:KeyValuePairOfstringanyType>
<c:key>scy_addressline1</c:key>
<c:value i:type='d:string'
xmlns:d='http://www.w3.org/2001/XMLSchema'>Bivar Road</c:value>
</b:KeyValuePairOfstringanyType><b:KeyValuePairOfstringanyType>
<c:key>scy_addressline2</c:key>
<c:value i:type='d:string'
xmlns:d='http://www.w3.org/2001/XMLSchema'>aaaa</c:value>
</b:KeyValuePairOfstringanyType><b:KeyValuePairOfstringanyType>
<c:key>scy_addressline3</c:key>
<c:value i:type='d:string'
xmlns:d='http://www.w3.org/2001/XMLSchema'>Iquara Ltd,
Catalyst</c:value>
</b:KeyValuePairOfstringanyType><b:KeyValuePairOfstringanyType>
<c:key>scy_city</c:key>
<c:value i:type='d:string'
xmlns:d='http://www.w3.org/2001/XMLSchema'>York</c:value>
</b:KeyValuePairOfstringanyType><b:KeyValuePairOfstringanyType>
<c:key>scy_postcode</c:key>
<c:value i:type='d:string'
xmlns:d='http://www.w3.org/2001/XMLSchema'>yo103jy</c:value>
</b:KeyValuePairOfstringanyType><b:KeyValuePairOfstringanyType>
<c:key>new_registeredaddress1</c:key>
<c:value i:type='d:string'
xmlns:d='http://www.w3.org/2001/XMLSchema'>Iquara Ltd,
Catalyst</c:value>
</b:KeyValuePairOfstringanyType><b:KeyValuePairOfstringanyType>
<c:key>new_registeredaddress2</c:key>
<c:value i:type='d:string'
xmlns:d='http://www.w3.org/2001/XMLSchema'>University of
York</c:value>
</b:KeyValuePairOfstringanyType><b:KeyValuePairOfstringanyType>
<c:key>new_registeredaddress3</c:key>
<c:value i:type='d:string'
xmlns:d='http://www.w3.org/2001/XMLSchema'>Iquara Ltd,
Catalyst</c:value>
</b:KeyValuePairOfstringanyType><b:KeyValuePairOfstringanyType>
<c:key>new_registeredcity</c:key>
<c:value i:type='d:string'
xmlns:d='http://www.w3.org/2001/XMLSchema'>York</c:value>
</b:KeyValuePairOfstringanyType><b:KeyValuePairOfstringanyType>
<c:key>new_registeredpostcode</c:key>
<c:value i:type='d:string'
xmlns:d='http://www.w3.org/2001/XMLSchema'>yo103jy</c:value>
</b:KeyValuePairOfstringanyType><b:KeyValuePairOfstringanyType>
<c:key>scy_websiteurl</c:key>
<c:value i:type='d:string'
xmlns:d='http://www.w3.org/2001/XMLSchema'>iquara</c:value>
</b:KeyValuePairOfstringanyType><b:KeyValuePairOfstringanyType>
<c:key>scy_companynumber</c:key>
<c:value i:type='d:string'
xmlns:d='http://www.w3.org/2001/XMLSchema'>1787686</c:value>
</b:KeyValuePairOfstringanyType><b:KeyValuePairOfstringanyType>
<c:key>new_yearstartedtrading</c:key>
<c:value i:type='d:string'
xmlns:d='http://www.w3.org/2001/XMLSchema'>1980</c:value>
</b:KeyValuePairOfstringanyType><b:KeyValuePairOfstringanyType>
<c:key>scy_description</c:key>
<c:value i:type='d:string'
xmlns:d='http://www.w3.org/2001/XMLSchema'>hghghjg</c:value>
</b:KeyValuePairOfstringanyType><b:KeyValuePairOfstringanyType>
<c:key>new_grantprojectdescription</c:key>
<c:value i:type='d:string'
xmlns:d='http://www.w3.org/2001/XMLSchema'>khkkjh</c:value>
</b:KeyValuePairOfstringanyType><b:KeyValuePairOfstringanyType>
<c:key>new_grantprojecttotalcost</c:key>
<c:value i:type='a:Money'><b:Value>1234.00</b:Value></c:value>
</b:KeyValuePairOfstringanyType><b:KeyValuePairOfstringanyType>
<c:key>new_grantprojectfundingrequired</c:key>
<c:value i:type='a:Money'><b:Value>123.00</b:Value></c:value>
</b:KeyValuePairOfstringanyType><b:KeyValuePairOfstringanyType>
<c:key>scy_leadsource</c:key>
<c:value
i:type='b:OptionSetValue'><b:Value>798110007</b:Value></c:value>
</b:KeyValuePairOfstringanyType><b:KeyValuePairOfstringanyType>
<c:key>new_sendmarketinginfo</c:key>
<c:value
i:type='b:OptionSetValue'><b:Value>100000001</b:Value></c:value>
</b:KeyValuePairOfstringanyType><b:KeyValuePairOfstringanyType>
<c:key>new_grantprojecteligibility</c:key>
<c:value
i:type='b:OptionSetValue'><b:Value>100000000</b:Value></c:value>
</b:KeyValuePairOfstringanyType></b:Attributes>
<b:EntityState i:nil='true'/>
<b:FormattedValues
xmlns:c='http://schemas.datacontract.org/2004/07/System.Collections.Generic'/>
<b:Id>00000000-0000-0000-0000-000000000000</b:Id>
<b:LogicalName>scy_webformrecord</b:LogicalName>
<b:RelatedEntities
xmlns:c='http://schemas.datacontract.org/2004/07/System.Collections.Generic'/>
</entity>
</Create>
</s:Body>
</s:Envelope>
I am trying to send an XML SOAP request(given below) to my Microsoft
Dynamics crm . However its throwing me error. I realized that it goes
through if I avoid
<b:KeyValuePairOfstringanyType> <c:key>new_grantprojecttotalcost</c:key>
<c:value i:type='a:Money'><b:Value>1234.00</b:Value></c:value>
</b:KeyValuePairOfstringanyType><b:KeyValuePairOfstringanyType>
<c:key>new_grantprojectfundingrequired</c:key> <c:value
i:type='a:Money'><b:Value>123.00</b:Value></c:value>
</b:KeyValuePairOfstringanyType>
which is of datatype Money.
The complete request looks like this
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope"
xmlns:a="http://www.w3.org/2005/08/addressing"
xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<s:Header>
<a:Action s:mustUnderstand="1">
http://schemas.microsoft.com/xrm/2011/Contracts/Services/IOrganizationService/Create</a:Action>
<a:MessageID>
urn:uuid:6511f419-3d6d-446f-852e-ffd1169d1d14</a:MessageID>
<a:ReplyTo>
<a:Address>
http://www.w3.org/2005/08/addressing/anonymous</a:Address>
</a:ReplyTo>
<VsDebuggerCausalityData
xmlns="http://schemas.microsoft.com/vstudio/diagnostics/servicemodelsink">
uIDPozJEz+P/wJdOhoN2XNauvYcAAAAAK0Y6fOjvMEqbgs9ivCmFPaZlxcAnCJ1GiX+Rpi09nSYACQAA</VsDebuggerCausalityData>
<a:To s:mustUnderstand="1">
https://scy.crm4.dynamics.com/XRMServices/2011/Organization.svc</a:To>
<o:Security s:mustUnderstand="1"
xmlns:o="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<u:Timestamp u:Id="_0">
<u:Created>2013-09-19T05:27:01.35Z</u:Created>
<u:Expires>2013-09-19T05:32:01.35Z</u:Expires>
</u:Timestamp>
<EncryptedData Id="Assertion0"
Type="http://www.w3.org/2001/04/xmlenc#Element"
xmlns="http://www.w3.org/2001/04/xmlenc#">
<EncryptionMethod
Algorithm="http://www.w3.org/2001/04/xmlenc#tripledes-cbc">
</EncryptionMethod>
<ds:KeyInfo
xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
<EncryptedKey>
<EncryptionMethod
Algorithm="http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p">
</EncryptionMethod>
<ds:KeyInfo Id="keyinfo">
<wsse:SecurityTokenReference
xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<wsse:KeyIdentifier
EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary"
ValueType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509SubjectKeyIdentifier">
</wsse:KeyIdentifier>
</wsse:SecurityTokenReference>
</ds:KeyInfo>
<CipherData>
<CipherValue>
</CipherValue>
</CipherData>
</EncryptedKey>
</ds:KeyInfo>
<CipherData>
<CipherValue>
</CipherValue>
</CipherData>
</EncryptedData>
</o:Security>
</s:Header>
<s:Body>
<Create
xmlns='http://schemas.microsoft.com/xrm/2011/Contracts/Services'>
<entity xmlns:b='http://schemas.microsoft.com/xrm/2011/Contracts'
xmlns:i='http://www.w3.org/2001/XMLSchema-instance'>
<b:Attributes
xmlns:c='http://schemas.datacontract.org/2004/07/System.Collections.Generic'><b:KeyValuePairOfstringanyType>
<c:key>scy_name</c:key>
<c:value i:type='d:string'
xmlns:d='http://www.w3.org/2001/XMLSchema'>Business Grant
Programme Application</c:value>
</b:KeyValuePairOfstringanyType><b:KeyValuePairOfstringanyType>
<c:key>new_fullname</c:key>
<c:value i:type='d:string'
xmlns:d='http://www.w3.org/2001/XMLSchema'>Aboo Tafadar4</c:value>
</b:KeyValuePairOfstringanyType><b:KeyValuePairOfstringanyType>
<c:key>new_jobtitle</c:key>
<c:value i:type='d:string'
xmlns:d='http://www.w3.org/2001/XMLSchema'>Iquara</c:value>
</b:KeyValuePairOfstringanyType><b:KeyValuePairOfstringanyType>
<c:key>scy_accountname</c:key>
<c:value i:type='d:string'
xmlns:d='http://www.w3.org/2001/XMLSchema'>Iquara</c:value>
</b:KeyValuePairOfstringanyType><b:KeyValuePairOfstringanyType>
<c:key>scy_emailaddress</c:key>
<c:value i:type='d:string'
xmlns:d='http://www.w3.org/2001/XMLSchema'>soyeed2004@gmail.com</c:value>
</b:KeyValuePairOfstringanyType><b:KeyValuePairOfstringanyType>
<c:key>scy_contactphone</c:key>
<c:value i:type='d:string'
xmlns:d='http://www.w3.org/2001/XMLSchema'>913642225808</c:value>
</b:KeyValuePairOfstringanyType><b:KeyValuePairOfstringanyType>
<c:key>scy_addressline1</c:key>
<c:value i:type='d:string'
xmlns:d='http://www.w3.org/2001/XMLSchema'>Bivar Road</c:value>
</b:KeyValuePairOfstringanyType><b:KeyValuePairOfstringanyType>
<c:key>scy_addressline2</c:key>
<c:value i:type='d:string'
xmlns:d='http://www.w3.org/2001/XMLSchema'>aaaa</c:value>
</b:KeyValuePairOfstringanyType><b:KeyValuePairOfstringanyType>
<c:key>scy_addressline3</c:key>
<c:value i:type='d:string'
xmlns:d='http://www.w3.org/2001/XMLSchema'>Iquara Ltd,
Catalyst</c:value>
</b:KeyValuePairOfstringanyType><b:KeyValuePairOfstringanyType>
<c:key>scy_city</c:key>
<c:value i:type='d:string'
xmlns:d='http://www.w3.org/2001/XMLSchema'>York</c:value>
</b:KeyValuePairOfstringanyType><b:KeyValuePairOfstringanyType>
<c:key>scy_postcode</c:key>
<c:value i:type='d:string'
xmlns:d='http://www.w3.org/2001/XMLSchema'>yo103jy</c:value>
</b:KeyValuePairOfstringanyType><b:KeyValuePairOfstringanyType>
<c:key>new_registeredaddress1</c:key>
<c:value i:type='d:string'
xmlns:d='http://www.w3.org/2001/XMLSchema'>Iquara Ltd,
Catalyst</c:value>
</b:KeyValuePairOfstringanyType><b:KeyValuePairOfstringanyType>
<c:key>new_registeredaddress2</c:key>
<c:value i:type='d:string'
xmlns:d='http://www.w3.org/2001/XMLSchema'>University of
York</c:value>
</b:KeyValuePairOfstringanyType><b:KeyValuePairOfstringanyType>
<c:key>new_registeredaddress3</c:key>
<c:value i:type='d:string'
xmlns:d='http://www.w3.org/2001/XMLSchema'>Iquara Ltd,
Catalyst</c:value>
</b:KeyValuePairOfstringanyType><b:KeyValuePairOfstringanyType>
<c:key>new_registeredcity</c:key>
<c:value i:type='d:string'
xmlns:d='http://www.w3.org/2001/XMLSchema'>York</c:value>
</b:KeyValuePairOfstringanyType><b:KeyValuePairOfstringanyType>
<c:key>new_registeredpostcode</c:key>
<c:value i:type='d:string'
xmlns:d='http://www.w3.org/2001/XMLSchema'>yo103jy</c:value>
</b:KeyValuePairOfstringanyType><b:KeyValuePairOfstringanyType>
<c:key>scy_websiteurl</c:key>
<c:value i:type='d:string'
xmlns:d='http://www.w3.org/2001/XMLSchema'>iquara</c:value>
</b:KeyValuePairOfstringanyType><b:KeyValuePairOfstringanyType>
<c:key>scy_companynumber</c:key>
<c:value i:type='d:string'
xmlns:d='http://www.w3.org/2001/XMLSchema'>1787686</c:value>
</b:KeyValuePairOfstringanyType><b:KeyValuePairOfstringanyType>
<c:key>new_yearstartedtrading</c:key>
<c:value i:type='d:string'
xmlns:d='http://www.w3.org/2001/XMLSchema'>1980</c:value>
</b:KeyValuePairOfstringanyType><b:KeyValuePairOfstringanyType>
<c:key>scy_description</c:key>
<c:value i:type='d:string'
xmlns:d='http://www.w3.org/2001/XMLSchema'>hghghjg</c:value>
</b:KeyValuePairOfstringanyType><b:KeyValuePairOfstringanyType>
<c:key>new_grantprojectdescription</c:key>
<c:value i:type='d:string'
xmlns:d='http://www.w3.org/2001/XMLSchema'>khkkjh</c:value>
</b:KeyValuePairOfstringanyType><b:KeyValuePairOfstringanyType>
<c:key>new_grantprojecttotalcost</c:key>
<c:value i:type='a:Money'><b:Value>1234.00</b:Value></c:value>
</b:KeyValuePairOfstringanyType><b:KeyValuePairOfstringanyType>
<c:key>new_grantprojectfundingrequired</c:key>
<c:value i:type='a:Money'><b:Value>123.00</b:Value></c:value>
</b:KeyValuePairOfstringanyType><b:KeyValuePairOfstringanyType>
<c:key>scy_leadsource</c:key>
<c:value
i:type='b:OptionSetValue'><b:Value>798110007</b:Value></c:value>
</b:KeyValuePairOfstringanyType><b:KeyValuePairOfstringanyType>
<c:key>new_sendmarketinginfo</c:key>
<c:value
i:type='b:OptionSetValue'><b:Value>100000001</b:Value></c:value>
</b:KeyValuePairOfstringanyType><b:KeyValuePairOfstringanyType>
<c:key>new_grantprojecteligibility</c:key>
<c:value
i:type='b:OptionSetValue'><b:Value>100000000</b:Value></c:value>
</b:KeyValuePairOfstringanyType></b:Attributes>
<b:EntityState i:nil='true'/>
<b:FormattedValues
xmlns:c='http://schemas.datacontract.org/2004/07/System.Collections.Generic'/>
<b:Id>00000000-0000-0000-0000-000000000000</b:Id>
<b:LogicalName>scy_webformrecord</b:LogicalName>
<b:RelatedEntities
xmlns:c='http://schemas.datacontract.org/2004/07/System.Collections.Generic'/>
</entity>
</Create>
</s:Body>
</s:Envelope>
How can I fix this program dealign with pairs of Booleans in Haskell?
How can I fix this program dealign with pairs of Booleans in Haskell?
For part of a homework assignment in a beginner Haskell course, I'm trying
to write a program that will take a list of pairs of Bools, and returns a
list of Bools coming from the pairs of bools with an "&&" between them.
For example...
andandbool [(True,True),(True,False),(False,True),(False,False)]
would return:
[True, False, False, False]
I keep running into trouble, however. My code looks like this.
andandbool :: [(Bool,Bool)] -> [Bool]
andandbool [a] = [fst x && snd x | x <- [a]]
It works fine when I provide a list of only one pair, but reports
"Non-exhaustive patterns in function andandbool" when I enter a list of
multiple pairs. Is there some sort of list comprehension that I'm missing?
Any pointers in the right direction would be greatly appreciated.
For part of a homework assignment in a beginner Haskell course, I'm trying
to write a program that will take a list of pairs of Bools, and returns a
list of Bools coming from the pairs of bools with an "&&" between them.
For example...
andandbool [(True,True),(True,False),(False,True),(False,False)]
would return:
[True, False, False, False]
I keep running into trouble, however. My code looks like this.
andandbool :: [(Bool,Bool)] -> [Bool]
andandbool [a] = [fst x && snd x | x <- [a]]
It works fine when I provide a list of only one pair, but reports
"Non-exhaustive patterns in function andandbool" when I enter a list of
multiple pairs. Is there some sort of list comprehension that I'm missing?
Any pointers in the right direction would be greatly appreciated.
push and pop using array of doubles
push and pop using array of doubles
I have an assignment that is asking me to fill up a stack with random
variables and pop them out in a FILO order. Whilst I managed to get it to
work using just the int type, it seems that now i need to change it in
order to implement an array of doubles and it would fill the array with
characters using the type double and Keep popping out doubles from the
stack until it is empty and print them. I have tried just changing the
types in both functions but keep getting errors andI'm not sure why. This
is what i have so far by the way.Any help would be appreciated.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define STACK_SIZE 10
#define STACK_FULL -2
#define STACK_EMPTY -1
#define NORMAL 0
int myerror = NORMAL;
void push(double [],
double, // input - data being pushed onto the stack
double **, // input/output - pointer to pointer to the top of stack
int); // constant - maximum capacity of stack
double // output - data being popped out from the stack
pop(double [], // input/output - the stack
double **); // input/output - pointer to pointer to top of stack
void push(double stack[],
double item,
double **top,
int max_size){
stack[++(**top)] = item;
}
double pop(double stack[],
double **top){
return stack[(**top)--];
return 0.0;
}
int main(){
double s[STACK_SIZE];
double *s_top = NULL;
srand(time(NULL));
char randChar = ' ';
double i = 0;
double j=0;
double randNum = 0;
for (i = 0; i < STACK_SIZE; i++){
randNum = 33 + (double)(rand() % ((126-33)+ 1 ));
randChar = (double) randNum;
push(s,randChar, &(*s_top), STACK_SIZE);
printf ("Random characters: %c\n", randChar);}
printf("-----------\n");
for(j=STACK_SIZE; j>0; j--){
printf("Random characters: %c\n", pop(s, & *s_top));
}
return 0;
}
I have an assignment that is asking me to fill up a stack with random
variables and pop them out in a FILO order. Whilst I managed to get it to
work using just the int type, it seems that now i need to change it in
order to implement an array of doubles and it would fill the array with
characters using the type double and Keep popping out doubles from the
stack until it is empty and print them. I have tried just changing the
types in both functions but keep getting errors andI'm not sure why. This
is what i have so far by the way.Any help would be appreciated.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define STACK_SIZE 10
#define STACK_FULL -2
#define STACK_EMPTY -1
#define NORMAL 0
int myerror = NORMAL;
void push(double [],
double, // input - data being pushed onto the stack
double **, // input/output - pointer to pointer to the top of stack
int); // constant - maximum capacity of stack
double // output - data being popped out from the stack
pop(double [], // input/output - the stack
double **); // input/output - pointer to pointer to top of stack
void push(double stack[],
double item,
double **top,
int max_size){
stack[++(**top)] = item;
}
double pop(double stack[],
double **top){
return stack[(**top)--];
return 0.0;
}
int main(){
double s[STACK_SIZE];
double *s_top = NULL;
srand(time(NULL));
char randChar = ' ';
double i = 0;
double j=0;
double randNum = 0;
for (i = 0; i < STACK_SIZE; i++){
randNum = 33 + (double)(rand() % ((126-33)+ 1 ));
randChar = (double) randNum;
push(s,randChar, &(*s_top), STACK_SIZE);
printf ("Random characters: %c\n", randChar);}
printf("-----------\n");
for(j=STACK_SIZE; j>0; j--){
printf("Random characters: %c\n", pop(s, & *s_top));
}
return 0;
}
What should be the result from a lookat function in a right handed system?
What should be the result from a lookat function in a right handed system?
I am using python's cgkit Mat44.lookat method and I am wondering if it is
implemented correctly. I wrote the author but got no answer so far. My
question is maybe silly, but I would really like to understand what's
wrong in my program.
if I do :
camera_to_world_matrix = mat4.lookAt(eye=vec3(0,0,1), target=vec3(0,0,-3),
up=vec3(0,1,0))
world_to_camera_matrix = camera_to_world_matrix.inverse()
pos_in_camera_space = world_to_camera_matrix * vec3(0,0,-10)
In my opinion, pos_in_camera_space should equal to vec3(0,0,-11) : the
distance is 11 units between the two positions and as we are in a right
handed system, the camera look toward the negative part of the z axis.
But I get vec3(0,0,11) and I don't see why.
I am using python's cgkit Mat44.lookat method and I am wondering if it is
implemented correctly. I wrote the author but got no answer so far. My
question is maybe silly, but I would really like to understand what's
wrong in my program.
if I do :
camera_to_world_matrix = mat4.lookAt(eye=vec3(0,0,1), target=vec3(0,0,-3),
up=vec3(0,1,0))
world_to_camera_matrix = camera_to_world_matrix.inverse()
pos_in_camera_space = world_to_camera_matrix * vec3(0,0,-10)
In my opinion, pos_in_camera_space should equal to vec3(0,0,-11) : the
distance is 11 units between the two positions and as we are in a right
handed system, the camera look toward the negative part of the z axis.
But I get vec3(0,0,11) and I don't see why.
Why spring init-method destroy-method methods behaving different?
Why spring init-method destroy-method methods behaving different?
I am new to springs. I am trying to call init and destroy method for
different bean invoking
public class DefaultMessage {
private String message = "Basic Bean injecting";
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public DefaultMessage(String message) {
this.message = message;
}
public DefaultMessage() {
}
public void init(){
System.out.println("Testing init.");
}
public void destory(){
System.out.println("Spring Container is destroyed.");
}
My XML is
<bean id="basicBean" class="com.sarma.spring.core.DefaultMessage"
init-method="init" destroy-method="destory"></bean>
Main class
//Type 1
ApplicationContext applicationContext =new
ClassPathXmlApplicationContext("DefaultMessage.xml");
//Basic Bean Testing
DefaultMessage message = (DefaultMessage)
applicationContext.getBean("basicBean");
log.info(message.getMessage());
log.info("---------------------------ApplicationContext
End------------------------------");
//Type 2
Resource res = new
FileSystemResource("C:\\Sarma\\Spring\\SpringEx\\src\\resource\\DefaultMessage.xml");
BeanFactory factory = new XmlBeanFactory(res);
DefaultMessage message1 = (DefaultMessage) factory.getBean("basicBean");
log.info("Test "+message1.getMessage());
log.info("- ---------------------------FileSystemResource
End------------------------------");
//Type 3
ClassPathResource res1 = new ClassPathResource("DefaultMessage.xml");
BeanFactory factory1 = new XmlBeanFactory(res1);
DefaultMessage message2 = (DefaultMessage) factory1.getBean("basicBean");
log.info("Test "+message2.getMessage());
log.info("- ---------------------------ClassPathResource
End-------------------------------");
//Type4
ConfigurableApplicationContext context = new
ClassPathXmlApplicationContext(new String[] {"DefaultMessage.xml"});
DefaultMessage message3 = (DefaultMessage) context.getBean("basicBean");
log.info(message3.getMessage());
context.close();
log.info("- ---------------------------ConfigurableApplicationContext
End------------------");
OUTPUT
2013-09-18 13:49:22 INFO ClassPathXmlApplicationContext:513 - Refreshing
org.springframework.context.support.ClassPathXmlApplicationContext@913750:
startup date [Wed Sep 18 13:49:22 EDT 2013]; root of context hierarchy
2013-09-18 13:49:22 INFO XmlBeanDefinitionReader:316 - Loading XML bean
definitions from class path resource [DefaultMessage.xml]
2013-09-18 13:49:22 INFO DefaultMessageMain:27 - Basic Bean injecting
2013-09-18 13:49:22 INFO DefaultMessageMain:29 -
---------------------------ApplicationContext
End------------------------------
2013-09-18 13:49:22 INFO XmlBeanDefinitionReader:316 - Loading XML bean
definitions from file
[C:\Sarma\Spring\SpringEx\src\resource\DefaultMessage.xml]
Testing init.
2013-09-18 13:49:22 INFO DefaultMessageMain:36 - Test Basic Bean injecting
2013-09-18 13:49:22 INFO DefaultMessageMain:37 - -
---------------------------FileSystemResource
End------------------------------
2013-09-18 13:49:22 INFO XmlBeanDefinitionReader:316 - Loading XML bean
definitions from class path resource [DefaultMessage.xml]
2013-09-18 13:49:22 INFO DefaultMessageMain:42 - Test Basic Bean injecting
2013-09-18 13:49:22 INFO DefaultMessageMain:43 - -
---------------------------ClassPathResource
End-------------------------------
2013-09-18 13:49:22 INFO ClassPathXmlApplicationContext:513 - Refreshing
org.springframework.context.support.ClassPathXmlApplicationContext@176e552:
startup date [Wed Sep 18 13:49:22 EDT 2013]; root of context hierarchy
2013-09-18 13:49:22 INFO XmlBeanDefinitionReader:316 - Loading XML bean
definitions from class path resource [DefaultMessage.xml]
2013-09-18 13:49:22 INFO DefaultMessageMain:47 - Basic Bean injecting
2013-09-18 13:49:22 INFO ClassPathXmlApplicationContext:873 - Closing
org.springframework.context.support.ClassPathXmlApplicationContext@176e552:
startup date [Wed Sep 18 13:49:22 EDT 2013]; root of context hierarchy
2013-09-18 13:49:22 INFO DefaultMessageMain:49 - -
---------------------------ConfigurableApplicationContext
End------------------
My init method is called for FileSystemResource,
Why it is behaving different?
It never called my destroy method
I am new to springs. I am trying to call init and destroy method for
different bean invoking
public class DefaultMessage {
private String message = "Basic Bean injecting";
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public DefaultMessage(String message) {
this.message = message;
}
public DefaultMessage() {
}
public void init(){
System.out.println("Testing init.");
}
public void destory(){
System.out.println("Spring Container is destroyed.");
}
My XML is
<bean id="basicBean" class="com.sarma.spring.core.DefaultMessage"
init-method="init" destroy-method="destory"></bean>
Main class
//Type 1
ApplicationContext applicationContext =new
ClassPathXmlApplicationContext("DefaultMessage.xml");
//Basic Bean Testing
DefaultMessage message = (DefaultMessage)
applicationContext.getBean("basicBean");
log.info(message.getMessage());
log.info("---------------------------ApplicationContext
End------------------------------");
//Type 2
Resource res = new
FileSystemResource("C:\\Sarma\\Spring\\SpringEx\\src\\resource\\DefaultMessage.xml");
BeanFactory factory = new XmlBeanFactory(res);
DefaultMessage message1 = (DefaultMessage) factory.getBean("basicBean");
log.info("Test "+message1.getMessage());
log.info("- ---------------------------FileSystemResource
End------------------------------");
//Type 3
ClassPathResource res1 = new ClassPathResource("DefaultMessage.xml");
BeanFactory factory1 = new XmlBeanFactory(res1);
DefaultMessage message2 = (DefaultMessage) factory1.getBean("basicBean");
log.info("Test "+message2.getMessage());
log.info("- ---------------------------ClassPathResource
End-------------------------------");
//Type4
ConfigurableApplicationContext context = new
ClassPathXmlApplicationContext(new String[] {"DefaultMessage.xml"});
DefaultMessage message3 = (DefaultMessage) context.getBean("basicBean");
log.info(message3.getMessage());
context.close();
log.info("- ---------------------------ConfigurableApplicationContext
End------------------");
OUTPUT
2013-09-18 13:49:22 INFO ClassPathXmlApplicationContext:513 - Refreshing
org.springframework.context.support.ClassPathXmlApplicationContext@913750:
startup date [Wed Sep 18 13:49:22 EDT 2013]; root of context hierarchy
2013-09-18 13:49:22 INFO XmlBeanDefinitionReader:316 - Loading XML bean
definitions from class path resource [DefaultMessage.xml]
2013-09-18 13:49:22 INFO DefaultMessageMain:27 - Basic Bean injecting
2013-09-18 13:49:22 INFO DefaultMessageMain:29 -
---------------------------ApplicationContext
End------------------------------
2013-09-18 13:49:22 INFO XmlBeanDefinitionReader:316 - Loading XML bean
definitions from file
[C:\Sarma\Spring\SpringEx\src\resource\DefaultMessage.xml]
Testing init.
2013-09-18 13:49:22 INFO DefaultMessageMain:36 - Test Basic Bean injecting
2013-09-18 13:49:22 INFO DefaultMessageMain:37 - -
---------------------------FileSystemResource
End------------------------------
2013-09-18 13:49:22 INFO XmlBeanDefinitionReader:316 - Loading XML bean
definitions from class path resource [DefaultMessage.xml]
2013-09-18 13:49:22 INFO DefaultMessageMain:42 - Test Basic Bean injecting
2013-09-18 13:49:22 INFO DefaultMessageMain:43 - -
---------------------------ClassPathResource
End-------------------------------
2013-09-18 13:49:22 INFO ClassPathXmlApplicationContext:513 - Refreshing
org.springframework.context.support.ClassPathXmlApplicationContext@176e552:
startup date [Wed Sep 18 13:49:22 EDT 2013]; root of context hierarchy
2013-09-18 13:49:22 INFO XmlBeanDefinitionReader:316 - Loading XML bean
definitions from class path resource [DefaultMessage.xml]
2013-09-18 13:49:22 INFO DefaultMessageMain:47 - Basic Bean injecting
2013-09-18 13:49:22 INFO ClassPathXmlApplicationContext:873 - Closing
org.springframework.context.support.ClassPathXmlApplicationContext@176e552:
startup date [Wed Sep 18 13:49:22 EDT 2013]; root of context hierarchy
2013-09-18 13:49:22 INFO DefaultMessageMain:49 - -
---------------------------ConfigurableApplicationContext
End------------------
My init method is called for FileSystemResource,
Why it is behaving different?
It never called my destroy method
How to refer to typedef defined in template class
How to refer to typedef defined in template class
I'm new to C++ templates and I'm heavily struggling with some compiler
complaints. I'm defining a class-scope type in a template class and want
to refer to this type from somewhere else. I tried different ways to
qualify the type's name but the only thing I achieve is getting different
error messages.
Here's the definition of my class in mylist.h, a classic list implementation:
template<typename T> class MyList {
public:
class ListElement; // forward declaration
typedef ListElement* LPOS; // the problematic typedef
// helper class for list elements
class ListElement {
LPOS next;
int content;
public:
ListElement(T);
LPOS getNext();
...
};
// the list itself
MyList();
ListElement* first;
LPOS add(T);
LPOS insert(T, LPOS);
... // more list functions
};
Now I want to use the LPOS type from outside in main.cpp:
include "mylist.h"
...
void testList (void) {
LPOS pos; // compiler error: expected ';' before pos
MyList<T>::LPOS pos; // compiler error: expected initializer before pos
MyList::LPOS pos; // compiler error: expected ';' before pos
I tried to use "using" but that didn't lead anywhere either. Any help will
be greatly appreciated.
I'm new to C++ templates and I'm heavily struggling with some compiler
complaints. I'm defining a class-scope type in a template class and want
to refer to this type from somewhere else. I tried different ways to
qualify the type's name but the only thing I achieve is getting different
error messages.
Here's the definition of my class in mylist.h, a classic list implementation:
template<typename T> class MyList {
public:
class ListElement; // forward declaration
typedef ListElement* LPOS; // the problematic typedef
// helper class for list elements
class ListElement {
LPOS next;
int content;
public:
ListElement(T);
LPOS getNext();
...
};
// the list itself
MyList();
ListElement* first;
LPOS add(T);
LPOS insert(T, LPOS);
... // more list functions
};
Now I want to use the LPOS type from outside in main.cpp:
include "mylist.h"
...
void testList (void) {
LPOS pos; // compiler error: expected ';' before pos
MyList<T>::LPOS pos; // compiler error: expected initializer before pos
MyList::LPOS pos; // compiler error: expected ';' before pos
I tried to use "using" but that didn't lead anywhere either. Any help will
be greatly appreciated.
Using AVX with GCC: __builtin_ia32_addpd256 not declared
Using AVX with GCC: __builtin_ia32_addpd256 not declared
If I #include <immintrin.h> I get this error:
error: '__builtin_ia32_addpd256' was not declared in this scope
I have defined __AVX__ and __FMA__ macros to make AVX avilable, but
apparently this isn't enough. There is no error if I use compiler flag
-mavx instead of the macros, but that solution is not acceptable. So, what
else should I defined to use AVX?
If I #include <immintrin.h> I get this error:
error: '__builtin_ia32_addpd256' was not declared in this scope
I have defined __AVX__ and __FMA__ macros to make AVX avilable, but
apparently this isn't enough. There is no error if I use compiler flag
-mavx instead of the macros, but that solution is not acceptable. So, what
else should I defined to use AVX?
Tuesday, 17 September 2013
Subclassing in javascript
Subclassing in javascript
I am learning java Script finding a way to make sub-classes in
java-script. I searched the web and found that we can create sub classes
by setting the prototype of our 'sub-class' to an instance of the
'super-class'.
What does this mean?And how does it gets implemented.?
I am learning java Script finding a way to make sub-classes in
java-script. I searched the web and found that we can create sub classes
by setting the prototype of our 'sub-class' to an instance of the
'super-class'.
What does this mean?And how does it gets implemented.?
How to retain/maintain collapse and expand states of even after a page refresh?
How to retain/maintain collapse and expand states of even after a page
refresh?
Suppose I have the following simple <p:panelMenu>.
<p:panelMenu style="width:200px">
<p:submenu label="Contents">
<p:menuitem value="MenuItem1" url="SomeURL" icon="ui-icon-disk" />
<p:menuitem value="MenuItem2" url="SomeURL" icon="ui-icon-disk" />
<p:menuitem value="MenuItem3" url="SomeURL" icon="ui-icon-disk" />
</p:submenu>
<p:separator />
<p:submenu label="Users">
<p:menuitem value="MenuItem1" url="SomeURL" icon="ui-icon-disk" />
<p:menuitem value="MenuItem2" url="SomeURL" icon="ui-icon-disk" />
<p:menuitem value="MenuItem3" url="SomeURL" icon="ui-icon-disk" />
</p:submenu>
</p:panelMenu>
Once a sub menu is expanded should remain expanded until it is explicitly
collapsed even after a page refresh.
Similarly, sometime later, if the sub menu is collapsed should remain
collapsed until it is explicitly expanded even after the page
reloaded/refreshed. Is this possible?
By the way, the following script expands a panelMenu by default.
$(".ui-panelmenu-content").css("display","block");
$(".ui-panelmenu-header").addClass("ui-state-active");
$(".ui-icon-triangle-1-e").removeClass("ui-icon-triangle-1-e").addClass("ui-icon-triangle-1-s");
And the following script expands the first sub menu of <p:panelMenu>, if
it is collapsed.
var isMenuExpanded =
jQuery('div.ui-panelmenu-content.ui-widget-content.ui-helper-hidden').is(':visible');
if(!isMenuExpanded)
{
jQuery('.ui-panelmenu-panel a').first().click();
}
refresh?
Suppose I have the following simple <p:panelMenu>.
<p:panelMenu style="width:200px">
<p:submenu label="Contents">
<p:menuitem value="MenuItem1" url="SomeURL" icon="ui-icon-disk" />
<p:menuitem value="MenuItem2" url="SomeURL" icon="ui-icon-disk" />
<p:menuitem value="MenuItem3" url="SomeURL" icon="ui-icon-disk" />
</p:submenu>
<p:separator />
<p:submenu label="Users">
<p:menuitem value="MenuItem1" url="SomeURL" icon="ui-icon-disk" />
<p:menuitem value="MenuItem2" url="SomeURL" icon="ui-icon-disk" />
<p:menuitem value="MenuItem3" url="SomeURL" icon="ui-icon-disk" />
</p:submenu>
</p:panelMenu>
Once a sub menu is expanded should remain expanded until it is explicitly
collapsed even after a page refresh.
Similarly, sometime later, if the sub menu is collapsed should remain
collapsed until it is explicitly expanded even after the page
reloaded/refreshed. Is this possible?
By the way, the following script expands a panelMenu by default.
$(".ui-panelmenu-content").css("display","block");
$(".ui-panelmenu-header").addClass("ui-state-active");
$(".ui-icon-triangle-1-e").removeClass("ui-icon-triangle-1-e").addClass("ui-icon-triangle-1-s");
And the following script expands the first sub menu of <p:panelMenu>, if
it is collapsed.
var isMenuExpanded =
jQuery('div.ui-panelmenu-content.ui-widget-content.ui-helper-hidden').is(':visible');
if(!isMenuExpanded)
{
jQuery('.ui-panelmenu-panel a').first().click();
}
send to phone ( txt / email ) change the FRM sender
send to phone ( txt / email ) change the FRM sender
Is there anyway to change the FROM information in a send to phone number
txt/email?
I have a site up I am building right now and looking on seeing if I can
make the email look better.
Check out http://phillysandcream.com/site/ - and click on "send to phone"
on the bottom left.
Enter in your cell and choose the carrier - hit send.
** this doesn't store your number - just sends a "txt email"
Everything looks fine - I am sending a message with the restaurant
information - but the FRM on top line say anonymous@messtudios.com....
messtudios.com is the dedicated hosting server all my clients website sit
under.
So- can I change the FRM to something like ( info@phillysandcream.com ) or
something else?
Thanks in advance. -Owen
Is there anyway to change the FROM information in a send to phone number
txt/email?
I have a site up I am building right now and looking on seeing if I can
make the email look better.
Check out http://phillysandcream.com/site/ - and click on "send to phone"
on the bottom left.
Enter in your cell and choose the carrier - hit send.
** this doesn't store your number - just sends a "txt email"
Everything looks fine - I am sending a message with the restaurant
information - but the FRM on top line say anonymous@messtudios.com....
messtudios.com is the dedicated hosting server all my clients website sit
under.
So- can I change the FRM to something like ( info@phillysandcream.com ) or
something else?
Thanks in advance. -Owen
Access selected text within a Hotkey object
Access selected text within a Hotkey object
Is it possible to grab user's selected text within Hotkey's scope?
var showHotKey = Hotkey({
combo: "accel-f1",
onPress: function() {
Addon.saveText(window.getSelection().toString());
}
});
Error ..
error: Addon: An exception occurred.
ReferenceError: window is not defined
resource://org/Addon/lib/main.js 14
Traceback (most recent call last):
File "resource://gre/modules/commonjs/sdk/keyboard/observer.js", line 39,
in handleEvent
this._emit(event.type, event, event.target.ownerDocument.defaultView);
File "resource://gre/modules/commonjs/sdk/deprecated/events.js", line 123,
in _emit
return this._emitOnObject.apply(this, args);
File "resource://gre/modules/commonjs/sdk/deprecated/events.js", line 153,
in _emitOnObject
listener.apply(targetObj, params);
File "resource://gre/modules/commonjs/sdk/keyboard/hotkeys.js", line 103,
in onKeypress
hotkey();
File "resource://org/Addon/lib/main.js", line 14, in showHotKey<.onPress
Addon.saveText(window.getSelection().toString());
Is it possible to grab user's selected text within Hotkey's scope?
var showHotKey = Hotkey({
combo: "accel-f1",
onPress: function() {
Addon.saveText(window.getSelection().toString());
}
});
Error ..
error: Addon: An exception occurred.
ReferenceError: window is not defined
resource://org/Addon/lib/main.js 14
Traceback (most recent call last):
File "resource://gre/modules/commonjs/sdk/keyboard/observer.js", line 39,
in handleEvent
this._emit(event.type, event, event.target.ownerDocument.defaultView);
File "resource://gre/modules/commonjs/sdk/deprecated/events.js", line 123,
in _emit
return this._emitOnObject.apply(this, args);
File "resource://gre/modules/commonjs/sdk/deprecated/events.js", line 153,
in _emitOnObject
listener.apply(targetObj, params);
File "resource://gre/modules/commonjs/sdk/keyboard/hotkeys.js", line 103,
in onKeypress
hotkey();
File "resource://org/Addon/lib/main.js", line 14, in showHotKey<.onPress
Addon.saveText(window.getSelection().toString());
NoMethodError undefined method in user model
NoMethodError undefined method in user model
While running 'user.within_miles(25).count(:all)' in console I am getting
a error, undefined method `area_for'. I am thinking my scope is wrong
which is causing the issue.
from /Users/app/models/user.rb:61:in `block in <class:User>'
from
/Users/.rvm/gems/ruby-2.0.0-p0/gems/activerecord-deprecated_finders-1.0.3/lib/active_record/deprecated_finders/base.rb:28:in
`call'
from
/Users/.rvm/gems/ruby-2.0.0-p0/gems/activerecord-deprecated_finders-1.0.3/lib/active_record/deprecated_finders/base.rb:28:in
`call'
from
/Users/.rvm/gems/ruby-2.0.0-p0/gems/activerecord-4.0.0.rc1/lib/active_record/scoping/named.rb:163:in
`block (2 levels) in scope'
from
/Users/.rvm/gems/ruby-2.0.0-p0/gems/activerecord-4.0.0.rc1/lib/active_record/relation.rb:246:in
`scoping'
from
/Users/.rvm/gems/ruby-2.0.0-p0/gems/activerecord-4.0.0.rc1/lib/active_record/scoping/named.rb:163:in
`block in scope'
from /Users/app/models/user.rb:78:in `within_miles'
from (irb):2
user.rb:
scope :within_miles_of_zip, lambda {|radius, zip|
# Get the parameters for the search
area = zip.area_for(radius)
# now find all zip codes that are within
# these min/max lat/lon bounds and return them
# weed out any zip codes that fall outside of the search radius
{ :select => "#{User.columns.map{|c| "users.#{c.name}"}.join(', ')},
sqrt(
pow(#{area[:lat_miles]} * (zips.lat - #{zip.lat}),2) +
pow(#{area[:lon_miles]} * (zips.lon - #{zip.lon}),2)) as distance",
:joins => :zip,
:conditions => "(zips.lat BETWEEN #{area[:min_lat]} AND
#{area[:max_lat]})
AND (zips.lon BETWEEN #{area[:min_lon]} AND #{area[:max_lon]})
AND sqrt(pow(#{area[:lat_miles]} * (zips.lat - #{zip.lat}),2) +
pow(#{area[:lon_miles]} * (zips.lon - #{zip.lon}),2)) <=
#{area[:radius]}",
:order => "distance"}
}
def within_miles(radius)
self.class.within_miles_of_zip(radius, zip)
end
zip.rb:
def area_for(radius)
area = {}
area[:radius] = radius.to_f
area[:lat_miles] = 69.172 #this is constant
#longitude miles varies based on latitude, that is calculated here
area[:lon_miles] = (area[:lat_miles] * Math.cos(lat *
(Math::PI/180))).abs
area[:lat_degrees] = radius/area[:lat_miles] #radius in degrees latitude
area[:lon_degrees] = radius/area[:lon_miles] #radius in degrees
longitude
#now set min and max lat and long accordingly
area[:min_lat] = lat - area[:lat_degrees]
area[:max_lat] = lat + area[:lat_degrees]
area[:min_lon] = lon - area[:lon_degrees]
area[:max_lon] = lon + area[:lon_degrees]
area
end
While running 'user.within_miles(25).count(:all)' in console I am getting
a error, undefined method `area_for'. I am thinking my scope is wrong
which is causing the issue.
from /Users/app/models/user.rb:61:in `block in <class:User>'
from
/Users/.rvm/gems/ruby-2.0.0-p0/gems/activerecord-deprecated_finders-1.0.3/lib/active_record/deprecated_finders/base.rb:28:in
`call'
from
/Users/.rvm/gems/ruby-2.0.0-p0/gems/activerecord-deprecated_finders-1.0.3/lib/active_record/deprecated_finders/base.rb:28:in
`call'
from
/Users/.rvm/gems/ruby-2.0.0-p0/gems/activerecord-4.0.0.rc1/lib/active_record/scoping/named.rb:163:in
`block (2 levels) in scope'
from
/Users/.rvm/gems/ruby-2.0.0-p0/gems/activerecord-4.0.0.rc1/lib/active_record/relation.rb:246:in
`scoping'
from
/Users/.rvm/gems/ruby-2.0.0-p0/gems/activerecord-4.0.0.rc1/lib/active_record/scoping/named.rb:163:in
`block in scope'
from /Users/app/models/user.rb:78:in `within_miles'
from (irb):2
user.rb:
scope :within_miles_of_zip, lambda {|radius, zip|
# Get the parameters for the search
area = zip.area_for(radius)
# now find all zip codes that are within
# these min/max lat/lon bounds and return them
# weed out any zip codes that fall outside of the search radius
{ :select => "#{User.columns.map{|c| "users.#{c.name}"}.join(', ')},
sqrt(
pow(#{area[:lat_miles]} * (zips.lat - #{zip.lat}),2) +
pow(#{area[:lon_miles]} * (zips.lon - #{zip.lon}),2)) as distance",
:joins => :zip,
:conditions => "(zips.lat BETWEEN #{area[:min_lat]} AND
#{area[:max_lat]})
AND (zips.lon BETWEEN #{area[:min_lon]} AND #{area[:max_lon]})
AND sqrt(pow(#{area[:lat_miles]} * (zips.lat - #{zip.lat}),2) +
pow(#{area[:lon_miles]} * (zips.lon - #{zip.lon}),2)) <=
#{area[:radius]}",
:order => "distance"}
}
def within_miles(radius)
self.class.within_miles_of_zip(radius, zip)
end
zip.rb:
def area_for(radius)
area = {}
area[:radius] = radius.to_f
area[:lat_miles] = 69.172 #this is constant
#longitude miles varies based on latitude, that is calculated here
area[:lon_miles] = (area[:lat_miles] * Math.cos(lat *
(Math::PI/180))).abs
area[:lat_degrees] = radius/area[:lat_miles] #radius in degrees latitude
area[:lon_degrees] = radius/area[:lon_miles] #radius in degrees
longitude
#now set min and max lat and long accordingly
area[:min_lat] = lat - area[:lat_degrees]
area[:max_lat] = lat + area[:lat_degrees]
area[:min_lon] = lon - area[:lon_degrees]
area[:max_lon] = lon + area[:lon_degrees]
area
end
Sunday, 15 September 2013
Playframework : http.path is set, but can't locate to home page
Playframework : http.path is set, but can't locate to home page
I've set the home path in application.conf:
http.path=/vcloud/
But now I can't access http://localhost:9000/vcloud/, I thought this path
should direct to my home page, but now it's an 404 error page.
Here's my routes:
# Routes
# This file defines all application routes (Higher priority routes first)
# ~~~~
# Home page
GET / Application.index
# Ignore favicon requests
GET /favicon.ico 404
# Map static resources from the /app/public folder to the /public path
GET /public/ staticDir:public
# Catch all
* /{controller}/{action} {controller}.{action}
I've set the home path in application.conf:
http.path=/vcloud/
But now I can't access http://localhost:9000/vcloud/, I thought this path
should direct to my home page, but now it's an 404 error page.
Here's my routes:
# Routes
# This file defines all application routes (Higher priority routes first)
# ~~~~
# Home page
GET / Application.index
# Ignore favicon requests
GET /favicon.ico 404
# Map static resources from the /app/public folder to the /public path
GET /public/ staticDir:public
# Catch all
* /{controller}/{action} {controller}.{action}
How can I save an image to a mobile photo album from a website?
How can I save an image to a mobile photo album from a website?
I'm creating a web mobile app with jQuery, javascript and HTML. My app
generates an image (img HTML component) and I want to save it on the
mobile device's photo album. Is that possible?
Thanks!
I'm creating a web mobile app with jQuery, javascript and HTML. My app
generates an image (img HTML component) and I want to save it on the
mobile device's photo album. Is that possible?
Thanks!
How do I make my html5 form send an email?
How do I make my html5 form send an email?
<form method="post">
<div class="row half">
<div class="6u"><input type="text"
class="text" name="name"
placeholder="Name" /></div>
<div class="6u"><input type="text"
class="text" name="email"
placeholder="Email" /></div>
</div>
<div class="row half">
<div class="12u">
<textarea name="message"
placeholder="Message"></textarea>
</div>
</div>
<div class="row">
<div class="12u">
<a href="#" class="button submit">Send
Message</a>
</div>
</div>
</form>
Here is my code for the html5 form. I am trying to make it send emails to
me but I am not sure how to accomplish this. I know I need to create an
PHP file. Can someone please help me?
<form method="post">
<div class="row half">
<div class="6u"><input type="text"
class="text" name="name"
placeholder="Name" /></div>
<div class="6u"><input type="text"
class="text" name="email"
placeholder="Email" /></div>
</div>
<div class="row half">
<div class="12u">
<textarea name="message"
placeholder="Message"></textarea>
</div>
</div>
<div class="row">
<div class="12u">
<a href="#" class="button submit">Send
Message</a>
</div>
</div>
</form>
Here is my code for the html5 form. I am trying to make it send emails to
me but I am not sure how to accomplish this. I know I need to create an
PHP file. Can someone please help me?
How can we change width of search fields in DataTables
How can we change width of search fields in DataTables
Can I change the width of search text fields in dataTables ?
I am writing following code right now but it is not working.
$('#example').dataTable()
.columnFilter({ sPlaceHolder: "head:before",
aoColumns: [ { type: "text",width:"10px" },
{ type: "date-range" },
{ type: "date-range" }
]
});
And if my dataTables is dynamically generated like as gven below:
$('#example').dataTable({
"aaData": aDataSet,
"aoColumns": [
{ "sTitle": "#","sWidth": "10px" },
{ "sTitle": "ID" },
{ "sTitle": "Staff Name" },
{ "sTitle": "Rig Days" },
{ "sTitle": "Manager"},
{ "sTitle": "Grade"},
{ "sTitle": "Tools"},
{ "sTitle": "Vacations"},
{ "sTitle": "Presently On"},
]
});
}
How to add Search field in this dynamically created DataTable to search by
each column?
Can I change the width of search text fields in dataTables ?
I am writing following code right now but it is not working.
$('#example').dataTable()
.columnFilter({ sPlaceHolder: "head:before",
aoColumns: [ { type: "text",width:"10px" },
{ type: "date-range" },
{ type: "date-range" }
]
});
And if my dataTables is dynamically generated like as gven below:
$('#example').dataTable({
"aaData": aDataSet,
"aoColumns": [
{ "sTitle": "#","sWidth": "10px" },
{ "sTitle": "ID" },
{ "sTitle": "Staff Name" },
{ "sTitle": "Rig Days" },
{ "sTitle": "Manager"},
{ "sTitle": "Grade"},
{ "sTitle": "Tools"},
{ "sTitle": "Vacations"},
{ "sTitle": "Presently On"},
]
});
}
How to add Search field in this dynamically created DataTable to search by
each column?
Algorithm/DataStructure to use to assign labels to entities based on their start and end times (Ruby)
Algorithm/DataStructure to use to assign labels to entities based on their
start and end times (Ruby)
I have a Ruby script that I inherited, where its reading a csv file
containing "TV programs" that have a start time, and end time in this
format:
start_time = 20:00:00
end_time = 20:45:00
The goal is to assign each TV program a "time-slot" (one of the following
values) based on the start and end times:
23:00:00 - 05:00:00 = Late Night = l
05:00:00 - 09:00:00 = Morning = m
09:00:00 - 17:00:00 = Day Time = d
17:00:00 - 20:00:00 = Evening = e
20:00:00 - 23:00:00 = Prime = p
Right now I have a giant if/else statement that is about 100 lines of Ruby
Code:
if(start_time >= 50000 && start_time < 90000) #start time is between 5
and 9 am
if(end_time <= 90000)
@timeSlot = ["Morning"]
puts "timeSlot = [Morning]"
elsif(end_time <= 170000 && end_time > 90000)
@timeSlot = ["Morning", "Daytime"]
puts "timeSlot = [Morning, Daytime]"
elsif(end_time <= 200000 && end_time > 90000 && end_time > 170000)
@timeSlot =["Morning", "Daytime", "Evening"]
puts "timeSlot =[Morning, Daytime, Evening]"
elsif(end_time <= 230000 && end_time > 90000 && end_time > 170000 &&
end_time > 200000)
@timeSlot =["Morning", "Daytime", "Evening", "Prime"]
puts "timeSlot =[Morning, Daytime, Evening, Prime]"
else
@timeSlot =["Morning", "Daytime", "Evening", "Prime", "LateNight"]
puts "timeSlot =[Morning, Daytime, Evening, Prime, LateNight]"
end
elsif (start_time >= 90000 && start_time < 170000)
.........
........
end
Im trying to change the implementation so the code is easy to maintain and
extend and read. My first try at this problem was to solve it visually
using a matrix in excel as shown.
This is the problem displayed visually. Now the question is how to do this
in code in an efficient way?
Any advice is welcome
start and end times (Ruby)
I have a Ruby script that I inherited, where its reading a csv file
containing "TV programs" that have a start time, and end time in this
format:
start_time = 20:00:00
end_time = 20:45:00
The goal is to assign each TV program a "time-slot" (one of the following
values) based on the start and end times:
23:00:00 - 05:00:00 = Late Night = l
05:00:00 - 09:00:00 = Morning = m
09:00:00 - 17:00:00 = Day Time = d
17:00:00 - 20:00:00 = Evening = e
20:00:00 - 23:00:00 = Prime = p
Right now I have a giant if/else statement that is about 100 lines of Ruby
Code:
if(start_time >= 50000 && start_time < 90000) #start time is between 5
and 9 am
if(end_time <= 90000)
@timeSlot = ["Morning"]
puts "timeSlot = [Morning]"
elsif(end_time <= 170000 && end_time > 90000)
@timeSlot = ["Morning", "Daytime"]
puts "timeSlot = [Morning, Daytime]"
elsif(end_time <= 200000 && end_time > 90000 && end_time > 170000)
@timeSlot =["Morning", "Daytime", "Evening"]
puts "timeSlot =[Morning, Daytime, Evening]"
elsif(end_time <= 230000 && end_time > 90000 && end_time > 170000 &&
end_time > 200000)
@timeSlot =["Morning", "Daytime", "Evening", "Prime"]
puts "timeSlot =[Morning, Daytime, Evening, Prime]"
else
@timeSlot =["Morning", "Daytime", "Evening", "Prime", "LateNight"]
puts "timeSlot =[Morning, Daytime, Evening, Prime, LateNight]"
end
elsif (start_time >= 90000 && start_time < 170000)
.........
........
end
Im trying to change the implementation so the code is easy to maintain and
extend and read. My first try at this problem was to solve it visually
using a matrix in excel as shown.
This is the problem displayed visually. Now the question is how to do this
in code in an efficient way?
Any advice is welcome
Auto Categorization Of Android Application
Auto Categorization Of Android Application
How do I automatically categorise an android application ? I need to write
a code to do it. There exists an api & android application CatApplus
http://forum.xda-developers.com/showthread.php?t=1419810. But it is not
freely available. Can anyone suggest any alternative or any other way to
solve this problem ?
How do I automatically categorise an android application ? I need to write
a code to do it. There exists an api & android application CatApplus
http://forum.xda-developers.com/showthread.php?t=1419810. But it is not
freely available. Can anyone suggest any alternative or any other way to
solve this problem ?
BitmapFactory decode issue
BitmapFactory decode issue
url="http://www.nasa.gov/sites/default/files/styles/946xvariable_height/public/ladee_spin_2_in_motion_0_0.jpg?itok=yNhf69rE";
try {
HttpURLConnection connection = (HttpURLConnection)new
URL(url).openConnection();
connection.setDoInput(true);
connection.connect();
InputStream input = connection.getInputStream();
Bitmap bitmap = BitmapFactory.decodeStream(input);
input.close();
return bitmap;
}
catch (Exception e)
{
e.printStackTrace();
return null;
}
I was tryning to retreive image from the url but no matter what it always
returns null. In debugging mode I have observed that it happens when it
tries input.close(); . How can I possibly get the Image.
url="http://www.nasa.gov/sites/default/files/styles/946xvariable_height/public/ladee_spin_2_in_motion_0_0.jpg?itok=yNhf69rE";
try {
HttpURLConnection connection = (HttpURLConnection)new
URL(url).openConnection();
connection.setDoInput(true);
connection.connect();
InputStream input = connection.getInputStream();
Bitmap bitmap = BitmapFactory.decodeStream(input);
input.close();
return bitmap;
}
catch (Exception e)
{
e.printStackTrace();
return null;
}
I was tryning to retreive image from the url but no matter what it always
returns null. In debugging mode I have observed that it happens when it
tries input.close(); . How can I possibly get the Image.
Saturday, 14 September 2013
Java Swing using one of the table column as button
Java Swing using one of the table column as button
I want to use a whole table column as a button. I am using java swing in
Net beans software. How do I get it ? I read docs and even googled. But
nothing is helping me out.
I want to use a whole table column as a button. I am using java swing in
Net beans software. How do I get it ? I read docs and even googled. But
nothing is helping me out.
relation between QcheckBox and QLineEdit and sound like a bug
relation between QcheckBox and QLineEdit and sound like a bug
I have a set checkbox and linEdit and i disbaled lineEdit by default, When
i click on checkox related to lineEdit, the given checkbox will be
enabled.Then after click a pushbutton or editingFinished signal i send
content of lineEdit to a my slot: setFilterDict.
But i have a serious problem:
I checked a checkbox and write my text in LineEdit, its, Ok,But i need to
once disable it and enbale to send my data to my slot.
My connects functions are:
##### Slots for checkboxes (enable/disabling)
QtCore.QObject.connect(self.checkBox,
QtCore.SIGNAL(_fromUtf8("stateChanged(int)")), self.lineEdit.setEnabled)
QtCore.QObject.connect(self.checkBox_3,
QtCore.SIGNAL(_fromUtf8("stateChanged(int)")), self.dateEdit.setEnabled)
QtCore.QObject.connect(self.checkBox_3,
QtCore.SIGNAL(_fromUtf8("stateChanged(int)")), self.dateEdit_2.setEnabled)
QtCore.QObject.connect(self.checkBox,
QtCore.SIGNAL(_fromUtf8("stateChanged(int)")), self.lineEdit.setEnabled)
QtCore.QObject.connect(self.checkBox_2,
QtCore.SIGNAL(_fromUtf8("stateChanged(int)")), self.lineEdit_2.setEnabled)
QtCore.QObject.connect(self.checkBox_4,
QtCore.SIGNAL(_fromUtf8("stateChanged(int)")), self.lineEdit_3.setEnabled)
#####
##### Slots for checkboxes/lineEdits (filling dict for database fields and
values)
QtCore.QObject.connect(self.checkBox,
QtCore.SIGNAL(_fromUtf8("clicked(bool)")), lambda:
self.interfaceCodesConstructor.setFilterDict(self,"name",self.lineEdit.text()))
QtCore.QObject.connect(self.checkBox_2,
QtCore.SIGNAL(_fromUtf8("clicked(bool)")), lambda:
self.interfaceCodesConstructor.setFilterDict(self,"bought_price",persianToInteger(unicode(self.lineEdit_2.text()))))
QtCore.QObject.connect(self.checkBox_3,
QtCore.SIGNAL(_fromUtf8("clicked(bool)")), lambda:
self.interfaceCodesConstructor.setFilterDict(self,"bought_date",self.dateEdit.text()))
##date
QtCore.QObject.connect(self.checkBox_4,
QtCore.SIGNAL(_fromUtf8("clicked(bool)")), lambda:
self.interfaceCodesConstructor.setFilterDict(self,"stock",persianToInteger(unicode(self.lineEdit_3.text()))))
QtCore.QObject.connect(self.lineEdit,
QtCore.SIGNAL(_fromUtf8("editingFinished()")), lambda:
self.interfaceCodesConstructor.responseToRequestForData(self))
QtCore.QObject.connect(self.lineEdit_2,
QtCore.SIGNAL(_fromUtf8("editingFinished()")), lambda:
self.interfaceCodesConstructor.responseToRequestForData(self))
QtCore.QObject.connect(self.lineEdit_3,
QtCore.SIGNAL(_fromUtf8("editingFinished()")), lambda:
self.interfaceCodesConstructor.responseToRequestForData(self))
#### pressing seach key and start search action
QtCore.QObject.connect(self.lineEdit,
QtCore.SIGNAL(_fromUtf8("returnPressed()")), lambda:
self.interfaceCodesConstructor.responseToRequestForData(self))
QtCore.QObject.connect(self.pushButtonSearch,
QtCore.SIGNAL(_fromUtf8("clicked()")), lambda:
self.interfaceCodesConstructor.responseToRequestForData(self))
#######
## enable/disabling "price date" checkbox
QtCore.QObject.connect(self.checkBox_3,
QtCore.SIGNAL(_fromUtf8("toggled(bool)")), self.dateEdit.setEnabled)
QtCore.QObject.connect(self.checkBox_3,
QtCore.SIGNAL(_fromUtf8("toggled(bool)")), self.dateEdit_2.setEnabled)
My question is, I need to just enable and write text in lineEdit to send
data, how to write my connects functions?
Notes: setFilterDict get field name and content of lineEdit and fill in
dict.and responseToRequestForData start to query.
I have a set checkbox and linEdit and i disbaled lineEdit by default, When
i click on checkox related to lineEdit, the given checkbox will be
enabled.Then after click a pushbutton or editingFinished signal i send
content of lineEdit to a my slot: setFilterDict.
But i have a serious problem:
I checked a checkbox and write my text in LineEdit, its, Ok,But i need to
once disable it and enbale to send my data to my slot.
My connects functions are:
##### Slots for checkboxes (enable/disabling)
QtCore.QObject.connect(self.checkBox,
QtCore.SIGNAL(_fromUtf8("stateChanged(int)")), self.lineEdit.setEnabled)
QtCore.QObject.connect(self.checkBox_3,
QtCore.SIGNAL(_fromUtf8("stateChanged(int)")), self.dateEdit.setEnabled)
QtCore.QObject.connect(self.checkBox_3,
QtCore.SIGNAL(_fromUtf8("stateChanged(int)")), self.dateEdit_2.setEnabled)
QtCore.QObject.connect(self.checkBox,
QtCore.SIGNAL(_fromUtf8("stateChanged(int)")), self.lineEdit.setEnabled)
QtCore.QObject.connect(self.checkBox_2,
QtCore.SIGNAL(_fromUtf8("stateChanged(int)")), self.lineEdit_2.setEnabled)
QtCore.QObject.connect(self.checkBox_4,
QtCore.SIGNAL(_fromUtf8("stateChanged(int)")), self.lineEdit_3.setEnabled)
#####
##### Slots for checkboxes/lineEdits (filling dict for database fields and
values)
QtCore.QObject.connect(self.checkBox,
QtCore.SIGNAL(_fromUtf8("clicked(bool)")), lambda:
self.interfaceCodesConstructor.setFilterDict(self,"name",self.lineEdit.text()))
QtCore.QObject.connect(self.checkBox_2,
QtCore.SIGNAL(_fromUtf8("clicked(bool)")), lambda:
self.interfaceCodesConstructor.setFilterDict(self,"bought_price",persianToInteger(unicode(self.lineEdit_2.text()))))
QtCore.QObject.connect(self.checkBox_3,
QtCore.SIGNAL(_fromUtf8("clicked(bool)")), lambda:
self.interfaceCodesConstructor.setFilterDict(self,"bought_date",self.dateEdit.text()))
##date
QtCore.QObject.connect(self.checkBox_4,
QtCore.SIGNAL(_fromUtf8("clicked(bool)")), lambda:
self.interfaceCodesConstructor.setFilterDict(self,"stock",persianToInteger(unicode(self.lineEdit_3.text()))))
QtCore.QObject.connect(self.lineEdit,
QtCore.SIGNAL(_fromUtf8("editingFinished()")), lambda:
self.interfaceCodesConstructor.responseToRequestForData(self))
QtCore.QObject.connect(self.lineEdit_2,
QtCore.SIGNAL(_fromUtf8("editingFinished()")), lambda:
self.interfaceCodesConstructor.responseToRequestForData(self))
QtCore.QObject.connect(self.lineEdit_3,
QtCore.SIGNAL(_fromUtf8("editingFinished()")), lambda:
self.interfaceCodesConstructor.responseToRequestForData(self))
#### pressing seach key and start search action
QtCore.QObject.connect(self.lineEdit,
QtCore.SIGNAL(_fromUtf8("returnPressed()")), lambda:
self.interfaceCodesConstructor.responseToRequestForData(self))
QtCore.QObject.connect(self.pushButtonSearch,
QtCore.SIGNAL(_fromUtf8("clicked()")), lambda:
self.interfaceCodesConstructor.responseToRequestForData(self))
#######
## enable/disabling "price date" checkbox
QtCore.QObject.connect(self.checkBox_3,
QtCore.SIGNAL(_fromUtf8("toggled(bool)")), self.dateEdit.setEnabled)
QtCore.QObject.connect(self.checkBox_3,
QtCore.SIGNAL(_fromUtf8("toggled(bool)")), self.dateEdit_2.setEnabled)
My question is, I need to just enable and write text in lineEdit to send
data, how to write my connects functions?
Notes: setFilterDict get field name and content of lineEdit and fill in
dict.and responseToRequestForData start to query.
How to use previous information when I use "by"?
How to use previous information when I use "by"?
I have a data from forex market(mydt) saved by data.table:
datetime|side(0=Bid,1=Ask)| distance(1:best price, 2: 2nd best)| price
2008/01/28,09:11:28.000,0,1,1.6066
2008/01/28,09:11:28.000,0,2,1.6065
2008/01/28,09:11:28.000,1,1,1.6068
2008/01/28,09:11:28.000,1,2,1.6069
2008/01/28,09:11:29.000,0,1,1.6067
2008/01/28,09:11:29.000,0,2,1.6066
2008/01/28,09:11:30.000,0,1,1.6065
2008/01/28,09:11:30.000,0,2,1.6064
2008/01/28,09:11:30.000,1,1,1.6066
2008/01/28,09:11:30.000,1,2,1.6067
I want to calculate spread=minAsk-maxBid in each block of time. The usual
way is to write:
mydt[,min(price[side==1]) - max(price[side==0]),by=datetime]
However, data has been summarized by this rule: If there is no change in
one side, there will be no record in the data. That means comparing block
1 and block 2, there was no change in this part and no record:
2008/01/28,09:11:28.000,1,1,1.6067
2008/01/28,09:11:28.000,1,2,1.6068
I want to go block by block to calculate some variables(spread, or
weighted average price), however sometimes I need information from
previous block(because of this rule). How can I do that?
I have a data from forex market(mydt) saved by data.table:
datetime|side(0=Bid,1=Ask)| distance(1:best price, 2: 2nd best)| price
2008/01/28,09:11:28.000,0,1,1.6066
2008/01/28,09:11:28.000,0,2,1.6065
2008/01/28,09:11:28.000,1,1,1.6068
2008/01/28,09:11:28.000,1,2,1.6069
2008/01/28,09:11:29.000,0,1,1.6067
2008/01/28,09:11:29.000,0,2,1.6066
2008/01/28,09:11:30.000,0,1,1.6065
2008/01/28,09:11:30.000,0,2,1.6064
2008/01/28,09:11:30.000,1,1,1.6066
2008/01/28,09:11:30.000,1,2,1.6067
I want to calculate spread=minAsk-maxBid in each block of time. The usual
way is to write:
mydt[,min(price[side==1]) - max(price[side==0]),by=datetime]
However, data has been summarized by this rule: If there is no change in
one side, there will be no record in the data. That means comparing block
1 and block 2, there was no change in this part and no record:
2008/01/28,09:11:28.000,1,1,1.6067
2008/01/28,09:11:28.000,1,2,1.6068
I want to go block by block to calculate some variables(spread, or
weighted average price), however sometimes I need information from
previous block(because of this rule). How can I do that?
How to run terminal commands using Dart HttpRequest?
How to run terminal commands using Dart HttpRequest?
I need to send a request to the server to run a jar file with a string
argument/parameter and return the results as a string.
I need to send a request to the server to run a jar file with a string
argument/parameter and return the results as a string.
Garbage collector example doesn't hold
Garbage collector example doesn't hold
i was reading the thinking in java chapter about the garbage collector,
and i found out an example which is running once upon a while. But i can't
figure out why.
public class Book {
boolean checkedOut = false;
Book(boolean checkOut) {
checkedOut = checkOut;
}
void checkIn() {
checkedOut = false;
}
@Override
protected void finalize() {
if (checkedOut) {
System.out.println("Error: checked out");
}
// Normally, you'll also do this:
//super.finalize(); // Call the base-class version
}
public static void main(String[] args) {
Book novel = new Book(true);
// Proper cleanup:
novel.checkIn();
// Drop the reference, forget to clean up:
new Book(true);
// Force garbage collection & finalization:
System.gc();
}
}
The call to System.gc() should force finalization of objects even if the
memory is not running out.
Thus why the programs output Error: checked out only after 4-5 execution
in a row? i can't get the point, can you try to clarify it out please? I
expect that everytime the GC is called the finalize method is executed as
well, thus everytime the check out error should be promped.
Thanks
i was reading the thinking in java chapter about the garbage collector,
and i found out an example which is running once upon a while. But i can't
figure out why.
public class Book {
boolean checkedOut = false;
Book(boolean checkOut) {
checkedOut = checkOut;
}
void checkIn() {
checkedOut = false;
}
@Override
protected void finalize() {
if (checkedOut) {
System.out.println("Error: checked out");
}
// Normally, you'll also do this:
//super.finalize(); // Call the base-class version
}
public static void main(String[] args) {
Book novel = new Book(true);
// Proper cleanup:
novel.checkIn();
// Drop the reference, forget to clean up:
new Book(true);
// Force garbage collection & finalization:
System.gc();
}
}
The call to System.gc() should force finalization of objects even if the
memory is not running out.
Thus why the programs output Error: checked out only after 4-5 execution
in a row? i can't get the point, can you try to clarify it out please? I
expect that everytime the GC is called the finalize method is executed as
well, thus everytime the check out error should be promped.
Thanks
Parse javascript value from HTML response in C#
Parse javascript value from HTML response in C#
I'm actually building an application where by using an HttpClient in .NET
4.5, I send a GET request to a webpage (which isn't mine) and I receive
this response in the Content:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:widget="http://www.netvibes.com/ns/">
<head>
<meta http-equiv="content-type"
content="text/html;charset=utf-8" />
<script type="text/javascript">var
NREUMQ=NREUMQ||[];NREUMQ.push(["mark","firstbyte",new
Date().getTime()]);</script><title>Site</title>
<script type="text/javascript">
var HOST_DOMAIN = 'http://www.site.com/';
var ID = '2261443944';
var BASE_URL = 'https://base.site.com';
</script>
</head>
<body >
</body>
</html>
What I would like to do is somehow Parse the values HOST_DOMAIN, ID and
BASE_URL from the js script in the head section using .NET 4.5 libraries,
but I can't find how. Any ideas?
I'm actually building an application where by using an HttpClient in .NET
4.5, I send a GET request to a webpage (which isn't mine) and I receive
this response in the Content:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:widget="http://www.netvibes.com/ns/">
<head>
<meta http-equiv="content-type"
content="text/html;charset=utf-8" />
<script type="text/javascript">var
NREUMQ=NREUMQ||[];NREUMQ.push(["mark","firstbyte",new
Date().getTime()]);</script><title>Site</title>
<script type="text/javascript">
var HOST_DOMAIN = 'http://www.site.com/';
var ID = '2261443944';
var BASE_URL = 'https://base.site.com';
</script>
</head>
<body >
</body>
</html>
What I would like to do is somehow Parse the values HOST_DOMAIN, ID and
BASE_URL from the js script in the head section using .NET 4.5 libraries,
but I can't find how. Any ideas?
Django on Azure not loading static files
Django on Azure not loading static files
I followed the tutorial below to create a django project on azure:
http://www.windowsazure.com/en-us/develop/python/tutorials/web-sites-with-django/
Everything worked fine until I tried to install the
django_admin_bootstrapped app. Now all static requests return 404 error. I
don't if the new app caused the problem or just exposed it.
I have this:
STATIC_ROOT = ''
# URL prefix for static files.
# Example: "http://media.lawrence.com/static/"
STATIC_URL = '/static/'
# Additional locations of static files
STATICFILES_DIRS = (
# Put strings here, like "/home/html/static" or "C:/www/django/static".
# Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.
#os.path.join(PROJECT_DIR,
'site-packages/django_admin_bootstrapped/static'),
)
I read quite a bit online and some people say you have to configure your
server to serve static files. I don't have direct access to the server,
it's an azure website and I deploy through git. And like I said, the admin
and everything used to work before I tried to install these apps that
bootstrap the admin. Now even when the app is not under INSTALLED_APPS I
don't get any css or js files.
Thanks!
I followed the tutorial below to create a django project on azure:
http://www.windowsazure.com/en-us/develop/python/tutorials/web-sites-with-django/
Everything worked fine until I tried to install the
django_admin_bootstrapped app. Now all static requests return 404 error. I
don't if the new app caused the problem or just exposed it.
I have this:
STATIC_ROOT = ''
# URL prefix for static files.
# Example: "http://media.lawrence.com/static/"
STATIC_URL = '/static/'
# Additional locations of static files
STATICFILES_DIRS = (
# Put strings here, like "/home/html/static" or "C:/www/django/static".
# Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.
#os.path.join(PROJECT_DIR,
'site-packages/django_admin_bootstrapped/static'),
)
I read quite a bit online and some people say you have to configure your
server to serve static files. I don't have direct access to the server,
it's an azure website and I deploy through git. And like I said, the admin
and everything used to work before I tried to install these apps that
bootstrap the admin. Now even when the app is not under INSTALLED_APPS I
don't get any css or js files.
Thanks!
Friday, 13 September 2013
Need Advice! Use .csv data in a spreadsheet directly from a local drive
Need Advice! Use .csv data in a spreadsheet directly from a local drive
I'm trying to write a script to directly upload data from a .csv file
stored on a local hard drive to a google spreadsheet without placing the
.csv into the google docs list.
I realize that google spreadsheets already has a function for doing this,
but my end game here is to be able to upload data daily from a .csv on a
local drive, to my script, sort through it, and return only the necessary
information to a spreadsheet.
Currently I'm trying to test my readDSR (should be reading the uploaded
.csv)function by returning the .csv data as a string in my spreadsheet.
However it won't work. I would really appreciate some help on this one. My
code is below
Thanks, -Jamie
function onOpen() {
var sheet = SpreadsheetApp.getActiveSpreadsheet();
var entries =
[ {name:"Read Data", functionName:"readRows"},
{name:"Upload DSR", functionName:"findDSR()"} ];
sheet.addMenu("Du-par's", entries);
};
function findDSR() {
var openFile = UiApp.createApplication();
var formContent = openFile.createVerticalPanel();
formContent.add(openFile.createFileUpload().setName("DSRfile"));
formContent.add(openFile.createSubmitButton("Start Upload"));
var form = openFile.createFormPanel();
form.add(formContent);
openFile.add(form);
SpreadsheetApp.getActiveSpreadsheet().show(openFile);
}
function readDSR(e) {
DSR = e.parameter.DSRfile;
csvFile = DSR.getContentAsString();
var sheet = getActiveSheet();
var lastRow = sheet.getLastRow()+1;
var lastCell = sheet.getLastCell("A"+lastRow);
lastCell.setValue = csvFile;
}
}
I'm trying to write a script to directly upload data from a .csv file
stored on a local hard drive to a google spreadsheet without placing the
.csv into the google docs list.
I realize that google spreadsheets already has a function for doing this,
but my end game here is to be able to upload data daily from a .csv on a
local drive, to my script, sort through it, and return only the necessary
information to a spreadsheet.
Currently I'm trying to test my readDSR (should be reading the uploaded
.csv)function by returning the .csv data as a string in my spreadsheet.
However it won't work. I would really appreciate some help on this one. My
code is below
Thanks, -Jamie
function onOpen() {
var sheet = SpreadsheetApp.getActiveSpreadsheet();
var entries =
[ {name:"Read Data", functionName:"readRows"},
{name:"Upload DSR", functionName:"findDSR()"} ];
sheet.addMenu("Du-par's", entries);
};
function findDSR() {
var openFile = UiApp.createApplication();
var formContent = openFile.createVerticalPanel();
formContent.add(openFile.createFileUpload().setName("DSRfile"));
formContent.add(openFile.createSubmitButton("Start Upload"));
var form = openFile.createFormPanel();
form.add(formContent);
openFile.add(form);
SpreadsheetApp.getActiveSpreadsheet().show(openFile);
}
function readDSR(e) {
DSR = e.parameter.DSRfile;
csvFile = DSR.getContentAsString();
var sheet = getActiveSheet();
var lastRow = sheet.getLastRow()+1;
var lastCell = sheet.getLastCell("A"+lastRow);
lastCell.setValue = csvFile;
}
}
Setting up a specific UITableViewCell Layout
Setting up a specific UITableViewCell Layout
I am trying to find the best route to setting up a custom UITableViewCell
Layout. This is the layout I am trying to achieve.
The colourful part represents an imageview. The UIImageView appears to
over hang the edges of the cell.
But from what I can gather this would actually be the whole cell. I
understand that the cell has multiple different views like content,
background but not sure how to implement this.
I have tried in IB but I think this is too custom. How do I create a cell
like this with an overhang as such and a custom layout for the cell.
I am trying to find the best route to setting up a custom UITableViewCell
Layout. This is the layout I am trying to achieve.
The colourful part represents an imageview. The UIImageView appears to
over hang the edges of the cell.
But from what I can gather this would actually be the whole cell. I
understand that the cell has multiple different views like content,
background but not sure how to implement this.
I have tried in IB but I think this is too custom. How do I create a cell
like this with an overhang as such and a custom layout for the cell.
Uncaught TypeError: Cannot call method 'hasAttribute' of undefined
Uncaught TypeError: Cannot call method 'hasAttribute' of undefined
I am trying to check if buttons has name attribute or not.The Following
line is giving result correctly.
alert(course_view_buttons[30].hasAttribute("name"));
But the following code is giving an error like this-
"Uncaught TypeError: Cannot call method 'hasAttribute' of undefined "
The full code is here-
var course_view_buttons = document.getElementsByTagName("button");
alert(course_view_buttons.length);
var a=0;
for (x=0;x<=course_view_buttons.length;x++){
if(course_view_buttons[x].hasAttribute("name");){
a++;
}
}
alert(a);
Please help me if anyone can.I am stuck in this for 4-5 hours. Thanks in
advance.
I am trying to check if buttons has name attribute or not.The Following
line is giving result correctly.
alert(course_view_buttons[30].hasAttribute("name"));
But the following code is giving an error like this-
"Uncaught TypeError: Cannot call method 'hasAttribute' of undefined "
The full code is here-
var course_view_buttons = document.getElementsByTagName("button");
alert(course_view_buttons.length);
var a=0;
for (x=0;x<=course_view_buttons.length;x++){
if(course_view_buttons[x].hasAttribute("name");){
a++;
}
}
alert(a);
Please help me if anyone can.I am stuck in this for 4-5 hours. Thanks in
advance.
How to add a row to a DataGridView bound to a data table
How to add a row to a DataGridView bound to a data table
I have a DataGridView that is bound to a data table. I would like to add a
row just to the DataGridView and not to the data source. Is this possible?
Thanks, Brad
I have a DataGridView that is bound to a data table. I would like to add a
row just to the DataGridView and not to the data source. Is this possible?
Thanks, Brad
How can i pick the comma separated attribute value in xml one by one as loop in c#
How can i pick the comma separated attribute value in xml one by one as
loop in c#
I would like to use comma separated attribute values defined under
TestCondition in xml one by one in loop for further execution of my
code.Please find the sample xml as follows:
<DrWatson>
<Bugs Name="TEST" TestCondition="STATE,STATUS">
<Bug>
<family>ESG</family>
<product>Dr.Watson</product>
<version>Xpress API</version>
<productarea>1</productarea>
<subarea>Blank</subarea>
</Bug>
<DrWatson>
I am calling the individual attribute value in my code as follows:
attrVal_New = Update_Bugs[m].Attributes["TestCondition"].Value;
string attributelowercase = attrVal_New.ToLower();
m++;
what i want is to use 'STATE' and 'STATUS' available under TestCondition
one by one.Please suggest.
loop in c#
I would like to use comma separated attribute values defined under
TestCondition in xml one by one in loop for further execution of my
code.Please find the sample xml as follows:
<DrWatson>
<Bugs Name="TEST" TestCondition="STATE,STATUS">
<Bug>
<family>ESG</family>
<product>Dr.Watson</product>
<version>Xpress API</version>
<productarea>1</productarea>
<subarea>Blank</subarea>
</Bug>
<DrWatson>
I am calling the individual attribute value in my code as follows:
attrVal_New = Update_Bugs[m].Attributes["TestCondition"].Value;
string attributelowercase = attrVal_New.ToLower();
m++;
what i want is to use 'STATE' and 'STATUS' available under TestCondition
one by one.Please suggest.
Thursday, 12 September 2013
Understanding Bootstrap 3 Collapse
Understanding Bootstrap 3 Collapse
i am trying to understand the source of bootstrap collapse plugin. Sorry
if i am asking a stupid question.
Collapse.prototype.dimension = function () {
var hasWidth = this.$element.hasClass('width');
return hasWidth ? 'width' : 'height'
}
what is this used for? why is it checking for width class? and i couldn't
find any method that add width or height class. it seems like it is always
returning 'height', then why not just return height directly?
thanks in advance.
-Roy
i am trying to understand the source of bootstrap collapse plugin. Sorry
if i am asking a stupid question.
Collapse.prototype.dimension = function () {
var hasWidth = this.$element.hasClass('width');
return hasWidth ? 'width' : 'height'
}
what is this used for? why is it checking for width class? and i couldn't
find any method that add width or height class. it seems like it is always
returning 'height', then why not just return height directly?
thanks in advance.
-Roy
Rails 4 rendering partials with assets extremely slow
Rails 4 rendering partials with assets extremely slow
I recently upgraded our application to Rails 4. Since upgrading rendering
times for a view with image assets loads extremely slowly.
A page with 10 assets can take as much as 8 seconds and some pages oh
heroku will simply timeout due to the rendering taking too long.
I know in Rails 3.2.13 there was an issue with config.assets.debug set to
true by default but that was fixed in Rails 4 I believe.
What could be causing such long rendering times?
Below is the production environment file for reference. Any other details
required, please let me know.
Adventistmedia::Application.configure do
config.cache_classes = true
config.eager_load = true
config.consider_all_requests_local = false
config.action_controller.perform_caching = true
config.cache_store = :dalli_store, {compress: true}
config.serve_static_assets = true # fixes heroku issue
config.static_cache_control = "public, max-age=30758400"
config.assets.js_compressor = :uglifier
config.assets.compile = false
config.assets.digest = true
config.assets.cache_store = :dalli_store
config.assets.debug = false
config.after_initialize do
Delayed::Job.scaler = :heroku_cedar
end
config.assets.precompile += %w(*.png *.jpg *.jpeg *.gif
fontawesome-webfont.ttf fontawesome-webfont.eot FontAwesome.otf
fontawesome-webfont.woff)
config.i18n.fallbacks = true
config.active_support.deprecation = :notify
config.log_formatter = ::Logger::Formatter.new
config.action_controller.asset_host =
"//#{ENV['FOG_DIRECTORY']}.s3.amazonaws.com"
end
I recently upgraded our application to Rails 4. Since upgrading rendering
times for a view with image assets loads extremely slowly.
A page with 10 assets can take as much as 8 seconds and some pages oh
heroku will simply timeout due to the rendering taking too long.
I know in Rails 3.2.13 there was an issue with config.assets.debug set to
true by default but that was fixed in Rails 4 I believe.
What could be causing such long rendering times?
Below is the production environment file for reference. Any other details
required, please let me know.
Adventistmedia::Application.configure do
config.cache_classes = true
config.eager_load = true
config.consider_all_requests_local = false
config.action_controller.perform_caching = true
config.cache_store = :dalli_store, {compress: true}
config.serve_static_assets = true # fixes heroku issue
config.static_cache_control = "public, max-age=30758400"
config.assets.js_compressor = :uglifier
config.assets.compile = false
config.assets.digest = true
config.assets.cache_store = :dalli_store
config.assets.debug = false
config.after_initialize do
Delayed::Job.scaler = :heroku_cedar
end
config.assets.precompile += %w(*.png *.jpg *.jpeg *.gif
fontawesome-webfont.ttf fontawesome-webfont.eot FontAwesome.otf
fontawesome-webfont.woff)
config.i18n.fallbacks = true
config.active_support.deprecation = :notify
config.log_formatter = ::Logger::Formatter.new
config.action_controller.asset_host =
"//#{ENV['FOG_DIRECTORY']}.s3.amazonaws.com"
end
Java - Why can't I change a variable in a while loop?
Java - Why can't I change a variable in a while loop?
For some reason, whenever I do this:
boolean c = true;
int i = 0;
while (i < 10) {
System.out.println(c);
c = false;
i++;
}
This prints true every single time.
For some reason, whenever I do this:
boolean c = true;
int i = 0;
while (i < 10) {
System.out.println(c);
c = false;
i++;
}
This prints true every single time.
Iterate through an array and group off elements in multiple of 3
Iterate through an array and group off elements in multiple of 3
I have a huge array named buffer[], its size is 1000. in every index it
has a hex value like FF. how can I group them off in multiples of 3 so
that I can get a hex color value such as FFFFFF? thank you
buffer{ff,ff,ff,ff,ff,ff,ff,ff}
I have a huge array named buffer[], its size is 1000. in every index it
has a hex value like FF. how can I group them off in multiples of 3 so
that I can get a hex color value such as FFFFFF? thank you
buffer{ff,ff,ff,ff,ff,ff,ff,ff}
Confusion in TCL substitution
Confusion in TCL substitution
I am confused with the following statements .
1) % set a \\\w
\w
2)% set a \\w
\w %
3) % set a \w
\w
% %
In the First statement I am having 5 (backslashes) and it produced 2
(backslashes) as output.
In the second statement I am having 4 (backslashes) and it produced 2
(backslashes) as output.
In the Third statement I am having 2 (backslashes) and it produced 1
(backslashes) as output.
Up to my knowledge '\' is equal to '\' after substitution .
As it is '\\\' it should return single '\' na.
Can Anyone Please Explain me how the substitution occures.
I am confused with the following statements .
1) % set a \\\w
\w
2)% set a \\w
\w %
3) % set a \w
\w
% %
In the First statement I am having 5 (backslashes) and it produced 2
(backslashes) as output.
In the second statement I am having 4 (backslashes) and it produced 2
(backslashes) as output.
In the Third statement I am having 2 (backslashes) and it produced 1
(backslashes) as output.
Up to my knowledge '\' is equal to '\' after substitution .
As it is '\\\' it should return single '\' na.
Can Anyone Please Explain me how the substitution occures.
GridView Item's Detail in Android
GridView Item's Detail in Android
When the GridViewItem is clicked, how can I show the item's detail in
Image and Text?
I would like to use a scroll bar for the text length.
When the GridViewItem is clicked, how can I show the item's detail in
Image and Text?
I would like to use a scroll bar for the text length.
Wednesday, 11 September 2013
How do I set the scroll bar of a div on top?
How do I set the scroll bar of a div on top?
I have a div with a long text, it shows the vertical scroll bar. I
show-hide this div with Jquery so it looks like a popup.
When it's hidden the scroll remains at the place the user put it, so when
it shows up againg the scroll is at the same place, I want it to be on top
every time it shows up again.
So the question is: How do I set the scroll bar of a div on top with jquery??
CODE:
<div class="scroll_div" align="justify">
<p align="center">
Text text text text text text text text text
text text text text text text text text text
text text text text text text text text text
.............
.............
</p>
</div>
I have a div with a long text, it shows the vertical scroll bar. I
show-hide this div with Jquery so it looks like a popup.
When it's hidden the scroll remains at the place the user put it, so when
it shows up againg the scroll is at the same place, I want it to be on top
every time it shows up again.
So the question is: How do I set the scroll bar of a div on top with jquery??
CODE:
<div class="scroll_div" align="justify">
<p align="center">
Text text text text text text text text text
text text text text text text text text text
text text text text text text text text text
.............
.............
</p>
</div>
Using C# I can't get the changes I make in my GridView to save to the SQL Database
Using C# I can't get the changes I make in my GridView to save to the SQL
Database
Here is my code. I am using windows forms. Everything populates the grid
view. I want to be able to make changes to each column in the view. What
step am I missing to get the changes I made to save back to the SQL
Database?
private void button1_Click(object sender, EventArgs e)
{
myConnection.Open();
Cursor.Current = Cursors.WaitCursor;
string query = @"select EmployeeId[Employee], DateIn, cast (timein
as time(0)) [TimeIn], dateout, cast(timeout as time(0))[Time
Out], job ,
costcode from Data_TimeCards_T WHERE (EmployeeID
LIKE '%[^a-zA-Z0-9]%') or (job LIKE
'%[^a-zA-Z0-9]%')";
OleDbDataAdapter dAdapter = new OleDbDataAdapter(query,
myConnection);
OleDbCommandBuilder cBuilder = new OleDbCommandBuilder(dAdapter);
DataTable dTable = new DataTable();
dataGridView1.DataSource = dTable;
dAdapter.Fill(dTable);
DataGridView dgView = new DataGridView();
BindingSource bSource = new BindingSource();
bSource.DataSource = dTable;
dgView.DataSource = bSource;
dAdapter.Update(dTable);
myConnection.Close();
}
Database
Here is my code. I am using windows forms. Everything populates the grid
view. I want to be able to make changes to each column in the view. What
step am I missing to get the changes I made to save back to the SQL
Database?
private void button1_Click(object sender, EventArgs e)
{
myConnection.Open();
Cursor.Current = Cursors.WaitCursor;
string query = @"select EmployeeId[Employee], DateIn, cast (timein
as time(0)) [TimeIn], dateout, cast(timeout as time(0))[Time
Out], job ,
costcode from Data_TimeCards_T WHERE (EmployeeID
LIKE '%[^a-zA-Z0-9]%') or (job LIKE
'%[^a-zA-Z0-9]%')";
OleDbDataAdapter dAdapter = new OleDbDataAdapter(query,
myConnection);
OleDbCommandBuilder cBuilder = new OleDbCommandBuilder(dAdapter);
DataTable dTable = new DataTable();
dataGridView1.DataSource = dTable;
dAdapter.Fill(dTable);
DataGridView dgView = new DataGridView();
BindingSource bSource = new BindingSource();
bSource.DataSource = dTable;
dgView.DataSource = bSource;
dAdapter.Update(dTable);
myConnection.Close();
}
Subscribe to:
Comments (Atom)